Actually, the function residuals.gls calculates 3 different types of residuals: "response" or raw residuals, "pearson" or standardized residuals, and "normalized" residuals. For diagnostic purposes, you probably want the normalized residuals. The default is the "response" residuals (although the ?residuals.gls says that the pearson residuals are the default. This seems to be a bug in the help file). See ?residuals.gls

Also, it's better programming practice to use the extractor function (residuals.gls in this case), rather than using result$residuals directly, since the contents of slots can change on the whim of the developer, but the extractor function should, in general, return what you ask for.

Cheers,

Simon.

On 13/10/10 03:40, Liam J. Revell wrote:
Hi Jan:

Yes. gls() returns an object of class gls which contains a vector containing the residuals as one of its components.
So for instance you might compute:
> result<-gls(y~x,data=test.data,correlation=corPagel(phy=tree,value=1,fixed=FALSE))
in which case:
> result$residuals
contains the model residuals.
You can also get the residuals using the function resid(), i.e.:
> resid(result)

Residual standard error is:
> result$sigma
so residual sum of squares should just be:
> resid.SS<-n*result$sigma^2
for n species.

Hope this is helpful. - Liam

Liam J. Revell
NESCent, Duke University
web: http://anolis.oeb.harvard.edu/~liam/
NEW email: lrev...@nescent.org



Werner, Jan wrote:
Dear R-sig-phylo members,
for some analyses I used the gls and gnls functions (package "nlme") and controlled for phylogenetic effects by the phylogenetic correlation structure "corPagel" provided by the ape-package. My question is, is there a possibility to get the transformed residuals (phylogentic corrected
residuals) or the phylogenetic corrected residual sum of squares?

Many thanks for your efforts.

Best regards

Jan Werner

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

--
Simon Blomberg, BSc (Hons), PhD, MAppStat, AStat
Lecturer and Consultant Statistician
School of Biological Sciences
The University of Queensland
St. Lucia Queensland 4072
Australia
T: +61 7 3365 2506
email: S.Blomberg1_at_uq.edu.au
http://www.uq.edu.au/~uqsblomb/

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem

Statistics is the grammar of science - Karl Pearson.

_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to