[R] Question from day2 beginner

Patrick Burns pburns at pburns.seanet.com
Mon Jul 19 10:21:03 CEST 2010


Try:

ar(logrvar, aic=TRUE)$resid

The problem you are running into is that
'resid' is a generic function, and the 'ar'
function neither returns an object with a
class nor returns an object that the default
method works with.

The 'summary' command you used might have
instead used 'str'.

The 'hints' document mentioned in my signature
might help you with such questions.

Welcome to the R world.

On 18/07/2010 18:16, maxcheese wrote:
>
> 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

-- 
Patrick Burns
pburns at pburns.seanet.com
http://www.burns-stat.com
(home of 'Some hints for the R beginner'
and 'The R Inferno')



More information about the R-help mailing list