Question: Now make a new dataset where you have omitted data points that have residuals with standardized residuals greater than 3 or less than $-3$ (if

Now make a new dataset where you have omitted data points that have residuals with standardized residuals greater than 3 or less than $-3$ (if you get stuck on how to delete rows, google "r how to delete rows with conditions"). Reanalyze the data without these outlying observations. Have the basic conclusions changed, regarding whether the slope is 0 or not?

R code:

# read data from .csv file FullDataset <- read.table("fitness_data.csv", header=TRUE, sep=",") head(FullDataset)

# include only 2011 data SLRData11=FullDataset[FullDataset$season==11,]; # could also do it: # SLRData11=FullDataset[FullDataset[,3]==11,]

# omit columns we don't need SLRData11=SLRData11[,c(-1,-2,-4,-5)] # how many observations? nrow(SLRData11)

# standardize PACER and pushup score, based on max in dataset SLRData11$adjpacer=SLRData11$pacer/max(SLRData11$pacer); SLRData11$adjpushup=SLRData11$pushup/max(SLRData11$pushup);

# construct fitness index SLRData11$fit.index=SLRData11$adjbmi+SLRData11$adjpacer+SLRData11$adjpushup;

plot(SLRData11$academic~SLRData11$fit.index,ylab="Academic Score",xlab="Fitness Index")

# Fit the SLR model and store results in object "fitness.slr" fitness.slr = lm(academic ~ fit.index,data=SLRData11)

# Print the two regression parameter estimates: b0 and b1 print(fitness.slr) summary(fitness.slr) anova(fitness.slr)

confint(fitness.slr,,.95) # CI's for both parameters confint(fitness.slr,c(2),.95) # CI for only b1

# Prediction and inference for mean response and predictions new=data.frame(fit.index=c(1.5,2.4)) # new X's at which to predict new.predict=predict(fitness.slr,new) # prediction

# CI for mean response at X values given in 'new' predict(fitness.slr,new,interval="confidence",se.fit=TRUE)

# PI for predicted values at X values given in 'new' predict(fitness.slr,new,interval="prediction")

par(mfrow=c(2,2))

std.resid=rstandard(fitness.slr) std.resid[abs(std.resid)>3]

# examine SLRData11[c(151,294,550,658),]

How to solve this question by R code?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!