Hello.

I've got a problem with arma/xreg.
I would like to get a better model-fit by implenting
some external explanatory variable, so I thought I can
implement it by expand the arima-function with an
xreg-argument:

I have two stationary data vectors y and x of length
201:

y <-
c(0.935179888,1.099621832,1.020898987,1.031344228,1.027391172,1.034505855,0.959332043,0.999752242,1.004620032,0.969349882,1.010151201,0.974301527,1.058661595,1.032034174,1.020128405,1.000758017,1.017398344,1.006926293,0.954573759,0.912570705,0.993454547,0.960713389,1.027295127,0.995625881,1.02888089,1.05868054,1.025135985,0.983689928,0.977666211,1.033050026,1.070297717,1.055212067,1.001620248,1.06201233,1.016039772,1.059151318,0.999619963,0.978265714,1.003551008,1.038852232,1.003853711,0.931504415,1.011551463,1.034393251,0.979243349,0.961356801,1.016681954,0.99742985,0.99585959,1.021858043,0.950953391,0.992069175,1.043981733,1.027189331,1.028031541,1.026104981,1.007044244,0.958918846,1.015058862,1.032371312,1.047557049,1.023094437,1.018833668,1.01794437,0.998617914,1.014458993,0.98650118,1.008316971,1.021940613,1.037733207,1.023986962,1.032680308,1.040029784,1.077245266,1.051874866,0.994617226,1.071775398,1.041365904,1.116389765,1.007126301,0.965002025,1.008483662,0.9376974
23,1.080747815,1.036386401,1.068025896,1.074249575,1.066970225,1.029237043,1.059636508,1.049193923,0.898242066,0.88055395,0.915056333,1.111661117,0.984215305,1.08026099,0.964886598,0.984195395,1.062223756,1.006178862,1.015801476,1.031825467,0.952920137,1.020232779,1.002160906,1.087572591,1.098203044,1.088168142,1.088072929,1.038249248,0.941422225,0.975751618,1.001879383,1.000039815,1.004595563,0.972723737,0.956462279,1.013833761,0.950975235,1.012593537,0.985065601,0.915567548,1.007776297,1.032322747,0.978860939,0.969294333,0.931093948,0.805394349,1.045132388,1.081325659,1.025201369,1.015122585,0.950157172,1.087620665,0.976754838,0.949992181,0.896406385,0.903831694,0.921309592,0.876027456,0.918654899,1.087475731,0.966178682,0.937122162,0.893733464,0.953978817,1.120225353,1.04744569,1.087787877,1.049306954,1.033114009,1.017399342,0.99771273,1.064031766,1.038724562,1.054450603,0.996763573,0.964837672,1.029435663,0.958467792,1.030312893,0.974192282,0.96820758,1.039717729,1.0137
38116,1.036718789,1.026219201,1.007127177,1.023149744,1.002913274,0.985405566,1.008323957,1.055354704,1.034441194,1.033791899,1.012247037,1.001147328,1.028412101,1.049214295,1.028235375,1.048874205,1.0172136,1.025299806,0.972678258,0.940044158,1.017990071,1.027910044,1.026206501,1.04411013,1.033659239,1.019456171,1.030796339,1.032959973,0.970032892,1.079233429,1.047625007,1.038579427,1.001825177,0.946100153,1.023421071)

