countcheck: Return data frame combining data and results

View source: R/api.R

countcheckR Documentation

Return data frame combining data and results

Description

Constructs data frame with these fields:

  • unit: ID for unit

  • n: previous reference count values (measure of exposure), must at least be 1

  • y: previous count values of interest

  • n_new: new reference count values (measure of exposure), must at least be 1

  • y_new: new count values of interest

  • true_theta: true value of theta (if known)

  • theta_nopool: no-pooling estimate of theta

  • theta_complpool: complete-pooling estimate of theta

  • theta_partpool: partial-pooling estimate of theta

  • ucl_true_theta: UCL based on n_new and true value of theta (if known)

  • ucl_nopool: UCL based on n_new and no-pooling estimate of theta

  • ucl_complpool: UCL based on n_new and complete-pooling estimate of theta

  • ucl_partpool: UCL based on n_new and partial-pooling estimate of theta

  • fe_true_theta: factor f, with observed y_new exceeding true-theta UCL by f * sd(y_new), given n_new and true value of theta (if known)

  • fe_nopool: factor f, with observed y_new exceeding no-pooling UCL by f * sd(y_new), given n_new and no-pooling estimate of theta

  • fe_complpool: factor f, with observed y_new exceeding complete-pooling UCL by f * sd(y_new), given n_new and complete-pooling estimate of theta

  • fe_partpool: factor f, with observed y_new exceeding partial-pooling UCL by f * sd(y_new), given n_new and partial-pooling estimate of theta

If data is provided via parameters, vectors must be of equal length, with length >= 3. If unit is NULL, all data vectors passed to this function are ignored, and the complete data set is generated in a simulation run.

Usage

countcheck(
  unit = NULL,
  n = NULL,
  y = NULL,
  n_new = NULL,
  y_new = NULL,
  true_theta = NULL,
  beta = 0.376,
  factor_sd = 3,
  random_seed = 200731
)

Arguments

unit

ID for unit

n

Previous reference count values (measure of exposure), must at least be 1

y

Previous count values of interest

n_new

New reference count values (measure of exposure), must at least be 1

y_new

New count values of interest

true_theta

True value of theta (if known; optional)

beta

Parameter for half-normal distribution of alpha (default: 0.376, so that the expected value of alpha is 0.3) - used in partial-pooling model

factor_sd

Factor multiplying standard deviation (default: 3) - used in calculation of UCLs

random_seed

Seed value (default: 200731) - used in simulation and by Stan

Value

Data frame with all columns populated


jmeydam/countcheck documentation built on Aug. 16, 2024, 11:34 a.m.