I'm getting confused with the concept R uses to do regression using lm.
I'm afmiliar with gnuplot and the build-in fit command, but couldn't get
R's lm to work on my data.
I know that my data follows a powerlaw or maybe an exponential function,
and I'd like to determine the best fitting factors for the formula:
a*x^b where b < 0.
I've tried thge follwoing:
s <- lm(y ~ x)
lm(formula = y ~ x)
Min 1Q Median 3Q Max
-18.454 -7.577 -2.861 3.909 60.988
Estimate Std. Error t value Pr(>|t|)
(Intercept) 21.209171 1.431472 14.816 < 2e-16 ***
x -0.065609 0.008799 -7.456 7.45e-12 ***
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Residual standard error: 11.87 on 145 degrees of freedom
Multiple R-Squared: 0.2772, Adjusted R-squared: 0.2722
F-statistic: 55.6 on 1 and 145 DF, p-value: 7.454e-12
What has R done? I assume the formula is just a+b*x and I can get a and
s <- lm(y ~ a*x^b)Error in terms.formula(formula, data = data) :
invalid power in formula
I went through the formula section of the R-manual, but I realy don't
Finally, I'd like to have the raw data-points together with a line
representing the function used to fit the data in a plot? How can I plot
function, e.g. sin(x) ?
I hope I just need a primer on this to get going.
thanks very much for any help,
Biomolecular Modelling Laboratory
Imperial Cancer Research Fund
44 Lincoln's Inn Fields
London WC2A 3PX, U.K.
phone : +44-(0)207 2693405 | fax :+44-(0)207-269-3534
email : a.mueller at icrf.icnet.uk | http://www.bmm.icnet.uk
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch