[R] iterative regressions, adding a new line of data each time

Rolf Turner r.turner at auckland.ac.nz
Mon Feb 1 20:43:38 CET 2010


On 2/02/2010, at 8:38 AM, Steve Lianoglou wrote:

> On Mon, Feb 1, 2010 at 2:16 PM, Rolf Turner <r.turner at auckland.ac.nz> wrote:
>> 
>> On 31/01/2010, at 12:14 PM, ace834 wrote:
>> 
>>> 
>>> Hi, I am pretty new to R. I'm trying run a regression repeatedly, adding a
>>> new data point each time, and then storing the predicted Y values. For
>>> example, let's say I have 500 data points and I run the regression. I would
>>> then like to store the Y value, run the regression again using 501 data
>>> points, store the new Y, run the regression with 502 data points, store the
>>> Y, and so on. What I would like is a new object that has all of the
>>> predicted Y values.  I'm using time series data, and I'm running a
>>> multivariable regression.  Any help would be greatly appreciated.  Thanks.
>> 
>> 
>> This would seem to be very easy to do using a for loop and a list.
> 
> And what sounds like a perfect opportunity for the OP to learn how to
> use `lapply` to make this happen ...

It's not at all clear to me that lapply() is the appropriate tool here.
I.e. I can see a very simple syntax for a for loop construction, but not
for a lapply() construction.

I stand to be corrected, but.

	cheers,

		Rolf Turner
######################################################################
Attention: 
This e-mail message is privileged and confidential. If you are not the 
intended recipient please delete the message and notify the sender. 
Any views or opinions presented are solely those of the author.

This e-mail has been scanned and cleared by MailMarshal 
www.marshalsoftware.com
######################################################################



More information about the R-help mailing list