[R] for help about logistic regression model
Douglas Bates
bates at stat.wisc.edu
Tue Nov 21 19:45:52 CET 2006
On 11/21/06, Aimin Yan <aiminy at iastate.edu> wrote:
> thanks, Here is data under this link with file name as p_5_angle.csv
> http://www.public.iastate.edu/~aiminy/data/
> p is protein names(5 proteins)
> aa are nested in p(up to 19 levels for each p, some p doesn't have 19 levels)
> index is position of aa.
> there are only one observation for each position of each aa within p.
>
> consider p as random effect,
> since aa is nested in p, so aa is also random effect.
>
> p and aa are qualitative predictors.
> x,y,z,sdx,sdy,sdz,delta,as,ms,cur are quantitative predictors.
> sc is binary responsible variable(>=90 and <90)
>
> we want to know the effect of p,aa,x,y,z,sdx,sdy,sdz,delta,as,ms,cur) on
> P(sc>=90).
>
> So I consider to use logistic regression model with p and aa as random effect.
>
> Firstly I try to use p,aa,x,y,z,sdx,sdy,sdz,delta,as,ms,cur as predictors,
> but it seems it has too many predictors.
> so I use p,aa,as,ms,cur as predictors, but it still doesn't work.
Here are the fits for two of your models using lmer.
> library(lme4)
Loading required package: Matrix
Loading required package: lattice
> p5 <- read.csv("http://www.public.iastate.edu/~aiminy/data/p_5_angle.csv")
> p5$Y <- p5$sc >= 90
> (mp5.NULL <- lmer(Y ~ 1|p/aa, p5, binomial, control = list(usePQL = FALSE)))
Generalized linear mixed model fit using Laplace
Formula: Y ~ 1 | p/aa
Data: p5
Family: binomial(logit link)
AIC BIC logLik deviance
1390 1405 -692 1384
Random effects:
Groups Name Variance Std.Dev.
aa:p (Intercept) 0.447654 0.66907
p (Intercept) 0.015078 0.12279
number of obs: 1030, groups: aa:p, 92; p, 5
Estimated scale (compare to 1 ) 0.9736361
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.1325 0.1151 -1.151 0.25
> (mp5.full <- lmer(Y ~ as*ms*cur + (1|p/aa), p5, binomial, control = list(usePQL = FALSE)))
Generalized linear mixed model fit using Laplace
Formula: Y ~ as * ms * cur + (1 | p/aa)
Data: p5
Family: binomial(logit link)
AIC BIC logLik deviance
1278 1327 -628.8 1258
Random effects:
Groups Name Variance Std.Dev.
aa:p (Intercept) 0.085104 0.29173
p (Intercept) 0.026769 0.16361
number of obs: 1030, groups: aa:p, 92; p, 5
Estimated scale (compare to 1 ) 0.9833564
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 5.506e-01 1.714e-01 3.213 0.00131 **
as -3.964e-02 2.322e-02 -1.707 0.08778 .
ms 1.879e-02 2.149e-02 0.874 0.38206
cur 3.413e-01 6.706e-01 0.509 0.61078
as:ms 1.091e-04 7.615e-05 1.432 0.15201
as:cur 8.315e-02 7.069e-02 1.176 0.23951
ms:cur -4.880e-02 5.372e-02 -0.908 0.36366
as:ms:cur -3.998e-04 6.602e-04 -0.606 0.54476
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Correlation of Fixed Effects:
(Intr) as ms cur as:ms as:cur ms:cur
as -0.028
ms -0.144 -0.960
cur -0.391 0.070 0.019
as:ms 0.290 -0.655 0.443 -0.155
as:cur -0.094 0.401 -0.288 0.211 -0.530
ms:cur 0.118 0.601 -0.672 -0.473 -0.185 -0.263
as:ms:cur 0.110 -0.354 0.232 0.001 0.614 -0.874 0.036
>
More information about the R-help
mailing list