knitr::opts_chunk$set( cache = TRUE, eval = FALSE, echo = TRUE)
# packages library(tidyverse) library(metasim) library(kableExtra) library(dplyr) library(latex2exp) # set winners conflicted::conflict_prefer("filter", "dplyr") conflicted::conflict_prefer("group_rows", "kableExtra")
ss <- metasims(single_study = TRUE, trial_fn = singletrial) ma <- metasims()
ss %>% plot() ss %>% caption() ss %>% plot(caption = "test") ss %>% plot(caption = caption(.)) ss %>% plot(caption = TeX(caption(.)))
ss %>% plot()
trials <- 10 unequal_effect_ratio <- 1.2 k <- c(3, 7) tau_sq_true <- seq(0, 0.4, by = 0.2)
sim_parameter <- function(sim, arg){ sim %>% purrr::pluck("arguments") %>% dplyr::filter(argument == arg) %>% purrr::pluck("value") }
# parameters (unequal_effect_ratio <- sim %>% sim_parameter("unequal_effect_ratio") %>% as.numeric()) trials <- sim %>% sim_parameter("trials") %>% as.numeric()
(k <- sim %>% sim_parameter("k") %>% parse(text = .) %>% eval()) (tau_sq_true <- sim %>% sim_parameter("tau_sq_true") %>% parse(text = .) %>% eval())
b) Data for the control and intervention arms were sampled from distributions: the normal distribution, with parameters 2 and 0.3, the exponential distribution, with parameters 2, the Pareto distribution, with parameters 3 and 3, the Pareto distribution, with parameters 2 and 1, the Pareto distribution, with parameters 0.5 and 1, the log-normal distribution, with parameters 1 and 0.3.
a) These simulation results are summarised by the proportion, coverage, of r trials
confidence intervals that contain the true measure $\nu$, or log-ratio $\log(\rho)$ of control $\nu_C$ and intervention $\nu_I$ measures, with $\rho := \nu_I/\nu_C$.
The case where the control median $\nu_C$ is equal to the intervention median $\nu_I$ is considered, $\rho= 1$, as is an unequal ratio, $\rho =$ r unequal_effect_ratio
.
Data for the control and intervention arms sampled from distributions in accompanying Distributions plot.
Summary statistics were calculated from the samples, for the estimator of the variance $\mathcal V(m)$ of the sample median.
For each of the r trials
trials, $K$ studies' control and intervention arms were simulated. A meta-analysis was performed via metafor::rma
with the Knapp-Hartung test for... todo:. The confidence interval that informs the coverage was extracted from the model results.
Simulations, r trials
trials, were performed for each of $K =$ r k
studies.
The cases where there where there is no variation between the studies, $\tau^2 = 0$, and some variation introduced by independent factors other than the measure of interest for a given study, $\tau^2 =$ r tau_sq_true[-1]
are provided.
# todo tau2
For each of the r trials
trials, a confidence interval, $\theta \pm \Phi^{-1}(0.975)\mathcal \sqrt(V(\theta))$, was calculated, where $\theta$ estimates the true measure, or log-ratio of control and intervention measures.
sim %>% plot() sim %>% caption() sim %>% plot(caption = caption(sim))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.