[R-SIG-Finance] simple arma model

Rob van Dijk rvdossnl at gmail.com
Fri Sep 23 23:48:33 CEST 2011


Hello All,

let me first thank you for all the usefull commets I have seen in the short
time Iḿ following this mailing list.
I'm constructing a simple arma model of the dutch aex index, to get started.

I have two questions which are probably simple to answer but I cannot find
it on the net.

Why do I get an error with the arma sequence..... NAs in X. I have searched
but cannot find them. (script etc added).

How do I download high, low, open, close? with the download sequence. When i
add these I get a "text"error.

All help is appreciated!

regards,

rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110923/ceaad420/attachment.html>
-------------- next part --------------


> require(tseries)

> aex <- get.hist.quote("^aex",start=(today <- Sys.Date())-735,quote= "Cl")

> as.vector(aexreturn <-diff(aex)/tail(aex,-1))
  [1] -7.355303e-03  4.412893e-03  2.042379e-03 -1.568780e-02 -9.455878e-03  2.010260e-02  7.048571e-04 -2.473101e-03
  [9] -1.834892e-02 -2.151687e-02  6.374079e-03  2.606053e-02 -2.263834e-04  1.763248e-02  2.503565e-03  1.608930e-02
 [17] -3.692924e-03  1.825053e-02 -8.610351e-04 -8.935497e-03  1.443293e-02 -6.493906e-03  1.781874e-03 -1.499891e-02
 [25] -1.717998e-03 -2.395650e-02 -4.885418e-03 -2.584985e-02  2.053932e-02 -2.411033e-02  1.519054e-03 -9.030022e-03
 [33]  1.886361e-02  6.334665e-03 -2.246533e-03  2.327800e-02 -3.830684e-03  1.481272e-02 -2.870119e-03  9.767779e-04
 [41]  1.486839e-02 -3.363648e-03 -5.196919e-03 -1.950145e-02 -1.057962e-02  2.211077e-02 -3.735832e-03  7.478632e-03
 [49] -3.755869e-02  9.046265e-03 -1.183393e-02  3.024347e-02  3.160157e-03  3.683763e-03  1.096129e-02 -2.747853e-03
 [57] -1.528073e-02 -8.150089e-03  1.514055e-02  7.652902e-03  7.348609e-03  8.241336e-03  1.040747e-02 -5.907922e-03
 [65] -6.314882e-03  1.779069e-02  5.925168e-03  1.051588e-03  2.308153e-03  7.467793e-03  3.468928e-03 -6.385391e-03
 [73]  5.666060e-04  2.244702e-02 -2.953044e-03 -1.581352e-03 -2.730877e-03  4.065041e-03 -4.170093e-03 -1.113520e-02
 [81]  4.169377e-03  7.134259e-03 -7.751709e-03  3.067575e-03  7.552472e-03 -1.578947e-02 -1.243339e-02 -8.164380e-03
 [89] -2.952726e-03  3.458213e-03 -7.303062e-03 -1.021763e-02  1.204636e-02  1.029248e-02  8.172674e-03 -3.032760e-03
 [97] -3.031897e-02 -2.599670e-02  4.612954e-03  1.766227e-03 -3.037014e-03  2.209596e-03 -3.357193e-03  3.799152e-04
[105]  9.346381e-03  1.327639e-02  3.607771e-03  3.992629e-03 -1.476378e-03 -1.286644e-02 -2.181229e-04 -1.927902e-02
[113]  9.095487e-03  2.043962e-02  1.179015e-02  1.090821e-02  1.774703e-03  1.839495e-02 -1.508117e-03  2.713144e-03
[121]  5.513682e-03 -5.751873e-03  1.619695e-03 -1.330906e-02  1.223251e-02  1.107678e-02 -3.246089e-03 -9.744574e-03
[129] -1.537870e-03  9.897221e-03  6.730263e-04  1.119759e-02 -5.235450e-03  4.360972e-04 -1.047730e-03  1.801174e-03
[137]  2.054405e-02  1.172633e-02 -4.860267e-03 -8.549688e-03  1.404928e-02 -1.547813e-03 -2.567503e-03  6.280315e-03
[145] -3.093624e-03 -1.664046e-02 -3.385260e-03  1.772530e-02 -3.393089e-03 -6.689249e-03  5.857717e-03  1.133089e-02
[153] -2.380270e-02 -1.326368e-02  1.122080e-02 -7.371860e-03  2.968813e-03 -3.298994e-02 -1.535764e-02 -1.407155e-02
[161] -4.430927e-02  6.827944e-02 -5.277678e-03  1.015138e-02  2.664298e-03 -3.226989e-02 -2.051628e-03  1.338369e-02
[169] -2.970913e-02 -2.092994e-02 -4.626528e-03  5.102529e-04 -2.799725e-02  2.233974e-02  2.852161e-02 -1.621756e-03
[177]  1.870907e-04  1.587746e-03  4.185268e-03  1.366847e-02 -1.808729e-02 -1.158909e-02 -8.607820e-03  1.808939e-02
[185]  1.471944e-02  4.300283e-04  1.777040e-02  7.099635e-03  2.807982e-03  1.491380e-03  2.380527e-03  1.460239e-02
[193] -3.649205e-03 -1.399540e-02 -1.789077e-02 -9.908279e-03  1.352660e-02 -3.582735e-02 -7.007355e-03 -2.903823e-02
[201]  1.070733e-03 -6.301629e-03  2.595172e-02  9.856405e-03  1.568409e-02  5.548363e-03  6.553160e-03  2.157239e-02
[209]  3.790705e-03 -1.598132e-02 -1.780919e-02 -6.180124e-03 -4.805592e-03  1.807820e-02  2.637232e-02  5.754286e-03
[217]  2.012906e-03  7.690487e-04 -9.103662e-03 -8.731521e-03 -4.506412e-03  2.655597e-02 -1.946903e-03  5.896226e-04
[225] -7.814125e-03 -1.624445e-02  1.399268e-02 -8.254788e-03 -2.507769e-02 -2.684191e-03 -6.174364e-04 -2.413814e-03
[233]  1.616684e-02 -2.380444e-03 -1.644074e-02 -1.367839e-02  1.632448e-03 -1.643320e-02 -5.357372e-03  7.956209e-03
[241]  8.894777e-03 -4.721914e-03  2.907069e-03  2.780167e-02  3.215237e-03  8.440868e-03  3.570024e-03 -8.451306e-03
[249]  1.107323e-02  9.444395e-03  1.104610e-03  6.849112e-03 -1.603659e-03 -2.590365e-03 -3.555741e-03 -3.885933e-04
[257]  1.550867e-02 -2.566826e-03 -1.372813e-02 -4.597080e-03  1.488826e-02 -2.016787e-03  2.957093e-03 -6.907846e-03
[265] -4.366159e-03 -1.827551e-03 -1.023002e-02  1.381966e-02  5.757189e-03  2.073030e-03 -3.387514e-03  1.513174e-03
[273] -5.819332e-03  1.940185e-02 -1.142589e-03  3.514424e-04  7.901206e-04 -7.577768e-03  1.648465e-03  6.463500e-03
[281] -2.492157e-03  4.262400e-03 -5.194272e-03 -8.195509e-03  3.253475e-04 -2.579842e-03  6.247237e-03  7.806561e-03
[289] -8.759770e-03  1.767348e-02  5.044681e-03 -6.057285e-04  3.019497e-03 -4.767546e-03 -3.653974e-03 -4.749417e-03
[297]  6.743264e-03 -1.863153e-02  6.705710e-03  1.377538e-02 -4.904521e-03 -6.308043e-03 -2.269876e-02  7.058126e-03
[305]  4.634413e-03 -7.464462e-03 -1.998969e-02 -6.902660e-03  2.498511e-02  1.654708e-02  2.162541e-03  4.381609e-04
[313]  1.117819e-02  1.470928e-03  7.613487e-03  2.370007e-03  3.102761e-03  1.478029e-03 -2.936230e-03  3.097647e-03
[321]  4.828860e-04  3.114824e-03  8.395575e-03  8.422944e-05  1.122933e-04 -8.147898e-04 -9.843350e-04  3.139981e-03
[329]  4.549006e-03 -5.500056e-03 -5.048368e-03  1.470016e-02 -2.786602e-03 -4.422302e-03 -1.092774e-03 -1.262485e-03
[337] -6.295700e-03  1.141502e-02  1.134075e-02 -4.490147e-03  1.466844e-03 -6.646726e-04  7.285624e-03 -1.611912e-02
[345] -5.110350e-03  1.359922e-02 -1.662096e-04 -6.215855e-03  9.087143e-03  6.258063e-03 -8.777273e-03 -1.136521e-03
[353]  1.732451e-02  7.621329e-04 -6.851380e-03  1.696260e-03  1.173449e-02  3.395220e-03 -5.227802e-03  3.858504e-03
[361] -2.597051e-03  1.404760e-03  9.176540e-04  2.638025e-03  4.021556e-03  3.206927e-03 -8.815917e-03 -5.666567e-03
[369] -9.829153e-03 -4.151431e-03  8.288573e-03  6.393412e-03 -3.206957e-03 -8.469002e-03  7.453754e-03  9.512162e-04
[377] -5.108173e-03  8.188220e-04 -3.549488e-04 -1.134920e-02 -8.549865e-03 -7.717782e-03 -2.364331e-02 -1.424825e-02
[385]  1.735097e-02  3.281870e-03  1.763387e-02 -8.979180e-04  9.340079e-03  1.004431e-02  3.455368e-03 -2.194366e-04
[393]  3.662103e-03  5.327969e-03 -6.153930e-03  1.036676e-02 -1.192380e-03 -1.355160e-04  1.839628e-03 -6.124282e-03
[401] -1.226359e-03 -1.282506e-03 -1.579954e-02  5.485721e-03 -9.124291e-03 -1.337047e-03 -1.791993e-02  1.387434e-03
[409]  1.861783e-02 -2.395476e-03  1.501877e-03  4.448028e-04 -6.119781e-04  1.250208e-03  4.480584e-03 -3.162977e-03
[417] -1.267174e-02 -3.071980e-03  1.197371e-02 -8.962436e-03  1.418086e-02 -1.386770e-03 -8.475050e-03 -7.495914e-03
[425] -7.266534e-03 -1.317152e-02  3.953022e-03  4.959526e-03 -7.466115e-03 -1.687788e-02  2.156177e-03  4.957815e-03
[433] -1.277325e-03  4.594579e-03  4.043905e-04  9.271978e-03 -1.008816e-02 -1.558830e-02 -1.175641e-03 -3.125184e-03
[441] -7.376154e-04 -9.772084e-03  7.070169e-03 -1.261121e-02  5.987486e-04  1.034013e-02 -1.041791e-02 -5.085001e-03
[449]  2.281529e-03 -4.432517e-03  1.338728e-02 -5.895203e-03 -1.704355e-02  5.171260e-04 -7.001309e-04  4.213398e-03
[457]  1.604629e-02  1.286619e-02  9.246835e-03  1.979622e-03 -1.165841e-03 -4.332299e-03  1.025611e-02 -7.825274e-03
[465] -1.880057e-02 -1.216428e-02  2.582738e-03 -7.625734e-03 -2.943944e-03 -1.955627e-02  9.197658e-03  1.354907e-02
[473]  1.843496e-02  5.138807e-03 -3.943428e-03 -1.573915e-03 -1.092765e-02 -1.623767e-03 -1.014519e-02 -1.426415e-02
[481] -1.434375e-02 -2.996556e-02 -3.270733e-02 -1.518475e-02 -4.584274e-02  1.285490e-02 -3.527248e-02  1.951978e-02
[489]  3.120932e-02  6.128703e-03 -7.512607e-03  3.895438e-03 -4.674869e-02 -1.980668e-02  8.032710e-03  7.006324e-03
[497]  1.157753e-02 -1.109555e-02 -6.832972e-03  1.656830e-02  8.390918e-03  3.171406e-02  3.503878e-03 -2.628915e-02
[505] -4.365094e-02 -4.097611e-03  2.746842e-02  8.257172e-03 -2.640348e-02 -2.838200e-02  5.813738e-03  1.283082e-02
[513]  1.780842e-02  1.139389e-02 -2.585297e-02  1.756457e-02 -1.400174e-02 -4.646219e-02

> ncol(aexreturn)
[1] 1

> nrow(aexreturn)
[1] 518

> x <- aexreturn

> armaaex <- arma(x, order = c(1, 1), lag = NULL, coef = NULL, include.intercept = TRUE, series = NULL, qr.tol = 1e-07,)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dataloadscript.R
Type: application/octet-stream
Size: 309 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20110923/ceaad420/attachment.obj>


More information about the R-SIG-Finance mailing list