I'm still learning R, and I cannot find a solution to my problem. I have constructed a regression model that has for regressand the average wage of an individual and for regressors its age, years of education, and IQ score. I based my regression on the data "wage2" from the package Wooldridge. I would like to predict the average change (I assume it will be a reduction) in wages considering a 4 years reduction in years of education. Any idea how I could do that using the function predict()? To begin with, I tried to assess the accuracy of my model by predicting the wage given a specific value of 'years of education' (12 years), but I am getting an error: "Error in eval(predvars, data, env) : object 'age' not found". You can see my code below:
library(Wooldridge) data("wage2") model1 <- lm(wage ~ age + educ + IQ, data = wage2) predict(model1, data.frame(educ = 12))
Can anyone help me?