On Fri, Mar 22, 2013 at 2:03 PM, Yuan, Rebecca <rebecca.y...@bankofamerica.com> wrote: > Hello all, > > I tried to extract the p-value from adf.test in tseries; however, I got the > error message such as > >> ht=adf.test(list.var$aa) >> ht$p-value > Error in ht$p - value : non-numeric argument to binary operator >> ht > > Augmented Dickey-Fuller Test > > data: list.var$aa > Dickey-Fuller = -2.3147, Lag order = 4, p-value = 0.4461 > alternative hypothesis: stationary > >> ht$data > [1] "list.var$aa" >> ht$p-value > Error in ht$p - value : non-numeric argument to binary operator >> ht$p > NULL > > I do not have problem extracting the data in ht, but why not p-value? Is that > because the "-" between "p" and "value"?
Basically yes: x$p-value parses as x[["p", exact = FALSE]] - value instead of x[["p-value", exact = FALSE]] because `p-value` is not a syntactic name. I think a more common name for R would be p.value which is perfectly fine. MW > > Thanks, > > Rebecca > > > > > ---------------------------------------------------------------------- > This message, and any attachments, is for the intended r...{{dropped:5}} > > ______________________________________________ > R-help@r-project.org 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. ______________________________________________ R-help@r-project.org 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.