Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/arma_loglikelihood.R
Evaluates the ARMA(p,q) log-likelihood function at the set of arma parameters e.g. order = c(1,1) data = arma data parameters = arma parameters (phi_1, ..., phi_p, theta_1, ..., theta_q)
1 | arma_loglikelihood(parameters, data, ord)
|
parameters |
a vector of arma parameters |
data |
a vector of arma data |
ord
ord |
order of arma model |
Evaluates the ARMA(p,q) logliklihood function. 'data' and 'order' must be specified as global variables
scalar value of the arma LOG-likelihood evaluated at vector (parameters) for the given data
Evaluates Reduced Gaussian log-likelihood g <- n*log(2*pi) + n*log(sigma2) + sum(log(kal$S)) + sum(kal$E^2/kal$S)/sigma2 g <- -g/2
Hannah Lennon <drhannahlennon@gmail.com>
arma_lik
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(forecast)
# Example 1
library(gamlss.data)
data(polio)
data <- polio
order <- c(1,1)
arma_loglikelihood(c(0.7, -0.5), data, c(1,1))
# Example 2
data <- forecast::arima.sim(model=list(ar =c(0.4, -0.5), ma=c(0.8, 0.2)), n=2000)
order <- c(2,2)
para <- c(0,0,0,0)
# takes 1 minute to optimise
# optim(para, arma_loglikelihood, data=data, ord=order, control=list(fnscale=-1))$par
# [1] 0.4569347 -0.5244361 0.7507188 0.1448333
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.