[R] p-values for ARIMA coefficients

Rolf Turner r.turner at auckland.ac.nz
Tue Jun 23 04:40:49 CEST 2009


On 23/06/2009, at 11:38 AM, m.gharbi at yahoo.fr wrote:

> Hi,
>
> I'm a beginner using R and I'm modeling a time series with ARIMA.
> I'm looking for a way to determine the p-values of the coefficients  
> of my model.
>
> Does ARIMA function return these values? or is there a way to  
> determine them easily?

The latter.  The arima() function (note the *lower case* letters; R  
is case sensitive)
returns all the info needed to calculate the p-values.

Here's a wee function that wraps it all up:

cwp <- function (object){
#
# cwp <--> ``coefficients with p-values''
#
     coef <- coef(object)
     if (length(coef) > 0) {
         mask <- object$mask
         sdev <- sqrt(diag(vcov(object)))
         t.rat <- rep(NA, length(mask))
         t.rat[mask] <- coef[mask]/sdev
         pt <- 2 * pnorm(-abs(t.rat))
         setmp <- rep(NA, length(mask))
         setmp[mask] <- sdev
         sum <- rbind(coef, setmp, t.rat, pt)
         dimnames(sum) <- list(c("coef", "s.e.", "t ratio", "p-value"),
             names(coef))
         return(sum)
     } else return(NA)
}

Note that the ``mask'' component of the value returned by arima does  
not get
a mention in the help.  The mask is TRUE where the parameter is being  
estimated
and FALSE where the parameter has been fixed to a predetermined value  
(using the
``fixed'' argument of arima().

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}




More information about the R-help mailing list