# Re: [R] Newbie's question about lm

From: Mark Difford <mark_difford_at_yahoo.co.uk>
Date: Thu, 17 Jul 2008 14:30:00 -0700 (PDT)

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.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help