Re: [R] R^2 from lme function

From: Martin Henry H. Stevens <HStevens_at_muohio.edu>
Date: Mon, 14 May 2007 11:32:25 -0400

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:

> 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.
>
> ______________________________________________
> R-help_at_stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

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"



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 May 2007 - 15:39:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 May 2007 - 16:31:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.