# load "ChickWeight" dataset data(ChickWeight) # Create T | F vector indicating observations with Diet == "3" index <- ChickWeight$Diet == "3" # Create vector of "weight" for observations where Diet == "3" and Time == 20 pre <- subset(ChickWeight[index, ], Time == 20, select = weight)$weight # Create vector of "weight" for observations where Diet == "3" and Time == 21 post <- subset(ChickWeight[index, ], Time == 21, select = weight)$weight # The pre and post values are paired, each pair corresponding to an individual chick. cbind(pre, post) ```
(3)(c) (2 points) Present a scatterplot of the variable "post" as a function of the variable "pre". Include a diagonal line with zero intercept and slope equal to one. Title and label the variables in this scatterplot.
Please help, how do I include a line with zero intercepts and slope equal to one?
# load "ChickWeight" dataset
data(ChickWeight)
# Create T | F vector indicating observations with Diet == "3"
index <- ChickWeight$Diet == "3"
# Create vector of "weight" for observations where Diet == "3"
and Time == 20
pre <- subset(ChickWeight[index, ], Time == 20, select =
weight)$weight
# Create vector of "weight" for observations where Diet == "3" and Time == 21
post <- subset(ChickWeight[index, ], Time == 21, select = weight)$weight
##Scatterplot
plot(pre,post,col="red",xlab="Variable Pre",ylab="Variable
Post",
main="Scatterplot Pre~Post",pch=19)
Scatterplot Pre-Post CN CN 150 200 250 300 350 Variable Pre
Get Answers For Free
Most questions answered within 1 hours.