[R] Odp: Question from day2 beginner

Petr PIKAL petr.pikal at precheza.cz
Mon Jul 19 09:59:19 CEST 2010


Hi

I am not an expert in time series modelling but it seems to me that 
combination ar model and resid extractor function for result of this model 
does not work as anticipated. Check docs for resid and ar if there is some 
explanation for this.

resid(ar(logrvar, aic=TRUE))
Error in ar.yw(x, aic = aic, order.max = order.max, na.action = na.action, 
 : 
  object 'logrvar' not found

resid(ar(lh, aic=TRUE))
NULL

Meanwhile you cen extract residuals by

(ar(lh))$resid
Time Series:
Start = 1 
End = 48 
Frequency = 1 
 [1]           NA           NA           NA -0.200000000 -0.169319664
 [6] -0.716703664  0.423587220 -0.160000645 -0.045268097 -0.494396272
[11] -0.254971265 -0.376053475  0.134794676 -0.627324350  1.020458699
[16]  0.193718115 -0.307988795 -0.163571673  0.131318748 -0.313961771
[21] -0.231411368 -0.350497619  0.546760488  0.252336894 -0.609118877
[26] -0.228405270 -0.008837291  0.713218317  0.057074746 -0.085666502
[31]  0.249260015 -0.163464152  0.352508479 -0.068960359 -0.609969853
[36] -0.262570952 -0.480791327 -0.592637195  0.137284785  0.828153486
[41]  0.265912037  0.370434845  0.255487255  0.062235966 -0.136511529
[46]  1.367602812 -0.027099889  0.103497768

Regards
Petr


>
r-help-bounces at r-project.org napsal dne 18.07.2010 19:16:40:

> 
> Hello, I just started learning R and have a very basic question:
> 
> When I try ar model and extract residuals it returns Null.  Could 
someone
> explain what's going on here?  Does that mean the model is null?  But it
> seems residual has a length=# observation of the original series 
according
> to the model summary.  I am learning it by myself and have no one to ask
> here so please allow me to ask this very basic question...  Thank you 
very
> much. 
> 
> > summary(ar(logrvar, aic=TRUE))
> 
>              Length Class  Mode 
> order            1  -none- numeric 
> ar              40  -none- numeric 
> var.pred         1  -none- numeric 
> x.mean           1  -none- numeric 
> aic             44  -none- numeric 
> n.used           1  -none- numeric 
> order.max        1  -none- numeric 
> partialacf      43  -none- numeric 
> resid        20731  -none- numeric 
> method           1  -none- character
> series           1  -none- character
> frequency        1  -none- numeric 
> call             3  -none- call 
> asy.var.coef  1600  -none- numeric 
> 
> > resid(ar(logrvar, aic=TRUE))
> NULL
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/Question-from-
> day2-beginner-tp2293221p2293221.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list