Skip to content

Extracting p-values from an lme object (any help would be appreciated)

4 messages · Ben Zuckerberg, Ben Bolker, Adam D. I. Kramer +1 more

#
Greetings,

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!
#
Ben Zuckerberg wrote:
library(nlme)
example(lme)
summary(fm1)$tTable[,"p-value"]
#
On Wed, 25 Nov 2009, Ben Bolker wrote:

            
Or perhaps more simply,

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. Multiply by 2 for a 2-tailed test.

summary() is almost certainly just calling pt().

--Adam
#
Adam,

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

Regards,   Rob Kushler
Adam D. I. Kramer wrote:
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.
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.
Actually you need "2*pt(-abs(t), df, lower=TRUE)" to ensure a
     correct two-sided p-value.