time series - The curious case of ARIMA modelling using R -



time series - The curious case of ARIMA modelling using R -

i observed unusual while fitting arma model using function arma{tseries} , arima{stats} in r.

there radical difference in estimation procedures adopted 2 functions, kalman filter in arima{stats} opposed ml estimation in arma{tseries}.

given difference in estimation procedures between 2 functions, 1 not expect results radically different 2 function if utilize same timeseries.

well seems can!

generate below timeseries , add together 2 outliers.

set.seed(1010) ts.sim <- abs(arima.sim(list(order = c(1,0,0), ar = 0.7), n = 50)) ts.sim[8] <- ts.sim[12]*8 ts.sim[35] <- ts.sim[32]*8

fit arma model using 2 function.

# works fine arima(ts.sim, order = c(1,0,0)) # works fine arma(ts.sim, order = c(1,0))

change level of timeseries factor of 1 billion

# introduce multiplicative shift ts.sim.1 <- ts.sim*1000000000 options(scipen = 999) summary(ts.sim.1)

fit arma model using 2 functions:

# works fine arma(ts.sim.1, order = c(1,0)) # not work arima(ts.sim.1, order = c(1,0,0)) ## error in solve.default(res$hessian * n.used, a): scheme computationally singular: reciprocal status number = 1.90892e-19

where figured out problem when sas software able run proc x12 procedure conduct seasonality test same function on r gave me error above. made me wonder , @ sas results skepticism turn out, might arima{stats}.

can seek elaborate reason above error limits fit model using arima{stats}?

the problem arises in stats::arima function when calculating covariance matrix of coefficients. code not robust scale effects due big numbers, , crashes in computing inverse of hessian matrix in line:

var <- crossprod(a, solve(res$hessian * n.used, a))

the problem avoided scaling data. example

arima(ts.sim.1/100, order = c(1,0,0))

will work.

the tseries::arma function not work "perfectly fine" though. returns warning message:

in arma(ts.sim.1, order = c(1, 0)) : hessian negative-semidefinite

this can avoided scaling:

arma(ts.sim.1/1000, order = c(1,0))

r time-series kalman-filter hessian-matrix

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -