generated from ecohealthalliance/container-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
little script to combine fits given targets failed for a few
- Loading branch information
Morgan Kain
authored and
Morgan Kain
committed
Mar 1, 2024
1 parent
97e0def
commit 2b2db21
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
fits_to_load <- list.files("_targets/objects") | ||
fits_to_load <- fits_to_load[-c(1:9)] | ||
fits_to_load <- fits_to_load[-c(506:510)] | ||
|
||
for (i in seq_along(fits_to_load)) { | ||
temp_name <- fits_to_load[i] | ||
tar_load(temp_name) | ||
sorted_out <- sort_stan_fits(stan_fits.l = get(temp_name) %>% list()) | ||
|
||
temp_sort <- summarize_stan_fits_for_pub( | ||
model_fits = sorted_out | ||
, param_sets = sim.params | ||
, simulated_data = sim.data | ||
, complexity = data_complexity | ||
) | ||
|
||
rm(list=grep("stan_fits.l_",ls(),value=TRUE,invert=FALSE)) | ||
|
||
if (((i / 10) %% 1) == 0) { gc() } | ||
|
||
if (i == 1) { | ||
final_sort <- temp_sort | ||
} else { | ||
final_sort$coef <- rbind(final_sort$coef, temp_sort$coef) | ||
final_sort$group_pred <- rbind(final_sort$group_pred, temp_sort$group_pred) | ||
final_sort$prop_seropos <- rbind(final_sort$prop_seropos, temp_sort$prop_seropos) | ||
} | ||
|
||
print(i) | ||
|
||
} | ||
|
||
saveRDS(list( | ||
sim.params = sim.params | ||
, sim.data = sim.data | ||
, all.out = all.out | ||
, group_assignment = group_assignment | ||
, three_sd.groups = three_sd.groups | ||
, mculst.groups = mculst.groups | ||
, stan.summary = stan.summary | ||
, mculst.groups.regression.summary = mculst.groups.regression.summary | ||
, three_sd.groups.regression.summary = three_sd.groups.regression.summary | ||
, pop_seropositivity = pop_seropositivity | ||
), "test_fits.Rds") | ||
|
||
|
||
|