[R] multiple frequencies per second again

Rui Barradas ruipbarradas at sapo.pt
Sat Mar 16 20:47:10 CET 2013


Hello,

The answer to your question is no, you don't have to do anything 
special, except, of course, say how many steps ahead you want to predict.
To see this, run the second example in ?predict.Arima. It predicts 6 
steps ahead, accounting for the frequency.

Hope this helps,

Rui Barradas

Em 15-03-2013 17:51, Erin Hodgess escreveu:
> Dear R People:
>
> I have the following situation.  I have observations that are 128 samples
> per second, which is fine.  I want to fit them with ARIMA models, also fine.
>
> My question is, please:  when I do my forecasting, do I need to do anything
> special to the "n.ahead" parm, please?  Here is the initial setup:
>
>
>> xx <- ts(rnorm(128),start=0,freq=128)
>> str(xx)
>   Time-Series [1:128] from 0 to 0.992: -1.07 0.498 1.508 0.354 -0.497 ...
>> xx.ar <- arima(xx,order=c(1,0,0))
>> str(xx.ar)
> List of 13
>   $ coef     : Named num [1:2] -0.0818 0.0662
>    ..- attr(*, "names")= chr [1:2] "ar1" "intercept"
>   $ sigma2   : num 1.06
>   $ var.coef : num [1:2, 1:2] 7.78e-03 -5.09e-05 -5.09e-05 7.07e-03
>    ..- attr(*, "dimnames")=List of 2
>    .. ..$ : chr [1:2] "ar1" "intercept"
>    .. ..$ : chr [1:2] "ar1" "intercept"
>   $ mask     : logi [1:2] TRUE TRUE
>   $ loglik   : num -185
>   $ aic      : num 376
>   $ arma     : int [1:7] 1 0 0 0 128 0 0
>   $ residuals: Time-Series [1:128] from 0 to 0.992: -1.133 0.338 1.477 0.406
> -0.54 ...
>   $ call     : language arima(x = xx, order = c(1, 0, 0))
>   $ series   : chr "xx"
>   $ code     : int 0
>   $ n.cond   : int 0
>   $ model    :List of 10
>    ..$ phi  : num -0.0818
>    ..$ theta: num(0)
>    ..$ Delta: num(0)
>    ..$ Z    : num 1
>    ..$ a    : num 0.156
>    ..$ P    : num [1, 1] 0
>    ..$ T    : num [1, 1] -0.0818
>    ..$ V    : num [1, 1] 1
>    ..$ h    : num 0
>    ..$ Pn   : num [1, 1] 1
>   - attr(*, "class")= chr "Arima"
>> predict(xx.ar,n.ahead=3)
> $pred
> Time Series:
> Start = c(1, 1)
> End = c(1, 3)
> Frequency = 128
> [1] 0.05346814 0.06728105 0.06615104
>
> $se
> Time Series:
> Start = c(1, 1)
> End = c(1, 3)
> Frequency = 128
> [1] 1.028302 1.031737 1.031760
>
>>
>
> Thanks for any help.
>
> Sincerely,
> Erin
>
>



More information about the R-help mailing list