Hi:
Here's an example (never mind the model fit...or lack of it thereof...)
str(AirPassengers) # a built-in R data set
# Series is seasonal with increasing trend and increasing variance
plot(AirPassengers, type = 'l')
# STL decomposition
plot(stl(AirPassengers, 'periodic'))
# ACF and PACF of differenced series
par(mfrow = c(2, 1))
acf(diff(AirPassengers))
pacf(diff(AirPassengers))
par(mfrow = c(1, 1))
# Fit a basic seasonal model: SARIMA(0, 1, 1) x (0, 0, 1):
m1 <- arima(AirPassengers, order = c(0, 1, 1),
seasonal = list(order = c(0, 0, 1), period = 12))
# Most models in R return lists; arima() is no different:
names(m1)
[1] "coef" "sigma2" "var.coef"
"mask" "loglik" "aic"
[7] "arma" "residuals" "call"
"series" "code" "n.cond"
[13] "model"
# var.coef looks promising, so let's extract it:
m1$var.coef
# As David mentioned, vcov() also works (not just for time series, either):
vcov(m1)
Both should return the same covariance matrix of the estimated coefficients.
The standard errors are the square roots of the diagonal elements:
sqrt(diag(m1$var.coef))
sqrt(diag(vcov(m1)))
Compare this to the output from arima():> m1
Call:
arima(x = AirPassengers, order = c(0, 1, 1), seasonal = list(order = c(0, 0,
1), period = 12))
Coefficients:
ma1 sma1
0.2263 0.8015
s.e. 0.0805 0.0674
HTH,
Dennis
On Mon, Nov 22, 2010 at 1:29 PM, lucia <lucia@thedietdiary.com> wrote:
> Hello,
> I'm an R newbie. I've tried to search, but my search skills
don't seem up
> to finding what I need. (Maybe I don't know the correct terms?)
>
> I need the standard errors and not the confidence intervals from an ARIMA
> fit.
>
> I can get fits:
>
> > coef(test)
> ar1 ma1 intercept
> time(TempVector) - 1900
> 0.801459585 0.704126549 12.854527065
> 0.000520366
>
> And confidence intervals:
>
> > confint(test)
> 2.5 % 97.5 %
> ar1 7.684230e-01 0.834496136
> ma1 6.742786e-01 0.733974460
> intercept 1.217042e+01 13.538635652
> time(TempVector) - 1900 -9.610183e-06 0.001050342
> >
>
> http://stat.ethz.ch/R-manual/R-devel/library/stats/html/arima.html
> Are any of these standard errors?
>
> > vcov(test)
> ar1 ma1 intercept
> time(TempVector) - 1900
> ar1 2.841144e-04 -5.343792e-05 1.028710e-05
> 2.725763e-08
> ma1 -5.343792e-05 2.319165e-04 9.990842e-07
> -3.103661e-09
> intercept 1.028710e-05 9.990842e-07 1.218299e-01
> 8.969206e-05
> time(TempVector) - 1900 2.725763e-08 -3.103661e-09 8.969206e-05
> 7.311670e-08
>
> Or is there a function that can give me standard errors for the
> coefficients on AR1, ma, and time? (I don't care about the intercept.)
> Thanks,
> Lucia
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]