There's not much more to ask than what I've written in the title.
Some of the values I want to predict are outside of the range used to build the regression model.
There's not much more to ask than what I've written in the title.
Some of the values I want to predict are outside of the range used to build the regression model.
You can use the predict
function. Try:
set.seed(123)
x <- 1:10
y <- -2 + 3 * x + rnorm(10)
our_data <- data.frame(y = y, x = x)
our_model <- lm(y ~ x, data = our_data)
predict(our_model, newdata = data.frame(x = 20))
Once your model and its parameters are fixed, there's only one way to do it: plug in the covariate values of the point you want to extrapolate at.