[R] [Q] How to fit data to "HORIZONTAL" line

Young-Jin Lee youngjin.michael at gmail.com
Fri Oct 20 02:16:55 CEST 2006


Dear R users

I posted a question about how to fit data to a "straight" line this
afternoon. But I realized that my question was not correct because I
needed to fit data to a "HORIZONTAL" line, not a ordinary straight
line.

I looked at lm method, but could not figure out how to fix the
regression coefficient to "0". I also tried nls, but it did not work.

The reason I wanted to fit the data to a horizontal line is that I
want to compare AIC/BIC values of two models (a simple straight line
mode vs a nonlinear curve model). I thought that I can call
aic(horizontal_fit_model) and aic (nonlinear_fit_model) to achieve
this goal.

If I can compute AIC/BIC value of a horizontal fit model without doing
acutal fitting, that would be fine, too.

Thank in advance.

Young-Jin



More information about the R-help mailing list