Learn R Programming

birp (version 0.0.5)

assess_NB: Assess whether a Poisson model can replace the Negative Binomial model

Description

This function tests if the Poisson model is appropriate by simulating replicate datasets under the Poisson assumption and comparing the overdispersion parameter estimates with those obtained from the Negative Binomial (NB) model fit to the original data.

Usage

assess_NB(
  x,
  stochastic = FALSE,
  numRep = 100,
  cutoff = 0.05,
  plot = TRUE,
  verbose = TRUE
)

Value

A list containing:

keep_NB

Logical scalar, TRUE if NB model should be kept (data shows overdispersion). If FALSE, birp should be re-run using the Poisson model to gain power.

keep_NB_per_method

Logical vector indicating whether NB should be kept for each method.

frac

Numeric vector with fractions of replicates where Poisson simulated overdispersion exceeded observed NB overdispersion.

b_Pois

Matrix of overdispersion parameter estimates from Poisson-simulated replicates.

b_x

Numeric vector of overdispersion parameter estimates from the original NB fit.

Arguments

x

A birp object estimated under a negative binomial model.

stochastic

Logical; if TRUE, use a stochastic trend model, otherwise deterministic (default).

numRep

Integer; number of replicate datasets to simulate (default 100).

cutoff

Numeric; significance threshold for the fraction of replicates where NB overdispersion exceeds Poisson estimate (default 0.05).

plot

Logical; if TRUE, plot the distributions of overdispersion parameters from simulated Poisson replicates (default TRUE).

verbose

Logical; if FALSE, suppress console output (default TRUE).

Examples

Run this code
data <- simulate_birp()
est <- birp(data, negativeBinomial = TRUE)
res_assess <- assess_NB(est, numRep = 5)

Run the code above in your browser using DataLab