[R] error while extracting the p-value from adf.test

Sarah Goslee sarah.goslee at gmail.com
Fri Mar 22 15:21:52 CET 2013


Hi,

When I look at ?adf.test I see:

A list with class
"htest"
containing the following components:
statistic  the value of the test statistic.
parameter  the lag order.
p.value    the p-value of the test.
method   a character string indicating what type of test was performed.
data.name   a character string giving the name of the data.
alternative   a character string describing the alternative hypothesis

So why don't you try
ht$p.value
instead, just as the help file tells you?

Sarah

On Fri, Mar 22, 2013 at 10:03 AM, Yuan, Rebecca
<rebecca.yuan at 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"?
>
> Thanks,
>
> Rebecca
>

--
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list