[R] Force regression line to a 1:1 relationship
RCulloch
ross.culloch at dur.ac.uk
Tue Sep 13 13:03:27 CEST 2011
Hello,
I appreciate this is likely to be an easy question. I am trying to obtain
the residuals from a linear regression where the line is forced to have a
1:1 relationship.
An example of the data:
A<-c(0.9803922, 1.3850416, 0.8241758, 0.0000000, 0.4672897, 1.1904762,
0.0000000, 0.9456265,
1.5151515)
B<-c(1.3229572, 1.9471488, 1.3182674, 0.7007708, 1.0185740, 1.0268562,
0.8695652, 0.3016591, 1.9667171)
plot(A, B, ylim=c(0,2), xlim=c(0,2))
abline(0,1, col="lightgrey", lty="dashed",lwd=2)#1:1 relationship = what I
want to use in the lm()
#Normal regression
AB<-lm(A~B)
#plot regression line
abline(lm(AB))
How can I force the regression to have a 1:1 relationship, I assume it is to
do with offset() but I have somewhat fried my brain trying numerous
variations and I am not convinced any are correct. I was also hoping the
plot function would show me that the calculation is correct, but any time I
use the offset() command there is no line plotted?
Any hints or tips would be much appreciated!
Ross
--
View this message in context: http://r.789695.n4.nabble.com/Force-regression-line-to-a-1-1-relationship-tp3809733p3809733.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list