# How to calculate the p-value of parameters for ARIMA model in R?

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?

• 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. Mar 28 '11 at 10:08
• 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? Aug 30 '11 at 18:42

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.

• 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....
– Lisa
Mar 28 '11 at 10:28
• 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) }
– Lisa
Mar 28 '11 at 10:31
• 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.
– DWin
Apr 2 '13 at 0:57

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.

• 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. Oct 21 '16 at 9:06
• You could do this via log-likelihood ratio, since the model is estimated using log-likelihood. Oct 21 '16 at 11:45
• 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 Oct 21 '16 at 12:15

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