Ben - 6 months ago 32

R Question

I don't understand results of

`ar()`

I made up a very simple case, Fibonacci sequence:

`x <- c(1,1,2,3,5,8,13,21,34,55)`

ar(x)

result is

`Coefficients:`

1

0.5531

I would expect result of 1,1 - for the model

`x(n) = 1* x(n-1) + 1 * x(n-2)`

Can anyone explain me please why I don't get expected result?

Answer

You may use `ar.ols`

to estimate this non-stationary series.

From the docs,

ar.ols fits the general AR model to a possibly non-stationary and/or multivariate system of series x.

Example with your data:

```
ar.ols(x,demean=FALSE)
Call:
ar.ols(x = x, demean = FALSE)
Coefficients:
1 2
1 1
```