0

I had originally asked this in an edit to a previous question, but I think that it deserves its own question.

I am running a glmer with a single dichotomous predictor (coded 1/0). The model also includes a random subject intercept, as well as a random item intercept and slope.

Changing which level of the predictor serves as the reference category doesn’t change the absolute value of the coefficient, EXCEPT when the random intercept and slope are uncorrelated.

This happens whether I keep the predictor as a numeric variable, or change the predictor into a factor and use the following code:

t1<-glmer(DV~IV+(1|PPT)+(0+dummy(IV, "1")|Item)+(1|Item), data = data, family = "binomial”)

Is this a genuine result? If so, can anyone explain why the uncorrelated random intercept and slope allow it to emerge? If not, how can I run a model that has an uncorrelated random intercept and slope that would prevent the choice of reference category from affecting the result?

Thank you very much!

Edit:

Here is some sample data.

I'm sorry I wasn't sure how to link to it with an r command, but a sample of csv data is here: https://pastebin.com/embed_js/X2h9yT4c

testdata<-read.csv("test.csv")
testdata$PPT<-as.factor(testdata$PPT)
testdata$BalancedIV<-as.factor(testdata$BalancedIV)
testdata$BalancedIVReversed<-as.factor(testdata$BalancedIVReversed)
testdata$BIV<-as.numeric(as.character(testdata$BalancedIV))
testdata$BIVR<-as.numeric(as.character(testdata$BalancedIVReversed))
testdata$UIV<-as.numeric(as.character(testdata$UnBalancedIV))
testdata$UIVR<-as.numeric(as.character(testdata$UnbalancedIVReversed))

These two models have the same predictor but with reverse coding (i.e., 1/0 the first time, and 0/1 the second time). You can see that their coefficients have different absolute values.

t19<-glmer(DV~BalancedIV+(1|PPT)+(0+dummy(BalancedIV, "1")|Item)+(1|Item), data = testdata, family = "binomial")
t20<-glmer(DV~BalancedIVReversed+(1|PPT)+(0+dummy(BalancedIVReversed, "1")|Item)+(1|Item), data = testdata, family = "binomial")

summary(t19)
summary(t20)
Dave
  • 111
  • 2
  • 11
  • 1
    This doesn't really appear to be a programming question. If you have a question about the behavior of statistical models, you should ask at [stats.se], not Stack Overflow. Questions here should include a proper [reproduicble example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample data. – MrFlick Sep 06 '17 at 18:21
  • I'm not sure if it's a statistical question (i.e., a genuine result of the predictors in the model) or a programming question (i.e, a quirk of R). That being said I'll add sample data. – Dave Sep 06 '17 at 18:56
  • The data you provided isn't particularly helpful because it's not complete. The `dput()` ends in "truncated" so it's invalid to copy/paste and we can't use the `read.csv` command because we don't have the file. – MrFlick Sep 06 '17 at 19:27
  • Okay I've fixed the linked data. – Dave Sep 07 '17 at 00:38

0 Answers0