x <-
c(0.843804619,0.812494444,1.057153783,1.068547061,1.007688519,0.984935385,1.070326884,0.994289004,1.008939789,1.07920373,0.913105667,0.842313012,0.991385522,1.020596578,1.001696836,1.06490116,1.033601729,1.033260373,0.906021767,0.94919521,1.024513681,1.022911562,1.016074142,0.939601243,0.980500442,1.079063626,1.020919744,0.962612204,0.99764207,0.980969191,0.986671938,0.984204592,0.917354746,1.047323206,0.949749294,0.908443537,1.06111898,0.962441576,0.975565628,1.10586813,1.037744031,1.017285312,1.012603559,0.955810436,0.933142446,1.015373747,1.056386834,0.946937596,1.012555766,1.013192504,0.931135355,1.076147444,1.003227606,0.938365382,0.908528184,1.05649444,1.049612935,0.933005343,1.048182893,1.081632421,1.010049416,1.011438851,1.111503119,1.073132407,0.932876478,0.960196781,1.044582733,1.03257335,1.12047871,1.083561826,0.931820644,1.072323341,1.023595603,0.924593929,0.929668552,0.925557281,1.078269046,0.937313743,1.08932839,1.035980076,0.964569239,1.056003096,0.951810007,
0.918737676,0.904073477,0.924992625,0.93747407,1.026039573,1.037892279,0.858471814,0.992776547,0.980882083,1.066402634,0.915575389,0.892538964,0.882616323,1.53935517,0.892538806,1.182789262,1.202119514,0.989003579,1.016869919,1.200128461,1.08544116,1.103910082,0.995096846,1.078868434,1.013355185,1.004245292,1.056434414,0.970341177,0.813083841,1.166037232,1.125484036,0.952783835,1.013106352,1.058511007,0.916114704,1.052831832,0.825974554,1.044062559,1.054390391,0.879116652,1.027194579,1.08125758,0.960119687,0.891430256,1.091730189,1.009407287,0.797141697,0.897504867,0.999806228,1.02736344,1.028560276,1.17642998,1.098050149,1.019933455,0.989679148,1.110110079,1.020327239,1.068935624,0.97001492,0.902092245,1.183570569,1.148048114,1.065934928,0.937034066,0.819825088,1.104389823,1.076696571,0.999734094,1.032719089,0.913750574,1.137961141,0.971786203,1.088615577,1.077240451,0.989154108,1.056669276,0.976247339,1.120540772,0.946601662,1.097869386,1.110057599,1.014249285,1.177967919
,0.900747935,0.948066021,1.099763088,1.013614774,1.18432281,0.957559484,0.920055921,1.070607603,1.047189976,1.135872668,0.98039627,0.912237783,0.925643197,1.035440003,1.130888,0.942834705,1.037805665,1.155771185,1.033555401,0.973283749,1.077421329,1.003980233,0.840553552,0.924517299,1.038194855,1.090539934,0.845375213,1.078466887,1.091857857,1.110177042,0.99548284,1.049936045,1.106723097,0.913493563,1.112524556)

If you look at the cross-correlation-function you can
see, that both vectors have got a significant
correlation in lag 1.

ccf(y,x)

So, if I would like to fit a linear model to the data,
the coefficients won't be significant without doing
some lag-shifting to the time series.

Without shifting:
summary(lm(y~x))

With shifting (lag 1):
summary(lm(y[2:201]~x[1:200]))

Now I fit three arma(5,1)-models to the data:

m1 <- arima(y,order=c(5,0,1),method="ML")
m2 <- arima(y,order=c(5,0,1),method="ML",xreg=x)
m3 <-
arima(y[2:201],order=c(5,0,1),method="ML",xreg=x[1:200])

The first model is without an external regressor, the
second model is with an external regressor, but
without lag-shifting and the third model is with an
external regressor and with lag-shifting.

I would expect, that the third model will give the
best results, if I examine the residuals, but look by
yourself:

shapiro.test(m1$residuals)
shapiro.test(m2$residuals)
shapiro.test(m3$residuals)

You have to reject the third model, because the
p-value is larger than 5%, but you get a better result
without lag-shifting.

Where is my logical bug in my thinking? - Why do I get
a significant linear model by shifting, but no
significance, if I do the same shifting, when I put in
an external regressor to my arma-model? 

I am looking forward to hear from you soon.

Sincerely
Andreas ([EMAIL PROTECTED])

______________________________________________
R-help@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.

Reply via email to