Re: [R] LM with summation function

2012-05-23 Thread Robbie Edwards
- data.frame(x = 1:12) e - merge(e, d, all.x = T) e - within(e, {z3 - cumsum(x^3) z2 - cumsum(x^2) z1 - cumsum(x)}) coef(lm(s ~ 0 + z1 + z2 + z3, data = e)) # z1 z2 z3 # 100 10 -1 Peter Ehlers On 2012-05-22 09:43, Robbie Edwards wrote: I

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
points to help define the parameters of the curve. thanks again and hopefully this makes the problem a bit clearer. robbie On Fri, May 18, 2012 at 7:40 PM, David Winsemius dwinsem...@comcast.netwrote: On May 18, 2012, at 1:44 PM, Robbie Edwards wrote: Hi all, I'm trying to model some data

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
the y vector by doing c(s[1], diff(s)) which is identical to y. So for your data, the underlying y must have been c(109, 1091, 4125, 2891) right? Or have I completely misunderstood your problem? Michael On Tue, May 22, 2012 at 12:25 PM, Robbie Edwards robbie.edwa...@gmail.com wrote

[R] LM with summation function

2012-05-18 Thread Robbie Edwards
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. 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,