# [R] Fitting AR(p) model

Pascal Oettli kridox at ymail.com
Wed May 8 09:57:28 CEST 2013

```Hello,

You forgot the column names. The output is:

Length Class  Mode
order       1     -none- numeric
ar           0     -none- numeric
var.pred    1     -none- numeric
x.mean      1     -none- numeric
aic        13     -none- numeric
n.used      1     -none- numeric
order.max   1     -none- numeric
partialacf 12     -none- numeric
resid      17     -none- numeric
method      1     -none- character
series      1     -none- character
frequency   1     -none- numeric
call        2     -none- call

So the "1" for "order" is referring to the _length_ of "order", not to
the _value_ of "order".

Hope this helps,
Pascal

On 05/08/2013 04:49 PM, Preetam Pal wrote:
> Hi all,
>
> I am trying to fit an AR(p) model to my variable res
>
> ar=ar(res, method="yule-walker")
>
> The output is :
>
> Order selected 0  sigma^2 estimated as  5.87e-06
>
> Does this mean that the optimum value of p is 0?
>
> But when I go for  summary(ar),
>
> I get the following:
>
> order       1     -none- numeric
> ar           0     -none- numeric
> var.pred    1     -none- numeric
> x.mean      1     -none- numeric
> aic        13     -none- numeric
> n.used      1     -none- numeric
> order.max   1     -none- numeric
> partialacf 12     -none- numeric
> resid      17     -none- numeric
> method      1     -none- character
> series      1     -none- character
> frequency   1     -none- numeric
> call        2     -none- call
>
>
> The confusion is : in the 1st line, order=1 is being shown, and ar is being
> shown as 0 in the 2nd line.
> This means that the variable res is AR with order 1 , but coefficient of
> the lag variable is 0. I am confused!
> In this context, how do I interpret the initial output  which said "order
> selected 0".
>
>
>
> Any help is appreciated.
>
>
> Thanks,
> Preetam
>
>
>
>
>
>
>

```