I'm trying to interpolate the missing data point using lmer model prediction.
Subsetting to a table without any na to the missing column of interest:
table1 <- df %>% filter(!is.na(Average)) # df includes missing na value as well
Creating the model ( I have a longitudinal experiment with 4 measurements per subject and age has a contribution. I'm using age at baseline for all four meas. and am looking for the individual slope and intersection):
mod <- lmer(Average ~ time + Age + (time | subject), table1)
I'm then filling only the missing meas. with the predicted ones:
table2 <- df %>% mutate(pred = predict(mod,allow.new.levels=TRUE, .)) %>% mutate(Average = ifelse(is.na(Average), pred, Average))
The problem is, the predicted values don't seem to maintain the trend (decrease) I was expecting and in many cases even turn it into an increasing trend..
Should I use other prediction models? other interpolation methodology?