0

I'm trying to extract a parameter from a model fit by ML which has a correlation structure obtained from corPagel (defined in package ape). The parameter of interest is within the element named apVar in the summary.

library(ape); library(nlme)
cor_lambdaML <- corPagel( 1, avestree, fixed=FALSE )
m <- gls(AUTUMN ~ GREGARIOUSNESS + SEASON + TARSUS + MATURATION + SPRING + MIGRATION + DICHROMATISM + HABITAT + POSTJUVENILE + CONSPICUOUSNESS, correlation = cor_lambdaML, data = avesdata, method = 'ML' )
names(m)
m$apVar

This code produces the following output (please, download a dput with model m here):

           corStruct     lSigma
corStruct 0.03848807 0.03090663
lSigma    0.03090663 0.04403168
attr(,"Pars")
  corStruct      lSigma 
0.858126838 0.008131981 
attr(,"natural")
[1] TRUE

Extracting values of the first matrix is trivial, but how can I extract the value of corStruct within the element attr(, "Pars")?

4

1 回答 1

0

不确定您需要挖掘多远,但m$Pars$corStruct数据存储在哪里。也就是说: m是一个list有很多组件的,其中一个是Pars。那本身就是一个list,带有一个组件corStruct

?glsObject将使您开始了解所有列表元素的详细信息。

于 2014-02-03T15:17:40.743 回答