[R] Newbie's question about lm

Mark Difford mark_difford at yahoo.co.uk
Thu Jul 17 23:30:00 CEST 2008


Hi Ptit,

>> I would like to fit data with the following formula :
>> y=V*(1+alpha*(x-25))
>> where y and x are my data, V is a constant and alpha is the slope I'm
>> looking for.

Priorities first: lm() or ordinary least-square regression is a basically a
method for finding the best-fitting straight line through a set of points
(assuming that x is measured without error). So lm() determines the slope;
it's usually what you are trying to estimate.

Perhaps you are after abline:
?abline

You can feed this coefficients (i.e. your intercept and slope), and then
plot over an existing scatterplot.

##
plot(x,y)
abline(a=intercept, b=slope)  ## or: abline(coef=c(intercept, slope))

HTH, Mark.


Ptit_Bleu wrote:
> 
> Hello,
> 
> I would like to fit data with the following formula :
> y=V*(1+alpha*(x-25))
> where y and x are my data, V is a constant and alpha is the slope I'm
> looking for.
> 
> How to translate this into R-language ?
> At the moment, I only know : lm(y ~ x)
> 
> Sorry for such a basic question. I thought I could find the solution in a
> post but I have to confess that, up to know, I'm not able to understand
> the posts I read concerning lm (the level of the questions are too high
> for me and my english quite poor as well).
> 
> Have a nice evening,
> Ptit Bleu. 
> 

-- 
View this message in context: http://www.nabble.com/Newbie%27s-question-about-lm-tp18511262p18517239.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list