# [R] One-parameter fitting

Wed Jul 3 16:17:44 CEST 2013

```Hello,

Try ?mean

abline(h = mean(y), col = "blue")

Hope this helps,

Em 03-07-2013 15:07, Birdada Simret escreveu:
> Greetings to every body.
>
> we know that for linear regression: two-parameter fitting in R: (for a and
> b as slope and intercept)
>
> [a] for y=ax+b type models we use: lm(y~x)
> [b] for y=ax    type models we use:  lm(y~0+x)  => forced to pass through
> origin
>
> Now I have question:   what about y=b  fitting?  is there any model to
> force or  impose the ax to be zero
>
> Let say
>
> x <- c(1,2,3,4,5,6,7,8,9)
> y <- c( 0.853,0.852, 0.854, 0.858, 0.862, 0.856, 0.858, 0.857, 0.863)
> plot(y~x, xlim=c(0,10), ylim=c(0,1))
> abline(lm(y~x),col="blue")  # this doesn't give exact horizontal  but
> slightly inclined.
>
> or is it as simple as, just find the intercept using the lm(y~x) , then
> abline(h=intercept,col="red") ?
>
> any comment or advice is greatly appreciated ;)
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help