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

Yuan, Rebecca rebecca.yuan at bankofamerica.com
Fri Mar 22 15:27:55 CET 2013


Hello Sarah,

Thanks! I will look into help next time before sending out the question.

Thanks,

Rebecca


-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com] 
Sent: Friday, March 22, 2013 10:22 AM
To: Yuan, Rebecca
Cc: R help
Subject: Re: [R] error while extracting the p-value from adf.test

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

----------------------------------------------------------------------
This message, and any attachments, is for the intended r...{{dropped:2}}



More information about the R-help mailing list