I am running model predictions / scenario analysis as per the manual and was wondering if there is a way to combine results as I have ~30/40 scenarios to run.
The default “summary” argument/ setting for apollo_prediction saves the mean, SD and 95%CI which is the information from each scenario I would like to combine. I tried to save each new prediction as a different name (e.g. from predictions_new to Scenario1.1, Scenario 1.2... etc.) and combine later, but apollo_prediction saves the output as a list (as opposed to an R object) which I cannot combine into a table.
I appreciate there might be lots of ways to do this (for the programming expert) for example via creating a loop but this is very difficult to specify all the scenarios in a loop. I would prefer to change the output of apollo_prediction (means, SDs and 95%CIs) into an R object for each scenario (named separately) from which I can work out how to combine into a table. Is there a way to change the output of apollo_prediction do this?
Code: Select all
#Example scenarios
#SCENARIO 1.1
predictions_base = apollo_prediction(model, apollo_probabilities, apollo_inputs,
prediction_settings=list(runs=50))
database_backup=database
database$DrugA_CERT <- 1 #first scenario
apollo_inputs = apollo_validateInputs()
predictions_new = apollo_prediction(model, apollo_probabilities, apollo_inputs,
prediction_settings=list(runs=50))
database=database_backup
apollo_inputs = apollo_validateInputs()
#SCENARIO 1.2
predictions_base = apollo_prediction(model, apollo_probabilities, apollo_inputs,
prediction_settings=list(runs=50))
database_backup=database
database$DrugA_CERT <- 1 #second scenario
apollo_inputs = apollo_validateInputs()
predictions_new = apollo_prediction(model, apollo_probabilities, apollo_inputs,
prediction_settings=list(runs=50))
database=database_backup
apollo_inputs = apollo_validateInputs()
#28 more scenarios etc…
Code: Select all
predictions_overview=rbind(table(database$choice)/nrow(database),
colMeans(predictions_base),
colMeans(predictions_new))
rownames(predictions_overview)=c("Data",
"predictions_base",
"predictions_new")
print(round(predictions_overview,4))