24
$\begingroup$

When doing time series research in R, I found that arima provides only the coefficient values and their standard errors of fitted model. However, I also want to get the p-value of the coefficients.

I did not find any function that provides the significance of coef.

So I wish to calculate it by myself, but I don't know the degree of freedom in the t or chisq distribution of the coefficients. So my question is how to get the p-values for the coefficients of fitted arima model in R?

$\endgroup$
  • 9
    $\begingroup$ Why do you want the p-value? Significance tests for the coefficients of an AR model are not particularly helpful as significance is not a good way to select the model order. Use the AIC instead. $\endgroup$ – Rob Hyndman Mar 28 '11 at 10:08
  • 1
    $\begingroup$ Often more than one model fits the data well. So typically I it's nice to have more than one diagnostic. So if I already use pacf/acf, AIC/BIC (maybe also forecasting accuracy) and still can't choose between two models – is there anything wrong with lookin at coefficient significance too? $\endgroup$ – hans0l0 Aug 30 '11 at 18:42
4
$\begingroup$

The "t value" is the ratio of the coefficient to the standard error. The degrees of freedom (ndf) would be the number of observations minus the max order of difference in the model minus the number of estimated coefficients. The "F value " would be the square of the "t value" In order to exactly compute probability you would have to call a non-central chi-square function and pass in the F value and the degrees of freedom (1,ndf) or perhaps simply call an F function lookup.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Many thanks! I wrote it like this... But to my surprise that almost all the parameters are insignificant... But in SAS it says that they are significant... So I doubt if there is any error in my programming words.... $\endgroup$ – Lisa Mar 28 '11 at 10:28
  • $\begingroup$ what I wrote: t = rep(0,5) std = rep(0,5) pvalue = rep(0,5) nobs = 369 npara = 5 for (i in 1:5){ std[i] = sqrt (fit$var.coef[i,i]) t[i] = fit$coef[i]/std[i] pvalue[i] = 1 - pt(t[i],nobs-npara) } $\endgroup$ – Lisa Mar 28 '11 at 10:31
  • $\begingroup$ The use of results from an undescribed SAS program hardly constitutes evidence of statistical correctness. SAS is not an oracle. Too bad the SO-AskAnExpert popup introduced on April 1 is so circular in its reasoning strategy, eh. $\endgroup$ – DWin Apr 2 '13 at 0:57
24
$\begingroup$

Since arima uses maximum likelihood for estimation, the coefficients are assymptoticaly normal. Hence divide coefficients by their standard errors to get the z-statistics and then calculate p-values. Here is the example with in R with the first example from arima help page:

> aa <- arima(lh, order = c(1,0,0))
> aa

Call:
arima(x = lh, order = c(1, 0, 0))

Coefficients:
         ar1  intercept
      0.5739     2.4133
s.e.  0.1161     0.1466

sigma^2 estimated as 0.1975:  log likelihood = -29.38,  aic = 64.76
> (1-pnorm(abs(aa$coef)/sqrt(diag(aa$var.coef))))*2
         ar1    intercept 
1.935776e-07 0.000000e+00 

The last line gives the p-values.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ just for completion: that's the p value of the univariate hypothesis test: $H_0: coef=0.0$ vs $H_1: coef \neq 0.0$ It would be interesting to check the significance of multiple coefficients together, through either Bonferroni correction or Hotelling. $\endgroup$ – Tommaso Guerrini Oct 21 '16 at 9:06
  • $\begingroup$ You could do this via log-likelihood ratio, since the model is estimated using log-likelihood. $\endgroup$ – mpiktas Oct 21 '16 at 11:45
  • $\begingroup$ Yeah true, being $\lambda$ the likelihood ratio $-2\lambda$ follows a $\chi^2$ distribution when $n$ goes to $\infty$ , that's what I remember from some course.. I wonder what is $n$ in a time series context $\endgroup$ – Tommaso Guerrini Oct 21 '16 at 12:15
13
$\begingroup$

You could also use coeftest from lmtestpackage:

> aa <- arima(lh, order = c(1,0,0))

> coeftest(aa)

z test of coefficients:

          Estimate Std. Error z value  Pr(>|z|)    
ar1        0.57393    0.11614  4.9417 7.743e-07 ***
intercept  2.41329    0.14661 16.4602 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.