[R-sig-ME] GLMM linearity checking
Shujuan Feng
fengsj at mail.utexas.edu
Thu Jun 3 21:40:27 CEST 2010
Thanks Ben, it works.
Then I feel there may be problems with the model by looking at the residul
plots.
When I just plot the residuals, I get two big group values (the plots of
residual~predicotr are also like this). See the attach file: residaul.jpeg.
I have difficulty in imaging the residuals in GLM with the original
dependent are 0s or 1s. Residuals should be the difference between the
observed and the predicted. I can understand the predicted in terms of
transformed scale(logit), but I don't know how the observed 0s and 1s are
transformed. Are the two group residual values from the 0s and 1s
respectively? Have anyone see such residuals?
Thanks!
PS: In my model, I have three continuous predictors, the dependent are 0s or
1s and I use binomial(link = "logit"). I tried GLMM and also just GLM, I got
similar residual plots.
----- Original Message -----
From: "Ben Bolker" <bolker at ufl.edu>
To: "Shujuan Feng" <fengsj at mail.utexas.edu>
Cc: "R Mixed Models" <r-sig-mixed-models at r-project.org>
Sent: Thursday, June 03, 2010 1:37 PM
Subject: Re: [R-sig-ME] GLMM linearity checking
> [cc'ing back to r-sig-mixed]
>
> That was going to be my suggestion.
> Try omitting rows of the data set with NA predictors or responses
> (na.omit() will work if your data frame does not have *other* columns
> with NAs in them beyond those used in the model) before you start.
>
>
> Shujuan Feng wrote:
>> or maybe I can just delete the missing rows.
>>
>>
>> ----- Original Message -----
>> From: "Shujuan Feng" <fengsj at mail.utexas.edu>
>> To: "Ben Bolker" <bolker at ufl.edu>
>> Cc: <r-sig-mixed-models at r-project.org>
>> Sent: Thursday, June 03, 2010 12:10 PM
>> Subject: Re: [R-sig-ME] GLMM linearity checking
>>
>>
>>> Thanks so much!
>>>
>>> I read about Graphical checking for GLMM (transformed by the link
>>> Function) before fitting the model from a paper. I have difficulty in
>>> imaging how the 0s and 1s are transformed by the ink. .....
>>>
>>> I tried your suggestions and this way should give me more valuable
>>> checkings for the model. But because I have a lot of missing data, I
>>> could
>>> not put the residuals into the data. I got errors:
>>>
>>> Error in `$<-.data.frame`(`*tmp*`, "resid", value = c(-0.776415 :
>>> replacement has 13580 rows, data has 68158
>>>
>>> Is there any way to match residuals and the predictor?
>>>
>>> I tried just plot(model), but it doesn't work for GLMM.
>>>
>>>
>>>
>>> Thanks!!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Ben Bolker" <bolker at ufl.edu>
>>> To: <fengsj at mail.utexas.edu>
>>> Cc: <r-sig-mixed-models at r-project.org>
>>> Sent: Thursday, June 03, 2010 11:25 AM
>>> Subject: Re: [R-sig-ME] GLMM linearity checking
>>>
>>>
>>>> fengsj at mail.utexas.edu wrote:
>>>>> I am sorry for asking this question here. It is more related to
>>>>> logistic regression.
>>>>>
>>>>> I need to use GLMM (binomial(link = "logit")) )to fit my data. The
>>>>> dependent variable is 0 or 1 and I'd like to do some roughly
>>>>> graphical checkings for my data to see if the responses of
>>>>> transformaed data are linear with respect to continuous predictors in
>>>>> general. How should I do this?
>>>>>
>>>>> Thanks,
>>>>>
>>>> how about
>>>>
>>>> m <- glmer(...,data=d)
>>>> d$resid <- residuals(m)
>>>>
>>>> xyplot(resid~continuous_predictor_1,type=c("p","smooth"),data=d)
>>>>
>>>> ...
>>>>
>>>> Non-linearity on the transformed scale will appear as a (non-flat)
>>>> pattern of the (smoothed line fitted to the) residuals as a function of
>>>> the continuous predictors ...
>>>>
>>>> Ben Bolker
>>> _______________________________________________
>>> R-sig-mixed-models at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>
>
>
> --
> Ben Bolker
> Associate professor, Biology Dep't, Univ. of Florida
> *** NEW E-MAIL ADDRESSES:
> *** bbolker at gmail.com , bolker at math.mcmaster.ca
> bolker at ufl.edu / people.biology.ufl.edu/bolker
> GPG key: people.biology.ufl.edu/bolker/benbolker-publickey.asc
More information about the R-sig-mixed-models
mailing list