-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to correctly estimate ARMA parameters #5
Comments
There are multiply issues here.
Here's an example with Nile data, I omit the predifferencing and fit ARIMA(2,1,1) model:
Note that in some cases we get wildly different results due to different starting values, numerical instabilities near the stationary region, and because sigma^2 is estimated different way in |
Thank you and I updated my KFAS package. The example code worked for me, but there is a new question. When I change the initial parameters in the above example, e.g. inits <- c(0.1,0.5,0.5,log(15000)) changed to inits <- c(0.1,0.5,0.5,log(3000)), the estimated model parameters also changed greatly. Is there a reason why this happens? Is there a rule on prescribing the initial conditions? |
The initial value log(3000) is so far off that during the optimization routine the variance Q starts to go towards zero, which causes the model to become degenerate (as the H=0 as well). There is a check in logLik.SSModel against cases where all values of H and Q are smaller than machine epsilon, but it doesn't always help, like here where adding stricter check in In general state space models there isn't really rules for initial conditions, and the likelihood contains multiple maximums, so basically you try to guess something and test different set-ups and see what gives you best likelihood (and that the values are not insensible like in above example). For simple models you can try to infer the initial values from the data, for example here you have just one variance component, so good initial value for that could be |
I guess this can be closed now. |
Dear Dr. Helske,
I am having trouble using the KFAS package to estimate ARMA coefficients. I did a test with the Nile river data, and the estimated coefficients differ a lot from what can be estimated by the standard arima in R. The codes are reproduced below:
data(Nile)
Nile = diff(Nile)
model = SSModel( Nile ~ SSMarima(ar=c(0.1,0.2),ma=c(0.1)), H=1e-7 )
fn <- function(pars,model,...){
update T (which contains AR coefficients) and R (which contains MA coefficients)
model$T[2,2,] <- pars[1]
model$T[3,2,] <- pars[2]
model$R[3,,1] <- pars[3]
update the ARIMA Q
model$Q[1,1,1] <- exp( pars[4] )
model
}
inits = c(0.1,0.5,0.5,100)
modelFit<-fitSSM( model=model, inits = inits,
updatefn = fn, method='BFGS', control=list(REPORT=1,trace=1) )
the above does not coincide with the estimation result of
f = arima(x =Nile, order = c(2,0,1))
Could you take a look at this and see where I went wrong? Your help will be greatly appreciated,
Yaoping Wang
PhD student in the Ohio State University
The text was updated successfully, but these errors were encountered: