Skip to content

R^2 from lme function

5 messages · Cleber N.Borges, Martin Henry H. Stevens, Douglas Bates

#
Hello allR


How to access R^2 from lme object?
or how to calculate it?

( one detail: my model do not have a intercept )


thanks in advanced

Cleber

	

	
		
_______________________________________________________ 

Experimente j? e veja as novidades.
#
Hi Cleber,
I have been using this function I wrote for lmer output. It should be  
easy to convert to lme. As with everything, buyer beware. Note that  
it requires (full) maximum likelihood estimates.


Rsq <- function(reml.mod) {
  ## Based on
   ## N. J. D. Nagelkerke. A note on a general definition
   ## of the coefficient of determination. Biometrika, 78:691?692, 1991.
   ml.mod <- update(reml.mod, method="ML")
   l.B <- logLik(ml.mod)
   l.0 <- logLik( lm(ml.mod at y ~ 1) )
   Rsq <- 1 - exp( - ( 2/length(ml.mod at y) ) * (l.B - l.0) )
Rsq[1]
}

Hank
On May 14, 2007, at 10:50 AM, Cleber Borges wrote:

            
Dr. Hank Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

"E Pluribus Unum"
#
Hi Martin,

many thanks for your tip!

but,                                        { :-(   }
what it 'full MLE' ?   how to calculate? it is a saturated model???

and

it is valid for 'no-intercept model?


Many thanks again...

Cleber
_______________________________________________________ 

Experimente j? e veja as novidades.
#
Hi Cleber,
By "full" I simply meant "not REML." the function assumes that the  
fixed effects were estimated using REML criteria, and using update()  
simply changes that to ML. If the model was fit originally with ML,  
it shouldn't make any difference.

I am reasonably sure that it should not matter whether there is an  
intercept. ML estimates are invariant to fixed effects structure,  
whereas REML depends upon it.

Cheers,
Hank
On May 14, 2007, at 11:55 AM, Cleber Borges wrote:

            
Dr. Hank Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

"E Pluribus Unum"
#
On 5/14/07, Martin Henry H. Stevens <HStevens at muohio.edu> wrote:
I think the issue with presence or absence of an intercept is in how
it affects the choice of the null model.  Your function always uses y
~ 1 as the null model and that may not be appropriate if there is no
intercept term in the original model.