This sounds a little bit like homework (since you know the actual model), so I'll just point you in the right direction:
I'd do something like: n <- 2^(1:10) y <- 2*n^2 - 5*n + 3 dtf <- data.frame(y = y, n=n) lm( **********, data = dtf) The ***** should be replaced by a "formula" object: to find the syntax for those, just google around or read ?formula and the examples of ?lm. The help pages are a little opaque (very good, just not super beginner friendly) but the easiest way to set up formulas is + includes a term : includes just a cross term * includes a cross term and the individual terms (i.e., A*B = A + B + A:B) - removes a term. That should help you set things up. Hope this helps, Michael On Sat, Mar 31, 2012 at 10:03 AM, Jaymin Shah <jayminsh...@hotmail.com> wrote: > Hi, > > I have a polynomial of 2n^2-5n+3 and I have my n values going up in powers of > 2 i.e. n=2,4,8,16….. > > I wanted to fit this curve to the function A*n*log2(n) +B*n where A and B are > to be found. > > How would i do this? > > Thank you > > > Jaymin > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.