rpp | R Documentation |
Simulates count data from a zero-truncated Poisson process using specified parameters for the rate component.
rpp(b, X)
b |
A numeric vector of coefficients for the rate component. |
X |
A matrix or data frame of predictor variables for the rate component. |
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.
A numeric vector of simulated count data.
truncreg
for fitting zero-truncated models.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.