Plotting Regression

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.

If nothing else we need some sample data

Thank you so much! I realize now I forgot to attach the dataset! I have forgotten so much due to having contracted a severe illness. I feel so silly now. Thank you again.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.