[R-SIG-Finance] ARIMA question

Nathan Bryant nbryant at optonline.net
Fri Nov 9 01:06:11 CET 2007


Ok, fitted.Arima is in library(forecast)

Jeff Ryan wrote:
> Do you have a particular version?  Mine does not have a method like that...
>
>   
>> x.model
>>     
>
> Call:
> arima(x = x, order = c(0, 0, 2))
>
> Coefficients:
>          ma1      ma2  intercept
>       0.3812  -0.1138     0.0936
> s.e.  0.0956   0.0862     0.2631
>
> sigma^2 estimated as 4.318:  log likelihood = -215.15,  aic = 438.31
>   
>> class(x.model)
>>     
> [1] "Arima"
>   
>> methods(fitted)
>>     
> [1] fitted.default*         fitted.isoreg*          fitted.nls*
> [4] fitted.quantmod*        fitted.smooth.spline*   fitted.values.quantmod*
>
>    Non-visible functions are asterisked
>   
>> fitted(x.model)
>>     
> NULL
>   
>
>
> On Nov 7, 2007 3:07 PM, Nathan Bryant <nbryant at optonline.net> wrote:
>   
>> There is a method called "fitted()" that applies to most model classes
>> including Arima, which does the same thing.
>>
>>
>> Jeff Ryan wrote:
>>     
>>> I think it is as simple as backing out from the residuals:
>>>
>>> # an MA2 model
>>> x <- arima.sim(list(ma=2),n=100)
>>>
>>> #Fitted as such...
>>> x.model <- arima(x,c(0,0,2))
>>>
>>> # add the residuals to the original data
>>> x.insample.fit <- x-residuals(x.model)
>>>
>>> # and you can even see them:
>>> plot(x)
>>> par(new=TRUE)
>>> lines(x.insample.fit,col=3,lty=2)
>>>
>>> Jeff
>>>
>>>
>>> On Nov 7, 2007 12:47 PM, Yalla, Swaroop (FID)
>>> <Swaroop.Yalla at morganstanley.com> wrote:
>>>
>>>       
>>>> Hi:
>>>>
>>>> I have another ARIMA question for R. I was finally able to use ARIMA
>>>> modeling on my data. Now to forecast out of sample, we can use
>>>> predict(fit, n.ahead = 10) type of command and thats fine- but how can I
>>>> see the fit in-sample. I mean is there a easy way to just compare the
>>>> actual data with the fitted model in-sample?
>>>>
>>>> thanks for all the help..
>>>> Swaroop
>>>> --------------------------------------------------------
>>>>
>>>> This is not an offer (or solicitation of an offer) to bu...{{dropped:24}}
>>>>
>>>> _______________________________________________
>>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>>> -- Subscriber-posting only.
>>>> -- If you want to post, subscribe first.
>>>>
>>>>
>>>>         
>>> _______________________________________________
>>> R-SIG-Finance at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only.
>>> -- If you want to post, subscribe first.
>>>
>>>
>>>       
>>     
>
>



More information about the R-SIG-Finance mailing list