[R] lm() question

From: Ranney, Steven <steven.ranney_at_montana.edu>
Date: Wed, 02 Jul 2008 20:43:57 -0600

I have data that looks like

YC      Age	Num
82	11	2
83	10	0
84	9	8
85	8	21
86	7	49
87	6	18
88	5	79
89	4	28
90	3	273
91	2	175

with a program

mod1=lm(log(Num+1)~YC, data=box44)
plot(log(Num+1)~YC, data=box44, pch=19, xlab="Year Class",

    ylab="Loge Number at age", ylim=c(0,6), xlim=c(91,82)) abline(lm(log(Num+1)~YC), col="blue", lwd=2) summary(mod1)

I need to regress log(Num+1) against YC, but in descending (91 - 82) order so as to get a negative slope and positive intercept. I can plot the values such that the regression line appears correct (the xlim statement), but I can't figure out how to force the regression from YC 91 through 82. A call to the rev() function in front of YC does not produce the results I'm looking for.

More than likely, I'm overlooking something. Thanks for any help you can provide.


Steven H. Ranney
Graduate Research Assistant (Ph.D)
USGS Montana Cooperative Fishery Research Unit Montana State University
PO Box 173460
Bozeman, MT 59717-3460

phone: (406) 994-6643
fax: (406) 994-7479

        [[alternative HTML version deleted]]

R-help_at_r-project.org 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. Received on Thu 03 Jul 2008 - 02:47:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jul 2008 - 14:31:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive