I want to make predictions with differents models in the same data using the package MortalityLaws. I have the model's names in a data frame as follow
models <- data.frame(models=c("model1", "model2", "model3"))
where
age <- 45:75
Dx <- ahmd$Dx[paste(x), "1950"]
Ex <- ahmd$Ex[paste(x), "1950"]
model1 <- MortalityLaw(x = age, Dx = Dx, Ex = Ex, law = 'quadratic')
model2 <- MortalityLaw(x = age, Dx = Dx, Ex = Ex, law = 'kannisto_makeham')
model3 <- MortalityLaw(x = age, Dx = Dx, Ex = Ex, law = 'ggompertz')
I use the follow function
prediction_model1 <- predict(models$models[1] , x=80:110)
To make predictions for the first model, but it doesn´t make predictions.
How can I solve my problem?