Skip to content

Instantly share code, notes, and snippets.

@seabbs
Created December 20, 2017 22:46
Show Gist options
  • Save seabbs/13dfd542fa68183cf2d81129ce139c2e to your computer and use it in GitHub Desktop.
Save seabbs/13dfd542fa68183cf2d81129ce139c2e to your computer and use it in GitHub Desktop.
Compare nested multiply imputed models
## Likelihood test p values for categorical variables
model_uni <- outcomes %>% map(function(.) model_outcome_uni(., variable = 'ageatvac', LRT = TRUE))
model_adj <- outcomes %>% map(function(.) model_outcome_adj(., variable = 'ageatvac', LRT = TRUE))
ageatvac_lrt_uni <- map2(model_ageatvac_uni, model_uni, function(x, y) pool.compare(x, y, data = imp_df, method = "likelihood")) %>%
map(function(x) ifelse(x < 0.001, "0.001", pretty_round(x, digits = 3)))
ageatvac_lrt_adj <- map2(model_ageatvac_adj, model_adj, function(x, y) pool.compare(x, y, data = imp_df, method = "likelihood")$pvalue) %>%
map(function(x) ifelse(x < 0.001, "0.001", pretty_round(x, digits = 3)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment