The horizontal line can be fitted by lm(y ~ 1). Andy
From: Young-Jin Lee > > 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 > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > ------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}} ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
