Re: [R] LM with summation function

2012-05-23 Thread Robbie Edwards
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 don't think I can. >> >> For the sample data >> >> d

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
3 = 6 + s2 = 11 > > more generally > > s <- cumsum(y) > > Then if we only see s, we can get back 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) rig

Re: [R] LM with summation function

2012-05-22 Thread Robbie Edwards
d to use a few sample 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 wrote: > > On May 18, 2012, at 1:44 PM, Robbie Edwards wrote: > > Hi all, >> >&

[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, sin