joelnmdyer
joelnmdyer

Reputation: 11

Is there an R function for evaluating the pdf for an ARIMA model given data and a parameter set?

I'm unfamiliar with R, but I've been able to write code that estimates parameters for an ARIMA model of whatever order to some data I have in a file. It looks like this:

data <- read.table("ARMA22-series.csv", sep=" ", header=FALSE, dec=".")
data <- as.ts(data)
arima_results <- arima0(data, order=c(2, 0, 2), include.mean=FALSE)

However, I'm interested in evaluating the likelihood function for a certain set of parameter values, rather than just finding the parameters that maximise the likelihood for a given dataset. Is there a function that allows you to just evaluate the probability density of data, given values for the ARIMA parameters?

Thanks in advance!

Upvotes: 0

Views: 118

Answers (1)

Maurits Evers
Maurits Evers

Reputation: 50728

I don't know why you're using arima0, which is labelled as a preliminary version, and was replaced by arima.

arima fits a specific (S)ARIMA model to your data, with parameters specified through the function arguments order and seasonal. forecast::auto.arima tries to determine the optimal (S)ARIMA model conditional on the data.

The arima output object includes the log-likelihood; for example, consider the USAccDeaths sample data, we can fit the two SARIMA models: SARIMA(0,1,1)(0,1,1) and SARIMA(0,1,0)(0,1,0).

fit1 <- arima(USAccDeaths, order = c(0, 1, 1), seasonal = list(order = c(0, 1, 1)))
fit2 <- arima(USAccDeaths, order = c(0, 1, 0), seasonal = list(order = c(0, 1, 0)))

The arima output object is a list, and the log-likelihood is stored in element loglik:

fit1$loglik
#[1] -425.44
fit2$loglik
#[1] -435.8443

Upvotes: 0

Related Questions