[R] How to get the p-value from lmer on a longitudinal analysis

Ronaldo Reis Junior chrysopa at gmail.com
Fri Aug 1 19:31:03 CEST 2008


Em Sex 01 Ago 2008, Marc Schwartz escreveu:
> on 08/01/2008 10:11 AM Ronaldo Reis Junior wrote:
> > Hi,
> >
> > I have a modelo like this:
> >
> > Yvar <- c(0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1, 2, 3, 6, 6, 3, 3, 4)
> > TIME <- 4:22
> > ID <- rep("PlotA",19)
> > m <- lmer(Yvar~TIME+(TIME|ID),family=poisson)
> > anova(m)
> > summary(m)
> >
> > How to get the p-value for this case?
> >
> > Thanks
> > Ronaldo
>
> Unless something has changed recently:
>
> http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-p_002dvalues-not-displ
>ayed-when-using-lmer_0028_0029_003f
>
> HTH,
>
> Marc Schwartz

Hi Marc,

thanks for the link. I knowed about this discussion, but I can't use the 
solution for this example.

Look:

> Yvar <- c(0, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 1, 2, 3, 6, 6, 3, 3, 4)
> TIME <- 4:22
> ID <- rep("PlotA",19)
> m <- lmer(Yvar~TIME+(TIME|ID),family=poisson)
> anova(m)
Analysis of Variance Table
     Df Sum Sq Mean Sq
TIME  1 21.674  21.674
> m2 <- update(m,.~.-TIME)
> anova(m,m2)
Data: 
Models:
m2: Yvar ~ (TIME | ID)
m: Yvar ~ TIME + (TIME | ID)
   Df     AIC     BIC  logLik Chisq Chi Df Pr(>Chisq)
m2  4                                                
m   5 23.8628 28.5850 -6.9314            1           
> # From the net
> # And an emperical p-value using a function supplied by Douglas Bates
> # to the R-help mailing list is another possibility:
> mcmcpvalue <- function(samp)
+ {
+   ## elementary version that creates an empirical p-value for the
+   ## hypothesis that the columns of samp have mean zero versus a
+   ## general multivariate distribution with elliptical contours.
+   ## differences from the mean standardized by the observed
+   ## variance-covariance factor
+   std <- backsolve(chol(var(samp)),
+                    cbind(0, t(samp)) - colMeans(samp),
+                    transpose = TRUE)
+   sqdist <- colSums(std * std)
+   sum(sqdist[-1] > sqdist[1])/nrow(samp)
+ }
> 
> # Required package to perform mcmc-sampling:
> require(coda)
> 
> # Perform sampling - NOTE: it takes a minute or two!:
> set.seed(12321) # To make the random numbers repeatable
> m3 <- mcmcsamp(m, 10000) # generate sample
Erro: inconsistent degrees of freedom and dimension
Erro em t(.Call(glmer_MCMCsamp, GSpt, saveb, n, trans, verbose, deviance)) : 
  error in evaluating the argument 'x' in selecting a method for function 't'

What is wrong?

Thanks
Ronaldo
-- 
Also, the Scots are said to have invented golf.  Then they had
to invent Scotch whiskey to take away the pain and frustration.
--
> Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8187 | ronaldo.reis em unimontes.br | chrysopa em gmail.com
| http://www.ppgcb.unimontes.br/lbc | ICQ#: 5692561 | LinuxUser#: 205366
--
Favor NÃO ENVIAR arquivos do Word ou Powerpoint
Prefira enviar em PDF, Texto, OpenOffice (ODF), HTML, or RTF.



More information about the R-help mailing list