diff --git a/r-analysis/EffectsOfEnrollmentDelay.qmd b/r-analysis/EffectsOfEnrollmentDelay.qmd index a8e27c2..5df7ec3 100644 --- a/r-analysis/EffectsOfEnrollmentDelay.qmd +++ b/r-analysis/EffectsOfEnrollmentDelay.qmd @@ -1083,7 +1083,7 @@ The simulation above shows that this results in a percentage-point change in ter #Get dataframe with only the rows of interest filtdata <- as.data.frame(extract(fit, pars="status_diff")) #rename columns -dimnames(filtdata)[[2]] <- beta_list$groups +dimnames(filtdata)[[2]] <- sprintf("%02d %s", seq_along(beta_list$groups), beta_list$groups) #create area plot with appropriate title mcmc_areas(filtdata,prob = 0.8, prob_outer = 0.95) + ggtitle("Differences in Fixed Effects | By ICD-10 Category", @@ -1092,9 +1092,10 @@ mcmc_areas(filtdata,prob = 0.8, prob_outer = 0.95) + geom_vline(xintercept=seq(-0.25,0.5,0.25),color="grey",alpha=0.750) ggsave(paste0(image_parameters_across_groups,"/fixed_effects_anr_vs_rec_by_group.png")) -d <- pivot_longer(filtdata, everything()) |> +fixed_effects_table <- pivot_longer(filtdata, everything()) |> group_by(name) |> summarize( + `sample size` = 0, mean = mean(value), `P(≥0)` = mean(value >= 0), `2.5%` = quantile(value, probs = 0.025), @@ -1106,18 +1107,26 @@ d <- pivot_longer(filtdata, everything()) |> `97.5%` = quantile(value, probs = 0.975) ) +# Convert the indexing to be consecutive by using a temporary vector +sample_sizes <- rep(0, 22) # Create vector of zeros +sample_sizes[category_count$category_id] <- category_count$n + +# Now assign the whole vector at once +fixed_effects_table["sample size"] <- sample_sizes # Rename the name column -names(d)[1] <- "ICD-10 Category" +names(fixed_effects_table)[1] <- "ICD-10 Category" # Convert to LaTeX -table <- xtable(d, - digits = rep(3, ncol(d) + 1), +table <- xtable(fixed_effects_table, + digits = rep(3, ncol(fixed_effects_table) + 1), floating = FALSE, - latex.environments = NULL, + align = "lccccccccccc", + latex.environments = "tabularx", booktabs = TRUE ) + # Write to file write_lines( print(table, include.rownames = FALSE), diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.png b/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.png index 6152266..e2b0f98 100644 Binary files a/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.png and b/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.png differ diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.tex b/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.tex index 84df176..8c4fb84 100644 --- a/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.tex +++ b/r-analysis/output/EffectsOfEnrollmentDelay/betas/parameter_across_groups/fixed_effects_anr_vs_rec_by_group.tex @@ -1,33 +1,33 @@ % latex table generated in R 4.4.2 by xtable 1.8-4 package -% Sun Feb 2 01:37:36 2025 +% Mon Feb 3 23:56:27 2025 \begin{table}[ht] \centering -\begin{tabular}{lrrrrrrrrr} +\begin{tabular}{ccccccccccc} \hline -ICD-10 Category & mean & P(≥0) & 2.5\% & 5\% & 25\% & 50\% median & 75\% & 95\% & 97.5\% \\ +ICD-10 Category & sample size & mean & P(≥0) & 2.5\% & 5\% & 25\% & 50\% median & 75\% & 95\% & 97.5\% \\ \hline -Blood \& Immune system & 0.061 & 0.624 & -0.333 & -0.267 & -0.071 & 0.061 & 0.194 & 0.388 & 0.454 \\ - Circulatory & 0.037 & 0.577 & -0.362 & -0.293 & -0.094 & 0.038 & 0.170 & 0.363 & 0.426 \\ - Congential & 0.063 & 0.628 & -0.332 & -0.264 & -0.068 & 0.063 & 0.195 & 0.391 & 0.456 \\ - Contact with Healthcare & 0.063 & 0.627 & -0.335 & -0.267 & -0.070 & 0.064 & 0.194 & 0.390 & 0.454 \\ - Digestive & 0.060 & 0.621 & -0.339 & -0.270 & -0.071 & 0.059 & 0.192 & 0.388 & 0.454 \\ - Ear and Mastoid & 0.063 & 0.625 & -0.332 & -0.263 & -0.069 & 0.064 & 0.196 & 0.393 & 0.457 \\ - Endocrine, Nutritional, and Metabolic & 0.177 & 0.820 & -0.201 & -0.137 & 0.045 & 0.173 & 0.304 & 0.505 & 0.573 \\ - External Causes & 0.063 & 0.625 & -0.330 & -0.266 & -0.070 & 0.064 & 0.194 & 0.392 & 0.460 \\ - Eye and Adnexa & 0.061 & 0.624 & -0.333 & -0.265 & -0.069 & 0.062 & 0.192 & 0.386 & 0.452 \\ - Genitourinary & 0.063 & 0.627 & -0.337 & -0.270 & -0.070 & 0.065 & 0.195 & 0.389 & 0.456 \\ - Infections \& Parasites & 0.135 & 0.772 & -0.223 & -0.163 & 0.013 & 0.134 & 0.257 & 0.438 & 0.498 \\ - Injury etc. & 0.063 & 0.625 & -0.337 & -0.268 & -0.069 & 0.062 & 0.196 & 0.392 & 0.459 \\ - Mental \& Behavioral & 0.142 & 0.767 & -0.239 & -0.175 & 0.010 & 0.140 & 0.270 & 0.469 & 0.537 \\ - Musculoskeletal & 0.159 & 0.794 & -0.218 & -0.156 & 0.027 & 0.156 & 0.286 & 0.482 & 0.550 \\ - Neoplasms & 0.211 & 0.902 & -0.107 & -0.056 & 0.099 & 0.208 & 0.320 & 0.489 & 0.546 \\ - Nervous System & 0.009 & 0.524 & -0.383 & -0.315 & -0.120 & 0.011 & 0.140 & 0.327 & 0.389 \\ - Perinatal Period & 0.062 & 0.626 & -0.338 & -0.270 & -0.068 & 0.062 & 0.194 & 0.390 & 0.457 \\ - Pregancy, Childbirth, \& Puerperium & 0.061 & 0.622 & -0.336 & -0.270 & -0.071 & 0.061 & 0.194 & 0.392 & 0.458 \\ - Respiratory & 0.061 & 0.622 & -0.335 & -0.269 & -0.072 & 0.061 & 0.195 & 0.391 & 0.458 \\ - Skin \& Subcutaneaous tissue & 0.104 & 0.704 & -0.283 & -0.220 & -0.027 & 0.103 & 0.234 & 0.429 & 0.494 \\ - Special Purposes & 0.062 & 0.625 & -0.335 & -0.268 & -0.070 & 0.062 & 0.194 & 0.391 & 0.456 \\ - Symptoms, Signs etc. & 0.062 & 0.625 & -0.332 & -0.265 & -0.069 & 0.062 & 0.194 & 0.390 & 0.456 \\ +01 Infections \& Parasites & 20.000 & 0.135 & 0.772 & -0.223 & -0.163 & 0.013 & 0.134 & 0.257 & 0.438 & 0.498 \\ + 02 Neoplasms & 49.000 & 0.211 & 0.902 & -0.107 & -0.056 & 0.099 & 0.208 & 0.320 & 0.489 & 0.546 \\ + 03 Blood \& Immune system & 1.000 & 0.061 & 0.624 & -0.333 & -0.267 & -0.071 & 0.061 & 0.194 & 0.388 & 0.454 \\ + 04 Endocrine, Nutritional, and Metabolic & 10.000 & 0.177 & 0.820 & -0.201 & -0.137 & 0.045 & 0.173 & 0.304 & 0.505 & 0.573 \\ + 05 Mental \& Behavioral & 8.000 & 0.142 & 0.767 & -0.239 & -0.175 & 0.010 & 0.140 & 0.270 & 0.469 & 0.537 \\ + 06 Nervous System & 8.000 & 0.009 & 0.524 & -0.383 & -0.315 & -0.120 & 0.011 & 0.140 & 0.327 & 0.389 \\ + 07 Eye and Adnexa & 11.000 & 0.061 & 0.624 & -0.333 & -0.265 & -0.069 & 0.062 & 0.192 & 0.386 & 0.452 \\ + 08 Ear and Mastoid & 0.000 & 0.063 & 0.625 & -0.332 & -0.263 & -0.069 & 0.064 & 0.196 & 0.393 & 0.457 \\ + 09 Circulatory & 3.000 & 0.037 & 0.577 & -0.362 & -0.293 & -0.094 & 0.038 & 0.170 & 0.363 & 0.426 \\ + 10 Respiratory & 7.000 & 0.061 & 0.622 & -0.335 & -0.269 & -0.072 & 0.061 & 0.195 & 0.391 & 0.458 \\ + 11 Digestive & 12.000 & 0.060 & 0.621 & -0.339 & -0.270 & -0.071 & 0.059 & 0.192 & 0.388 & 0.454 \\ + 12 Skin \& Subcutaneaous tissue & 9.000 & 0.104 & 0.704 & -0.283 & -0.220 & -0.027 & 0.103 & 0.234 & 0.429 & 0.494 \\ + 13 Musculoskeletal & 17.000 & 0.159 & 0.794 & -0.218 & -0.156 & 0.027 & 0.156 & 0.286 & 0.482 & 0.550 \\ + 14 Genitourinary & 2.000 & 0.063 & 0.627 & -0.337 & -0.270 & -0.070 & 0.065 & 0.195 & 0.389 & 0.456 \\ + 15 Pregancy, Childbirth, \& Puerperium & 0.000 & 0.061 & 0.622 & -0.336 & -0.270 & -0.071 & 0.061 & 0.194 & 0.392 & 0.458 \\ + 16 Perinatal Period & 0.000 & 0.062 & 0.626 & -0.338 & -0.270 & -0.068 & 0.062 & 0.194 & 0.390 & 0.457 \\ + 17 Congential & 3.000 & 0.063 & 0.628 & -0.332 & -0.264 & -0.068 & 0.063 & 0.195 & 0.391 & 0.456 \\ + 18 Symptoms, Signs etc. & 1.000 & 0.062 & 0.625 & -0.332 & -0.265 & -0.069 & 0.062 & 0.194 & 0.390 & 0.456 \\ + 19 Injury etc. & 0.000 & 0.063 & 0.625 & -0.337 & -0.268 & -0.069 & 0.062 & 0.196 & 0.392 & 0.459 \\ + 20 External Causes & 0.000 & 0.063 & 0.625 & -0.330 & -0.266 & -0.070 & 0.064 & 0.194 & 0.392 & 0.460 \\ + 21 Contact with Healthcare & 0.000 & 0.063 & 0.627 & -0.335 & -0.267 & -0.070 & 0.064 & 0.194 & 0.390 & 0.454 \\ + 22 Special Purposes & 0.000 & 0.062 & 0.625 & -0.335 & -0.268 & -0.070 & 0.062 & 0.194 & 0.391 & 0.456 \\ \hline \end{tabular} \end{table} diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/CategoryCounts.png b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/CategoryCounts.png index a4b8ab2..4968c4a 100644 Binary files a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/CategoryCounts.png and b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/CategoryCounts.png differ diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistSnapshots.png b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistSnapshots.png index 1a3c54b..7b5bbcd 100644 Binary files a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistSnapshots.png and b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistSnapshots.png differ diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistTrialDurations_Faceted.png b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistTrialDurations_Faceted.png index aa0e33b..f185f66 100644 Binary files a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistTrialDurations_Faceted.png and b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/HistTrialDurations_Faceted.png differ diff --git a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/SnapshotsVsDurationVsTermination.png b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/SnapshotsVsDurationVsTermination.png index 7a5399a..edb928d 100644 Binary files a/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/SnapshotsVsDurationVsTermination.png and b/r-analysis/output/EffectsOfEnrollmentDelay/trials_details/SnapshotsVsDurationVsTermination.png differ