Fixed error in column order that invalidated results

The columns for competitor drugs were placed in the wrong spot.
exploring_fixed_effects
Will King 1 year ago
parent c1ebd42639
commit be77d1d38a

File diff suppressed because it is too large Load Diff

@ -239,14 +239,14 @@ cf_categories <- df_counterfact_base$category_id
################################# FIT MODEL #########################################
inherited_cols <- c(
"elapsed_duration"
#,"identical_brands"
#,"brand_name_counts"
,"identical_brands"
,"brand_name_counts"
,"h_sdi_val"
,"hm_sdi_val"
,"m_sdi_val"
,"lm_sdi_val"
,"l_sdi_val"
,"status_NYR"# TODO: may need to remove
,"status_NYR"
,"status_EBI"
,"status_Rec"
,"status_ANR"
@ -406,7 +406,8 @@ Plan: select all snapshots that are the first to have closed
enrollment (Rec -> ANR when comparing across snapshots), and then
```{r}
#delay intervention
intervention_enrollment <- x_cf_base[c(inherited_cols,"brand_name_counts", "identical_brands")]
intervention_enrollment <- x_cf_base[c(inherited_cols)]
#TOFIX: ^^^ This ordering of columns is
intervention_enrollment["status_ANR"] <- 0
intervention_enrollment["status_Rec"] <- 1
```
@ -581,7 +582,7 @@ sum(df5$snapshot_count)
```{r}
################################# ANALYZE #####################################
print(fit)
#print(fit)
```
# Parameter Distributions
@ -672,6 +673,7 @@ generated_ib <- gqs(
)
```
### Get priors
```{r}
df_ib_p <- data.frame(
p_prior=as.vector(extract(generated_ib, pars="p_prior")$p_prior)
@ -687,10 +689,10 @@ df_ib_prior <- data.frame(
ggplot(df_ib_p, aes(x=p_prior)) +
geom_density() +
labs(
title="Implied Prior Distribution P"
title="implied prior distribution p"
,subtitle=""
,x="Probability Domain 'p'"
,y="Probability Density"
,x="probability domain 'p'"
,y="probability density"
)
ggsave(paste0(image_dist_diff_analysis,"/prior_p.png"))
@ -698,9 +700,9 @@ ggsave(paste0(image_dist_diff_analysis,"/prior_p.png"))
ggplot(df_ib_p, aes(x=p_predicted)) +
geom_density() +
labs(
title="Implied Posterior Distribution P"
title="implied posterior distribution p"
,subtitle=""
,x="Probability Domain 'p'"
,x="probability domain 'p'"
,y="Probability Density"
)
ggsave(paste0(image_dist_diff_analysis,"/posterior_p.png"))
@ -1219,4 +1221,4 @@ for (i in 1:3) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save