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? Thanks for your answer Myriam
Hi Myriam, I'll take a stab at it, but can't offer elegance in the solution such as the more experienced R folks might deliver. I believe that the ARIMA function provides both point estimates and their standard errors for the coefficients. You can use these as you might a mean and standard error in a one-sample t- or z-test with the null hypothesis being that the coefficient value is 'zero'. If the interval estimate of the coefficient doesn't span 'zero', then you reject the null hypothesis at whatever level of Type 1 error you chose. The R set of distribution functions might be useful for this. Having offered that as a possible interim solution, you'd be well served to see what other advice more experienced R users might offer. Regards, Cliff On Mon, Jun 22, 2009 at 6:38 PM, <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? > > Thanks for your answer > Myriam > > ______________________________________________ > R-help at 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. >
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}}