An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20081207/b2aba7af/attachment.pl>
Questions on the results from glmmPQL(MASS)
8 messages · Ken Beath, zhijie zhang, David Duffy
On 07/12/2008, at 12:34 PM, zhijie zhang wrote:
Dear Rusers, Sorry for re-post my question in this list. Some person has recommend that this list is more specific for me. I have used R,S-PLUS and SAS to analyze the sample data "bacteria" in MASS package. Their results are listed below. I have three questions, anybody can give me possible answers? Q1:From the results, we see that R get 'NAs'for AIC,BIC and logLik, while S-PLUS8.0 gave the exact values for them. Why? I had thought that R should give the same results as SPLUS here.
PQL is not maximum likelihood (it is an approximation which uses lme internally and this is what generates the results) so the results should be NA. The R and S-Plus versions have obviously diverged. SAS nlmixed uses maximum likelihood so a log likelihood is available.
Q2: The model to analyse the data is logity=b0+u+b1*trt
+b2*I(week>2), but
the results for Random effects in R/SPLUS confused me. SAS may be
clearer.
Random effects:
Formula: ~1 | ID
(Intercept) Residual
StdDev: 1.410637 0.7800511
Which is the random effect 'sigma'? I think it is "1.410637", but
what
does "0.7800511" mean? That is, i want ot know how to explain/use
the above
two data for Random effects.
I wonder if in PQL these have any real meaning, as they are obtained from the linear mixed effects step. Try using lmer in the lme4 package.
Q3:In SAS and other softwares, we can get p-values for the random effect 'sigma', but i donot see the p-values in the results of R/SPLUS. I have used attributes() to look for them, but no p values. Anybody knows how to get p-values for the random effect 'sigma',.
The standard answer is of the form "Just because SAS has it, doesn't mean it is a good idea". There was a recent discussion on this list about significance of random effects. Ken
Any suggestions or help are greatly appreciated.
#R Results:MASS' version 7.2-44; R version 2.7.2
library(MASS)
summary(glmmPQL(y ~ trt + I(week > 2), random = ~ 1 | ID,family =
binomial,
data = bacteria))
Linear mixed-effects model fit by maximum likelihood
Data: bacteria
AIC BIC logLik
NA NA NA
Random effects:
Formula: ~1 | ID
(Intercept) Residual
StdDev: 1.410637 0.7800511
Variance function:
Structure: fixed weights
Formula: ~invwt
Fixed effects: y ~ trt + I(week > 2)
Value Std.Error DF t-value
p-value
(Intercept) 3.412014 0.5185033 169 6.580506 0.0000
trtdrug -1.247355 0.6440635 47 -1.936696 0.0588
trtdrug+ -0.754327 0.6453978 47 -1.168779 0.2484
I(week > 2)TRUE -1.607257 0.3583379 169 -4.485311 0.0000
Correlation:
(Intr) trtdrg trtdr+
trtdrug -0.598
trtdrug+ -0.571 0.460
I(week > 2)TRUE -0.537 0.047 -0.001
#S-PLUS8.0: The results are the same as R except the followings:
AIC BIC logLik
1113.622 1133.984 -550.8111
#SAS9.1.3
proc nlmixed data=b;
parms b0=-1 b1=1 b2=1 sigma=0.4;
yy=b0+u+b1*trt+b2*week;
p=1/(1+exp(-yy));
Model response~binary(p);
Random u~normal(0,sigma) subject=id;
Run;
-2 Log Likelihood = 192.2
AIC (smaller is better)=200.2
AICC (smaller is better) =200.3
BIC (smaller is better)= 207.8
Parameter Estimates
Standard
Parameter Estimate Error DF t Value Pr > |t| Alpha
Lower Upper Gradient
b0 3.4966 0.6512 49 5.37 <.0001 0.05
2.1880 4.8052 -4.69E-6
trt -0.6763 0.3352 49 -2.02 0.0491 0.05
-1.3500 -0.00266 -0.00001
I(week>2) -1.6132 0.4785 49 -3.37 0.0015 0.05
-2.5747
-0.6516 -9.35E-7
sigma 1.5301 0.9632 49 1.59 0.1186 0.05
-0.4054 3.4656 -2.42E-6
--
With Kind Regards,
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[***********************************************************************]
ZhiJie Zhang ,PhD
Dept.of Epidemiology, School of Public Health,Fudan University
Office:Room 443, Building 8
Office Tel./Fax.:+86-21-54237410
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:epistat at gmail.com <Email%3Aepistat at gmail.com>
Website: www.statABC.com
[***********************************************************************]
oooO:::::::::
(..):::::::::
:\.(:::Oooo::
::\_)::(..)::
:::::::)./:::
::::::(_/::::
:::::::::::::
[[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
1 day later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20081208/1e635209/attachment.pl>
On Sun, 7 Dec 2008, zhijie zhang wrote:
Dear Rusers, Sorry for re-post my question in this list. Some person has recommend that this list is more specific for me. I have used R,S-PLUS and SAS to analyze the sample data "bacteria" in MASS package. Their results are listed below. Q3:In SAS and other softwares, we can get p-values for the random effect 'sigma', but i donot see the p-values in the results of R/SPLUS. I have used attributes() to look for them, but no p values. Anybody knows how to get p-values for the random effect 'sigma',.
Someone answered your specific questions before.
Because this is a simple random intercept model, you can also use the
glmmML R package, which gives:
glmmML(y ~ trt + I(week > 2), cluster=ID, family=binomial, data=bacteria)
coef se(coef) z Pr(>|z|)
(Intercept) 3.5482 0.6933 5.118 3.09e-07
trtdrug -1.3667 0.6768 -2.020 4.34e-02
trtdrug+ -0.7826 0.6830 -1.146 2.52e-01
I(week > 2)TRUE -1.5986 0.4754 -3.363 7.71e-04
Standard deviation in mixing distribution: 1.242
Std. Error: 0.4024
Residual deviance: 192.3 on 215 degrees of freedom AIC: 202.3
You can then construct a test for the random effect.
| David Duffy (MBBS PhD) ,-_|\ | email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20081208/0a05c33e/attachment.pl>
On Mon, 8 Dec 2008, zhijie zhang wrote:
Do u mean the following method?
model0<-glmmML(y ~ trt + I(week > 2), cluster=ID, family=binomial,
data=bacteria)
model1<-glm(y ~ trt + I(week > 2), family=binomial, data=bacteria) anova(model0,model1)
Error message occurred.
anova does not have a method for glmmML, but the deviances seem to be calculated the same (see model0$cluster.null.deviance etc):. model0 Residual deviance: 192.3 on 215 degrees of freedom AIC: 202.3 model1 Residual deviance: 199.18 on 216 degrees of freedom LRTS = 6.88. We will assume that the test statistic is distributed 1/2 X2(0) and 1/2 X2(1), so P ~ 0.004. Comparing to a Wald test using the SE on the random effect SD, I get: Z = 1.242/0.4024 = 3.08, P=0.001
| David Duffy (MBBS PhD) ,-_|\ | email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20081208/b5734632/attachment.pl>
On 08/12/2008, at 6:42 PM, zhijie zhang wrote:
On Mon, Dec 8, 2008 at 3:29 PM, David Duffy <David.Duffy at qimr.edu.au> wrote:
On Mon, 8 Dec 2008, zhijie zhang wrote:
Do u mean the following method?
model0<-glmmML(y ~ trt + I(week > 2), cluster=ID, family=binomial,
data=bacteria)
model1<-glm(y ~ trt + I(week > 2), family=binomial, data=bacteria) anova(model0,model1)
Error message occurred.
anova does not have a method for glmmML, but the deviances seem to be calculated the same (see model0$cluster.null.deviance etc):. model0 Residual deviance: 192.3 on 215 degrees of freedom AIC: 202.3 model1 Residual deviance: 199.18 on 216 degrees of freedom
LRTS = 6.88. We will assume that the test statistic is distributed 1/2 X2(0) and 1/2 X2(1), so P ~ 0.004.
1/2 X2(0) and 1/2 X2(1): ?? what do they mean?
X2 is chi-square. Because the test is on the boundary the test statistic is distributed as the weighted sum of chi-square rather than the usual chi-square. Verbeke and Molenberghs cover this in their books. Simulation (parametric bootstrap) seems a better way of doing this. Information criteria (AIC or BIC) can also be used. Most usual justification for a random effect is that there is expected to be one, so provided it can be estimated it is included.
Comparing to a Wald test using the SE on the random effect SD, I get: Z = 1.242/0.4024 = 3.08, P=0.001
Is this a "clerical error"? Based on your hints, it seems that p should be 0.003475077 .
dnorm(3.08)
[1] 0.003475077 Thanks.
P value for z test is 2*dnorm(3.08) which is close enough to 0.001 given that the test is only an approximation. Ken
-- | David Duffy (MBBS PhD) ,- _|\ | email: davidD at qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
-- With Kind Regards, oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [***********************************************************************] ZhiJie Zhang ,PhD Dept.of Epidemiology, School of Public Health,Fudan University Office:Room 443, Building 8 Office Tel./Fax.:+86-21-54237410 Address:No. 138 Yi Xue Yuan Road,Shanghai,China Postcode:200032 Email:epistat at gmail.com <Email%3Aepistat at gmail.com> Website: www.statABC.com [***********************************************************************] oooO::::::::: (..)::::::::: :\.(:::Oooo:: ::\_)::(..):: :::::::)./::: ::::::(_/:::: ::::::::::::: [[alternative HTML version deleted]]
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models