The first part of my code runs smoothly.
Here is the first part of my code taken from the Kutner data:
lmACT <- lm(CH03PR01$GPA ~ CH03PR01$ACT)
lmIS <- lm(CH03PR01$GPA ~ CH03PR01$Intelligence Score)
lmCRP <- lm(CH03PR01$GPA ~ CH03PR01$ClassRankPercent)
summary(lmACT)
summary(lmIS)
summary(lmCRP)
*The second part of my code only generates the first plot. This is the error code I receive: *
Error in [.data.frame(data, , 3) : undefined columns selected
Here is my code for the plots:
par(mfrow=c(1, 3))
plot(data[,1] ~ data[,2], main= "First Year GPA vs. ACT Score", xlab="ACT score", ylab="First Year GPA")
abline(lmACT, col="red")
plot(data[,1] ~ data[,3], main= "First Year GPA vs. Intel. Test Score", xlab="Intel. Test Score",
ylab="First Year GPA")
abline(lmIS, col="red")
plot(data[,1] ~ data[,4], main= "First Year GPA vs. H.S. Prec. Rank", xlab="Class Rank Percentile",
ylab="First Year GPA")
abline(lmCRP, col="red")
I hope I posted this correctly, and any help is much appreciated.