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

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Feb 1 20:38:58 CET 2010

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 ...


Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the R-help mailing list