Reprex:
library("mmrm")
fit <- mmrm(
formula = FEV1 ~ RACE + SEX + ARMCD * AVISIT + us(AVISIT | USUBJID),
data = fev_data
)
predict(fit, subset(fev_data, select = - FEV1))
fails with:
Error in eval(predvars, data, env) : object 'FEV1' not found
because h_mmrm_tmb_data() is invoked and this uses the full_formula which includes the response variable from the fit.
Reported originally in vincentarelbundock/marginaleffects#1000 (comment)