Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

r - Checking linearity assumption for GLMM

I conducted a generalized linear mixed effects model using R. Now. I want to check if the linearity assumption of my model is violated. First, I tried to create a plot of the residuals using plot(fitted(glmm), residuals(glmm) which gave me this graph: binary residuals

I am a complete newbie at this, so it is difficult for me to interpret this, but it does not look like other plots where the linearity assumption is fulfilled. So I researched a bit further and found one website that said that

this residual plot does not provide information about the model form assumptions for a dichotomous response logistic model. Models are assumed to be linear in each of the independent variables. This assumption can be checked with plots of the residuals versus each of the variables.

It followed with a code that you should use:

ggplot(data.frame(x1=pbDat$x1,pearson=residuals(gmm,type="pearson")),
      aes(x=x1,y=pearson)) +
    geom_point() +
    theme_bw()

ggplot(data.frame(x2=pbDat$x2,pearson=residuals(gmm,type="pearson")),
      aes(x=x2,y=pearson)) +
    geom_point() +
    theme_bw()

Naturally, I tried to use it for my model:

ggplot(data.frame(x1=dfb.2$pers_force,pearson=residuals(glmm,type="pearson")),
       aes(x=x1,y=pearson)) +
  geom_point() +
  theme_bw()

but it returned the following error: "arguments imply differing number of rows: 592, 585" What am I doing wrong, and how can I fix it? Does this method even make sense at all?


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

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...