0

I have plotted the scatter plot below using the following scripts but still need to obtain the regression coefficient.

Any help would be very much appreciated.

lm.irt12 <- lm(prtemp ~ irt12,data=apirt)
summary(lm.irt12)
plot(apirt$irt12[apirt$surv==1],
     apirt$prtemp[apirt$surv==1],
     xlab="ave. base of ears (°C)",
     ylab="rectal (°C)",
     xlim=c(26,42),
     ylim=c(30,42),
     col='blue')
points(apirt$irt12[apirt$surv==0], apirt$prtemp[apirt$surv==0],col='red')
abline(lm.irt12)
abline(h=36,v=0, col="gray10",lty=20)
#col = "gray60" OR col = "lightgray", lty=3; #(lty=3: broken line, 1:continuous)
text(26.7,36.7,parse(text='36*degree'),col='gray10')
abline(h=34,v=0, col="gray10",lty=20)
#col = "gray60" OR col = "lightgray", lty=3; #(lty=3: broken line, 1:continuous)
text(26.7,34.7,parse(text='34.0*degree'),col='gray10')

enter image description here

baz
  • 6,817
  • 11
  • 36
  • 37
  • 1
    Your second line of code should return the coefficients. Also, `coef(lm.irt12)`. – jbaums Oct 03 '14 at 08:36
  • @jbaums: many thanks for your help! You are right, summary(lm.irt12) gave me the same coefficients. – baz Oct 03 '14 at 15:41

1 Answers1

1

You just have to get the coefficient parameter of your linear model object lm.irt12:

lm.irt12$coefficients

To see the parameter of R objects, you can do:

str(lm.irt12)
Pop
  • 12,135
  • 5
  • 55
  • 68