I am trying to predict a single variable in R, I have tried everything but I still get no result.
I am using the Auto data and I build a model like that
my_acc<-auto_df$acceleration
my_horse<-auto_df$horsepower
mydata <- data.frame(my_acc, my_horse )
car_linear_regression <- lm(my_acc ~ my_horse, mydata )
then I go on and I want to predict the following:
What is the predicted acceleration
associated with a horsepower
of 93.5? What are the associated 99% confidence and prediction intervals?
I use the following code and I get a warning
Warning: 'newdata' had 1 row but variables found have 392 rows
but also prints out all the rows in the dataframe while I am suposed to get only one back.
can someone help?
predict(car_linear_regression,newdata = data.frame(horsepower = 93.5))
