# fit model
mod <- lm_imp(y ~ C1 + C2 + I(C2^2), data = wideDF, n.iter = 100)
# calculate the fitted values
fit <- predict(mod)
# create dataset for prediction
newDF <- predDF(mod, vars = ~ C2)
# obtain predicted values
pred <- predict(mod, newdata = newDF)
# plot predicted values and 95% confidence band
matplot(newDF$C2, pred$fitted, lty = c(1, 2, 2), type = "l", col = 1,
xlab = 'C2', ylab = 'predicted values')
Run the code above in your browser using DataLab