[R] anova applied to a lme object

2007-03-07 Thread Berta
Hi R-users,

when carrying out a multiple regression, say lm(y~x1+x2), we can use an 
anova of the regression with summary.aov(lm(y~x1+x2)), and afterwards 
evaluate the relative contribution of each variable using the global Sum of 
Sq of the regression and the Sum of Sq of the simple regression y~x1.

Now I would like to incorporate a random effect in the model, as some data 
correspond to the same region and others not:  mylme- lme(y~x1+x2, random= 
~1|as.factor(region)). I would like to know, if possible, which is the 
contribution of each variable to the global variability. Using anova(mylme) 
produce an anova table (without the Sum of Sq column), but I am not sure how 
can I derive the contribution of each variable from it, or even whether it 
is nonsense to try, nor can I derive a measure of how much variability is 
left unexplained.

Sorry for the type of question, but I did not find a simple solution and 
some researchers I work with love to have relative contributions to global 
variability.

Thanks a lot in advance,

Berta





__
R-help@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.


Re: [R] anova applied to a lme object

2007-03-07 Thread José Rafael Ferrer Paris
The variances of the random effects and the residual variances are given
by the summary function. Maybe VarCorr or varcomp gives you the answer
you are looking for:

library(nlme)
library(ape)
?VarCorr
?ape

JR
El mié, 07-03-2007 a las 13:09 +0100, Berta escribió:
 Hi R-users,
 
 when carrying out a multiple regression, say lm(y~x1+x2), we can use an 
 anova of the regression with summary.aov(lm(y~x1+x2)), and afterwards 
 evaluate the relative contribution of each variable using the global Sum of 
 Sq of the regression and the Sum of Sq of the simple regression y~x1.
 
 Now I would like to incorporate a random effect in the model, as some data 
 correspond to the same region and others not:  mylme- lme(y~x1+x2, random= 
 ~1|as.factor(region)). I would like to know, if possible, which is the 
 contribution of each variable to the global variability. Using anova(mylme) 
 produce an anova table (without the Sum of Sq column), but I am not sure how 
 can I derive the contribution of each variable from it, or even whether it 
 is nonsense to try, nor can I derive a measure of how much variability is 
 left unexplained.
 
 Sorry for the type of question, but I did not find a simple solution and 
 some researchers I work with love to have relative contributions to global 
 variability.
 
 Thanks a lot in advance,
 
 Berta
 
 
 
 
 
 __
 R-help@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.
-- 
Dipl.-Biol. JR Ferrer Paris
~~~
Laboratorio de Biología de Organismos --- Centro de Ecología
Instituto Venezolano de Investigaciones Científicas (IVIC) 
Apdo. 21827, Caracas 1020-A 
República Bolivariana de Venezuela

Tel: (+58-212) 504-1452
Fax: (+58-212) 504-1088

email: [EMAIL PROTECTED]
clave-gpg: 2C260A95

__
R-help@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.


Re: [R] anova applied to a lme object

2007-03-07 Thread Berta
Thanks José Rafael, I will try with library(ape) (at the moment I cannot 
load it).

VarCorr gives  the variance estimates for the random effect and the error 
terms. However, what I am looking for is a measure of the explained 
proportion of variance, such as it is R2 in regression models, and more 
precisely, I am looking for a measure of the explained proprotion of 
variance of each of the variables considered (continuous variables and other 
with random slope). For example, Snijders and Bosker (2003) pg 102 dedicate 
a chapter in their book to  how much does the multilevel model explain 
(chapter 7) and derive formulaes for R_1 and R_2  (variance in the first and 
second level respectively). Things seem to get complicated when a slope 
random effect is included in the model, as in my case.  It seems that 
package HLM provides the necessary estimates.

I will have a look at library(ape), thanks for the suggestion.

The book I mention is: Snijders, TAB and Bosker RJ (2003). Multilevel 
Analysis. An introduction to basic and advanced multilevel modeling. SAGE, 
London.

Berta




- Original Message - 
From: José Rafael Ferrer Paris [EMAIL PROTECTED]
To: Berta [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Wednesday, March 07, 2007 5:16 PM
Subject: Re: [R] anova applied to a lme object


 The variances of the random effects and the residual variances are given
 by the summary function. Maybe VarCorr or varcomp gives you the answer
 you are looking for:

 library(nlme)
 library(ape)
 ?VarCorr
 ?ape

 JR
 El mié, 07-03-2007 a las 13:09 +0100, Berta escribió:
 Hi R-users,

 when carrying out a multiple regression, say lm(y~x1+x2), we can use an
 anova of the regression with summary.aov(lm(y~x1+x2)), and afterwards
 evaluate the relative contribution of each variable using the global Sum 
 of
 Sq of the regression and the Sum of Sq of the simple regression y~x1.

 Now I would like to incorporate a random effect in the model, as some 
 data
 correspond to the same region and others not:  mylme- lme(y~x1+x2, 
 random=
 ~1|as.factor(region)). I would like to know, if possible, which is the
 contribution of each variable to the global variability. Using 
 anova(mylme)
 produce an anova table (without the Sum of Sq column), but I am not sure 
 how
 can I derive the contribution of each variable from it, or even whether 
 it
 is nonsense to try, nor can I derive a measure of how much variability is
 left unexplained.

 Sorry for the type of question, but I did not find a simple solution and
 some researchers I work with love to have relative contributions to 
 global
 variability.

 Thanks a lot in advance,

 Berta



 

 __
 R-help@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.
 -- 
 Dipl.-Biol. JR Ferrer Paris
 ~~~
 Laboratorio de Biología de Organismos --- Centro de Ecología
 Instituto Venezolano de Investigaciones Científicas (IVIC)
 Apdo. 21827, Caracas 1020-A
 República Bolivariana de Venezuela

 Tel: (+58-212) 504-1452
 Fax: (+58-212) 504-1088

 email: [EMAIL PROTECTED]
 clave-gpg: 2C260A95



 ___
 Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de





__
R-help@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.