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

categorized update and discrepancy metric #5

Open
hyunjimoon opened this issue Dec 31, 2021 · 0 comments
Open

categorized update and discrepancy metric #5

hyunjimoon opened this issue Dec 31, 2021 · 0 comments

Comments

@hyunjimoon
Copy link
Collaborator

hyunjimoon commented Dec 31, 2021

Can be applied to Regression (external feature), time series (external + internal feature), casual models it is regression example.

A. categorized update
We need to categorized the update types which can be seen from below can be largely divided into three: predictor set, distributional family of both outcome and predictor, model structure (i.e. hierarchical model - most related to DAG),
U1. predictor update

  1. y ~ sqrt_roach1 + treatment + senior (stan_glmp)
  2. y ~ treatment + senior
  3. y ~ sqrt_roach1 + senior
  4. y ~ sqrt_roach1 + treatment

U2. distributional family update
5. update(stan_glmp, family = neg_binomial_2)
6. y ~ sqrt_roach1 + treatment + senior + offset(log(exposure2)), zi ~ sqrt_roach1 + treatment + senior + offset(log(exposure2))), family=zero_inflated_negbinomial(),

U3. random effect (hierarchical model) update
7. y ~ sqrt_roach1 + treatment + senior + (1 | id)

B. Model discrepancy metric
can be computed with SBC::compute_results and calibration plot feature can be easily added as can be seen https://hyunjimoon.github.io/SBC/articles/implementing_backends.html


# feature
1. simple <- outcome ~ rx
2. complex <- outcome ~ rx + site + gender + age + risk

# prior
3. complex_narrow: intercept_prior_loc = 3, intercept_prior_width = 0.5, predictor_prior_loc = c(-2, 2), predictor_prior_width = 0.5)

backend_indo_simple <- SBC_backend_glm(formula = formula_indo_simple, family = "binomial") 
backend_indo_complex <- SBC_backend_glm(formula = formula_indo_complex, family = "binomial") 

datasets_simple <- generate_datasets(SBC_generator_function(
  generator_single_logistic, 
  formula = simple,
  dataset = medicaldata::indo_rct),
  n_datasets = 500) 

# Model discrepancy metric
discrepancy <- function(A,B) {(compute_results(datasets_A, backend_B)$dist + compute_results(datasets_B,backend_A)$dist)/2}

simple-complex <- discrepancy(indo_simple, indo_complex) 
simple-simple_narrow <- discrepancy(simple_narrow, simple)
complex-complex_narrow <- discrepancy(complex_narrow,complex)

## might need centering with self-discrepancy
complex-complex <- discrepancy(complex, complex)

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

No branches or pull requests

1 participant