# [R] How to extract vectors from an arima() object and into a data frame?

zerfetzen zerfetzen at yahoo.com
Fri Apr 18 02:12:47 CEST 2008

This has been solved, and I'm thankful for the help.  The solution is:

z = MyModel\$coef/diag(MyModel\$var.coef)

...and from there I will use a for loop and pnorm to get the p-values.
Thanks again!

Byron

zerfetzen wrote:
>
> This should be very easy, but alas, I'm very new to R.  My end goal is to
> calculate p-values from arima().
>
> Let's say I just ran this:
>
>> MyModel <- arima(y[1:58], order=c(1,0,0), xreg=MyData[1:58,7:14],
>> method="ML")
>> MyModel
>
> And I see:
>
>
> arima(x = y[1:58], order = c(1, 0, 0), xreg = MyData[1:58, 7:14], method =
> "ML")
>
> Coefficients:
>          ar1  intercept       x1       x2      x3      x4        x5
> x6
>       0.5812   -52.7725  -0.0270  -6.3467  2.8435  4.3727  -14.9045
> -3e-04
> s.e.  0.1328    16.6182   0.0212   3.6454  1.5571  0.5641    2.4294
> 2e-04
>           x7      x8
>       2.4094  1.0823
> s.e.  0.5134  0.3093
>
> sigma^2 estimated as 1.223:  log likelihood = -88.35,  aic = 198.71
>
>
> To calculate a p-value, all I have to do is:
>
> 1. Let z = parameter / s.e.
> 2. Let abs_z = abs(z)
> 3. Let p = 1 minus the integral of a normal distribution from -abs_z to
> abs_z
>
> How do I extract the coefficients and standard errors out of the MyModel
> object, and place them in their own data frame?  From there, I'm sure I
> could calculate the p-value.
>
> I have found that:
>
>> coef(MyModel)
>
> ...shows the coefficients, but I'm unable to get them into a data frame.
> I tried:
>
>> MyParameters\$coef <- coef(MyModel)
>
> But when I try...
>
>> MyParameters <- edit(MyParameters)
>
> ...I don't see what I would expect: a column of coefficients.  And I don't
> know how to refer to the standard errors.  Help?  Thanks.
>

--
View this message in context: http://www.nabble.com/How-to-extract-vectors-from-an-arima%28%29-object-and-into-a-data-frame--tp16757321p16758220.html
Sent from the R help mailing list archive at Nabble.com.