Skip to content
Prev 168824 / 398503 Next

Extracting Coefficients and Such from mle2 Output

As Ben Bolker's reply hints, our difficulty was that because we were  
insufficiently knowledgeable regarding working with S4 objects such  
as  "a" and summary(a) object. Both mle2 and summary(a) produce S4  
objects which need a different set of extraction technology. Although  
I did not know it last night, I have now looked at the help page for  
"slot", followed the link to the help page for "@" labeled "slotOp",   
and found that one can use "@" in much the same way one uses "$".

 > str(summary(a))
#Formal class 'summary.mle2' [package "bbmle"] with 3 slots
   ..@ call  : language mle2(minuslogl = LL, fixed = list(xhalf = 6))
   ..@ coef  : num [1, 1:4] 1.93e+01 1.71 1.13e+01 1.86e-29
   .. ..- attr(*, "dimnames")=List of 2
   .. .. ..$ : chr "ymax"
   .. .. ..$ : chr [1:4] "Estimate" "Std. Error" "z value" "Pr(z)"
   ..@ m2logL: num 60.4

# So ....coef in this case is a 1 by 4 matrix and ...

summary(a)@coef["ymax","Std. Error"]

#yields
#[1] 1.711541

So we still have access to any of the components of an S4 object such  
as a or summary(a), if we follow the trail of their respective  
structures