dd <- read.table(file="Cholesterol.txt",header=T) attach(dd) Y <- Cholesterol res <- lm(Y ~ State + Age) t.hat <- res$coefficients t.hat a1 <- t.hat[1] a2 <- t.hat[1] + t.hat[2] b <- t.hat[3] par(mai=c(0.5,0.5,0.1,0.1)) Iowa <- State == "Iowa" Nebr <- State == "Nebraska" plot(Age[Iowa],Y[Iowa],pch="+",xlim=c(18,78),ylim=c(100,355),xlab="",ylab="") points(Age[Nebr],Y[Nebr],pch="x") abline(a = a1, b = b, lwd=1, lty=3) abline(a = a2, b = b, lwd=1, lty=2)