0

I am running a PGLS loop on 1,000 trees and I am trying to extract slope, standard error, and P-values from my loop. Slope and standard error are easily extracted by using data$model$coef[2] and data$sterr[2] but the p value just does not want to come out. I have tried

1)summary(result)$pvalue which gives value NULL

2)data$model$coef[2,4] which says this is out of bounds (in fact playing around I couldn't access anything outside of the first column of coefficients without receiving the same error message)

I have tried a slew of other methods that are more or less the same idea as these two and each time I either get the dreaded NULL, the occasional NA or the out of bounds error. Does anyone know what is going on? I know we typically provide the data but this seems like a menial question (although I have spent significantly more time trying to resolve this that in my actual PGLS).

nrussell
  • 18,382
  • 4
  • 47
  • 60
  • 2
    it is useful to see what's in an object before trying to extract it. suppose `sr <- summary(result)` then sr$pvalue can only work (ie. give you something else than NULL) if you see "pvalue" in `names(sr)`. or see `str(sr)`. What you want may be named "p.value" instead of "pvalue" - or it may be calculated by `print` method. (To see how, you first need to determine the class of your summary object. See `class(sr)`. Suppose it is something like `summary.pgls` -- then the function called `print.summary.pgls` is what you need (i.e take a look at its source code 2C how p is calculated ). – lebatsnok Aug 29 '14 at 22:03

1 Answers1

2

I do not think it is possible directly See this (old) question. Perhaps the easiest way is to use the summary object to extract the necessary information to calculate it yourself (via a helper function)?

See this also,

Community
  • 1
  • 1
Rusan Kax
  • 1,894
  • 2
  • 13
  • 17