[R] LM with summation function

David Winsemius dwinsemius at comcast.net
Sat May 19 01:40:09 CEST 2012


On May 18, 2012, at 1:44 PM, Robbie Edwards wrote:

> Hi all,
>
> I'm trying to model some data where the y is defined by
>
> y = summation[1 to 50] B1 * x + B2 * x^2 + B3 * x^3
>
> Hopefully that reads clearly for email.
>

cumsum( rowSums( cbind(B1 * x,  B2 * x^2, B3 * x^3)))


> Anyway, if it wasn't for the summation, I know I would do it like this
>
> lm(y ~ x + x2 + x3)
>
> Where x2 and x3 are x^2 and x^3.
>
> However, since each value of x is related to the previous values of  
> x, I
> don't know how to do this.  Any help is greatly appreciated.
>
>


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list