inst/doc/F-rsimsumtidyverse.R

## ----setup, include = FALSE-------------------------------------------------------------------------------------------------------------------------
options(width = 150)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.align = "center", fig.height = 6, fig.width = 6,
  out.width = "75%"
)

## ----packages---------------------------------------------------------------------------------------------------------------------------------------
library(rsimsum)
library(dplyr)
library(ggplot2)
library(knitr)

## ----table------------------------------------------------------------------------------------------------------------------------------------------
data("MIsim", package = "rsimsum")
MIsim %>%
  simsum(estvarname = "b", se = "se", methodvar = "method", true = 0.5) %>%
  summary() %>%
  tidy() %>%
  kable()

## ----plot-------------------------------------------------------------------------------------------------------------------------------------------
MIsim %>%
  simsum(estvarname = "b", se = "se", methodvar = "method", true = 0.5) %>%
  summary() %>%
  tidy(stats = "bias") %>%
  ggplot(aes(x = method, y = est, ymin = lower, ymax = upper)) +
  geom_hline(yintercept = 0, color = "red", lty = "dashed") +
  geom_point() +
  geom_errorbar(width = 1 / 3) +
  theme_bw() +
  labs(x = "Method", y = "Bias")

Try the rsimsum package in your browser

Any scripts or data that you put into this service are public.

rsimsum documentation built on Aug. 17, 2022, 5:07 p.m.