【发布时间】:2014-06-20 19:22:23
【问题描述】:
我的问题很简单,但我无法在 R 手册或在线搜索中找到明确的答案。使用 glmer 进行逻辑回归时,是否有一种好方法可以验证您对响应变量的参考是什么?
我得到的结果始终与理论完全相反,我认为我的响应变量必须与我的意图相反,但我无法验证。
我的响应变量用 0 和 1 编码。
谢谢!
【问题讨论】:
标签: r logistic-regression lme4
我的问题很简单,但我无法在 R 手册或在线搜索中找到明确的答案。使用 glmer 进行逻辑回归时,是否有一种好方法可以验证您对响应变量的参考是什么?
我得到的结果始终与理论完全相反,我认为我的响应变量必须与我的意图相反,但我无法验证。
我的响应变量用 0 和 1 编码。
谢谢!
【问题讨论】:
标签: r logistic-regression lme4
您可以模拟一些您知道真实效果的数据...?simulate.merMod 使这相对容易。无论如何,
glmer 从glm 继承其框架。特别是,?family 指出:对于“二项式”和“准二项式”族,响应可以 可以通过以下三种方式之一指定:
1. As a factor: ‘success’ is interpreted as the factor not having the first level (and hence usually of having the second level). 2. As a numerical vector with values between ‘0’ and ‘1’, interpreted as the proportion of successful cases (with the total number of cases given by the ‘weights’). 3. As a two-column integer matrix: the first column gives the number of successes and the second the number of failures.
您的数据是#2 的(常见)特例(每种情况的“成功比例”为零或 100%,因为每次观察只有一个案例;权重向量是全为的向量默认)。
【讨论】: