[R] Can I build an array of regrssion model?

Thomas Lumley tlumley at u.washington.edu
Thu Dec 19 18:14:55 CET 2002


On Thu, 19 Dec 2002, Zhongming Yang wrote:

> Thanks,
>
> But why I can't draw regression line with the following code:
>
> rawData = scan("c:/zyang/mass/data/A01/1.PRN",
> what=list(numeric(),numeric()));
> len = length(rawData[[1]]);
> mod = lm(rawData[[2]]~bs(rawData[[1]],10,degree=1));
> plot(rawData[[1]],rawData[[2]],type='l', col="green", xlab="Da/z",
> ylab="m/z");
> abline(mod,col="red");
>

Because that's not what abline does.  It draws a straight line, not a
piecewise linear regression curve.

You might find termplot() useful.

	-thomas




More information about the R-help mailing list