[R-sig-ME] Extracting p-values from an lme object (any help would be appreciated)

Robert Kushler kushler at oakland.edu
Wed Nov 25 20:47:39 CET 2009


I'm sorry, I must jump in here.  See responses to specific points below.

Regards,   Rob Kushler

Adam D. I. Kramer wrote:
> On Wed, 25 Nov 2009, Ben Bolker wrote:
>> Ben Zuckerberg wrote:
>>> I know that p-value estimation in mixed models are somewhat
>>> controversial at the moment, but I am simply curious how one extracts
>>> p-values for the fixed factors from an lme object (using nlme)? The
>>> summary() gives the desired p-values; all I want to do is access them.
>>> The names() command shows the returned values (e.g., fitted, residuals)
>>> for many components of the model, but I can't seem to access the
>>> p-values.  Thank you in advance!
>> library(nlme)
>> example(lme)
>> summary(fm1)$tTable[,"p-value"]
> Or perhaps more simply,

     It's true that calling "pt" is a simple way to *compute* the
     p-values, but the question was how to *extract* them.  In general
     the ability to manipulate objects is a key advantage of R.

> pt(t, df, lower.tail)
> gives you the p-value associated with a given t-value and its degrees of
> freedom. lower.tail is whether you want the p below the t-value (usually 
> you want this when p is negative), or above.

     I think you mean "when t is negative" - but that's still not correct.
     You want "lower=TRUE" when the alternative hypothesis Ha says "<" and
     "lower=FALSE" when Ha says ">", regardless of the sign of t.

> Multiply by 2 for a 2-tailed test.

     Actually you need "2*pt(-abs(t), df, lower=TRUE)" to ensure a
     correct two-sided p-value.

> summary() is almost certainly just calling pt().
> --Adam
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

More information about the R-sig-mixed-models mailing list