Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
985 views
in Technique[技术] by (71.8m points)

r - Using glmer for logistic regression, how to verify response reference

My question is quite simple, but I've been unable to find a clear answer in either R manuals or online searching. Is there a good way to verify what your reference is for the response variable when doing a logistic regression with glmer?

I am getting results that consistently run the exact opposite of theory and I think my response variable must be reversed from my intention, but I have been unable to verify.

My response variable is coded in 0's and 1's.

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could simulate some data where you know the true effects ... ?simulate.merMod makes this relatively easy. In any case,

  • the effects are interpreted in terms of their effect on the log-odds of a response of 1
  • e.g., a slope of 0.5 implies that a 1-unit increase in the predictor variable increases the log-odds of observing a 1 rather than a 0 by 0.5.
  • for questions of this sort, glmer inherits its framework from glm. In particular, ?family states:

For the ‘binomial’ and ‘quasibinomial’ families the response can be specified in one of three ways:

   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.

Your data are a (common) special case of #2 (the "proportion of successes" is either zero or 100% for each case, because there is only one case per observation; the weights vector is a vector of all ones by default).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...