rpp: Generate Random Counts from a Zero-Truncated Poisson Process

View source: R/rpp.R

rppR Documentation

Generate Random Counts from a Zero-Truncated Poisson Process

Description

Simulates count data from a zero-truncated Poisson process using specified parameters for the rate component.

Usage

rpp(b, X)

Arguments

b

A numeric vector of coefficients for the rate component.

X

A matrix or data frame of predictor variables for the rate component.

Details

This function generates count data from a zero-truncated Poisson process, which models count data without zeros. The process involves:

  • Calculating the rate parameter (\lambda) as \exp(X \cdot b).

  • Iteratively computing probabilities for counts starting from 1 and adding to the cumulative probability until a randomly drawn value is matched.

This function is useful for generating synthetic data for testing or simulation studies involving zero-truncated Poisson models.

Value

A numeric vector of simulated count data.

See Also

truncreg for fitting zero-truncated models.

Examples

# Example usage
set.seed(123)
X <- matrix(rnorm(100), ncol = 2)
b <- c(0.5, -0.2)
simulated_data <- rpp(b, X)
print(simulated_data)


oneinfl documentation built on April 4, 2025, 12:05 a.m.