inst/doc/C-plotting.R

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

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

## ----data-1-----------------------------------------------------------------------------------------------------------------------------------------
data("relhaz", package = "rsimsum")

## ----inspect-1--------------------------------------------------------------------------------------------------------------------------------------
str(relhaz)
head(relhaz, n = 15)

## ----summarise-1------------------------------------------------------------------------------------------------------------------------------------
s1 <- simsum(
  data = relhaz, estvarname = "theta", se = "se", true = -0.50,
  methodvar = "model", by = c("n", "baseline"), x = TRUE
)
s1

## ----summary-summarise-1----------------------------------------------------------------------------------------------------------------------------
summary(s1)

## ----plot-est---------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est")

## ----plot-se----------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "se")

## ----plot-est-ba------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est_ba")

## ----ridge-est-1------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est_ridge")

## ----lolly-bias-1-----------------------------------------------------------------------------------------------------------------------------------
autoplot(summary(s1), type = "lolly", stats = "bias")

## ----lolly-bias-2-----------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "lolly", stats = "bias")

## ----lolly-coverage-1-------------------------------------------------------------------------------------------------------------------------------
autoplot(summary(s1), type = "lolly", stats = "cover")

## ----forest-bias-1----------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "forest", stats = "bias")

## ----forest-bias-2----------------------------------------------------------------------------------------------------------------------------------
autoplot(summary(s1), type = "forest", stats = "bias")

## ----zipper-1---------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "zip")

## ----zipper-zoom------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "zip", zoom = 0.3)

## ----heat-bias-1------------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "heat", stats = "bias")

## ----plot-est-density-------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est_density")

## ----plot-est-hex-----------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est_hex")

## ----add-theme--------------------------------------------------------------------------------------------------------------------------------------
autoplot(summary(s1), type = "lolly", stats = "bias") +
  ggplot2::theme_bw()

## ----add-theme-default------------------------------------------------------------------------------------------------------------------------------
autoplot(summary(s1), type = "lolly", stats = "bias")

## ----heat-bias-viridis------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "heat", stats = "bias") +
  ggplot2::scale_fill_viridis_c()

## ----colour-palette---------------------------------------------------------------------------------------------------------------------------------
autoplot(s1, type = "est_ridge") +
  scale_fill_viridis_d() +
  scale_colour_viridis_d()

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.