Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SSE model type #735

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Add SSE model type #735

wants to merge 13 commits into from

Conversation

barrettk
Copy link
Collaborator

@barrettk barrettk commented Jan 27, 2025

Add support for SSE analysis

  • A lot of the bootstrap and SSE setup is the same, so this PR refactors bootstrap related functions to related analysis functions. Any change in handling is then defined in the corresponding new_[analysis]_run, setup_[analysis]_run, etc functions.

Example

devtools::load_all()
source("tests/testthat/setup-workflow-ref.R", echo=FALSE)
source("tests/testthat/helpers-create-example-model.R", echo=FALSE)

# New model with MSF saved out
mod2 <- copy_model_from(MOD1, "2") %>% update_model_id()
mod2 <- add_msf_opt(mod2) # helper function from `helpers-create-example-model.R`
submit_model(mod2, .mode = "local")

# Define N number of simulations
N_SIM <- 20

# Simulate data - can also test with mrgsolve
add_simulation(mod2, n = N_SIM, .mode = "local", .overwrite = T)
sim_data <- nm_join_sim(mod2)

# new SSE run
# mod2 <- read_model(file.path(MODEL_DIR, "2"))
sse_run <- new_sse_run(mod2)

sse_run <- setup_sse_run(
  sse_run,
  data = sim_data,
  strat_cols = "SEX",
  n = N_SIM,
  sample_size = 30,
  sim_col = "nn" # IREP for mrgsolve
)

# Print to console to view SSE specifications
sse_run

# Submit and get status
submit_model(sse_run)
get_model_status(sse_run)

# Summarize
summarize_sse_run(sse_run) # I think we need more info here
sse_estimates(sse_run)

 - new setup and handling "analysis" functions meant to be used with bootstrap and SSE analyses.

 - prepare for SSE setup inclusion (prototype)
 - summarization is incomplete
 - update to use new spec names
 - Doing it early so CI is valuable
 - pull logic out of nmboot method since sse and bootstrap methods are identical
 - so we can use the same function to create a fake sse or bootstrap run
 - update docs and NAMESPACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant