# Re: [R] Help

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Fri 09 Dec 2005 - 13:14:10 EST

How do you propose to forecast? If it were me, I'd first worry about what to use to model, then the forecasting. I'd start with normal probability plots to make sure I didn't have any outliers, need a transformation, etc. If all looked plausibly normally distributed, I might first fit a linear regression model using "lm", then do "acf" and "pacf" of the residuals, select a time series model for the residuals, and fit the full model using "arima". The output from "arima" is a list, one of whose components is "residuals", which are the one-step ahead forecast errors. To compute the one-step ahead predictions, I believe you just subtract those from the observations. However, there is also a "predict" function that has an "arima" method, and I would use that to spot-check the numbers to make sure I understood.

Do you have Venables and Ripley (2000) Modern Applied Statistics with S, 4th ed. (Springer)? If you aren't already familiar with the chapter in that book on time series, I suggest you start there.

If you'd like further help from this group, I suggest you first PLEASE do read the posting guide!
"www.R-project.org/posting-guide.html": Anectotal evidence suggests that questions that follow more closely the recommendations in the posting guide tend to get more useful answers quicker.

```	  hope this helps.
spencer graves

```

Sumanta Basak wrote:

> Hi R-Users,
>
>
>
> I apologize if it is too simple question for all. I have a multivariate
> dataset having 7 variables as independent and 1 dependent variable. 248
> data points are there. I want to do out sample forecast first
> considering 156 points. So I'll have to start from 157th point and
> calculate the 157th y_hat value. In this way it will go to 248th data
> point. Can any one tell me how I can do with for loop. Thanks a lot in
>
>
>
>
>
> Thanks & Regards,
>
> SUMANTA BASAK.
>
>
> -------------------------------------------------------------------------------------------------------------------
> This e-mail may contain confidential and/or privileged infor...{{dropped}}
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help

```--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

spencer.graves@pdf.com
www.pdf.com <http://www.pdf.com>
Tel:  408-938-4420
Fax: 408-280-7915

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help