knitr::opts_chunk$set(
  eval = TRUE,
  message = FALSE,
  echo = TRUE,
  results = 'asis',
  fig.height = 3.5,
  fig.width = 4.5,
  out.width = "100%",
  warning = FALSE,
  fig.align = 'center',
  message = FALSE,
  dev = 'cairo_pdf'
)

batpigday

\begin{description} \item[batpigday]{\emph{noun} The coding equivalent of groundhogday.} \end{description}

the problem


\begin{center} Simulating data is a bitch. \end{center}


Debugging frequently dominates the time of students in mathematical science. These students know how to solve equations, and next to nothing about code.


New tools are emerging daily to enable researchers to avoid these timesink pitfalls.

These tools have lowered the programmatic barrier for researchers, but it still a learning curve.


We consider a case study in meta-analysis.

\begin{description} \item[meta-analysis] Statistical methodology for combining the results of several studies.

\end{description}

meta-analysis of medians

Conventional meta-analytic tools, such as metafor::rma, require an effect and a variance of that effect.


But what if the reported statistics are median and interquartile range?


To test our proposed estimator for the variance of the sample median, I found myself repeating tasks and checks in the algorithms.


I tried to find a better way of debugging and writing simulations.

This lead to:

  1. a packaged analysis, varameta::*, which is built on
  2. the simulation package for meta-analysis data, metasim::*.

(*in development)

\vfill\null \columnbreak

escaping batpigday

\begin{center} \textbf{coding is the easiest part of coding} \end{center}



library(tidyverse)
library(metasim)
library(kableExtra)

# table styling
output_table <- function(df) {
  df %>% 
    janitor::adorn_rounding(skip_first_col = FALSE) %>% 
  kable(align = "c", caption = "", booktabs = TRUE) %>% 
  kable_styling(latex_options = c("striped","HOLD_position"),full_width = TRUE, font_size = 25)
}

Generate sample sizes for $k$ studies.

# simulate 2 studies where most have at most 25
sim_n(k = 2, min_n = 10, max_n = 25) %>% output_table()
# generate simulation dataframe
sim_df() %>% head(2) %>% select(-n) %>% output_table()

Each row of this dataframe represents a set of simulation parameters.


Each simulation runs a trial function.

metatrial() %>% output_table()

Each simulation runs the trial function |trials| times.

metasim() %>%
  pluck("results") %>%
  select(-coverage_count) %>%
  output_table()

For all simulations, run metasim over each row of the dataframe.

metasims() %>% output_table()

\vfill\null \columnbreak

the maths

references

This poster was created with posterdown::.

\small\printbibliography



softloud/metasim documentation built on July 15, 2019, 8:02 p.m.