tidy: Turn an object into a tidy dataset

tidy.simsumR Documentation

Turn an object into a tidy dataset

Description

Extract a tidy dataset with results from an object of class simsum, summary.simsum, multisimsum, or summary.multisimsum.

Usage

## S3 method for class 'simsum'
tidy(x, stats = NULL, ...)

## S3 method for class 'summary.simsum'
tidy(x, stats = NULL, ...)

## S3 method for class 'multisimsum'
tidy(x, stats = NULL, ...)

## S3 method for class 'summary.multisimsum'
tidy(x, stats = NULL, ...)

Arguments

x

An object of class simsum.

stats

Summary statistics to include; can be a scalar value or a vector. Possible choices are:

  • nsim, the number of replications with non-missing point estimates and standard error.

  • thetamean, average point estimate.

  • thetamedian, median point estimate.

  • se2mean, average standard error.

  • se2median, median standard error.

  • bias, bias in point estimate.

  • rbias, relative (to the true value) bias in point estimate.

  • empse, empirical standard error.

  • mse, mean squared error.

  • relprec, percentage gain in precision relative to the reference method.

  • modelse, model-based standard error.

  • relerror, relative percentage error in standard error.

  • cover, coverage of a nominal level\

  • becover, bias-eliminated coverage of a nominal level\

  • power, power of a (1 - level)\ Defaults to NULL, in which case all summary statistics are returned.

...

Ignored.

Value

A data.frame containing summary statistics from a simulation study.

Examples

data(MIsim)
x <- simsum(
  data = MIsim, estvarname = "b", true = 0.5, se = "se",
  methodvar = "method"
)
tidy(x)

# Extracting only bias and coverage:
tidy(x, stats = c("bias", "cover"))

xs <- summary(x)
tidy(xs)

rsimsum documentation built on May 29, 2024, 2:18 a.m.