| sim_pcd | R Documentation |
Generates data from the design used in the simulation study of Sun et al. (2024), which is a convenient source of examples and test cases.
sim_pcd(
n,
beta = c(1, -1),
lambda = function(t) 8/(1 + t),
tau = 2,
frailty = 0,
exam_mean = 4,
lambda_max = NULL,
digits = 2
)
n |
Number of subjects. |
beta |
Length two coefficient vector for |
lambda |
Baseline rate function, vectorised over |
tau |
Maximum follow-up time. |
frailty |
Variance of a gamma frailty with mean one that multiplies each subject's rate. Zero, the default, gives a genuine Poisson process; a positive value produces overdispersed counts that violate the Poisson assumption while leaving the rate model intact. |
exam_mean |
Mean of the zero-truncated Poisson distribution from which the number of examinations per subject is drawn. |
lambda_max |
Optional upper bound for |
digits |
Number of decimal places to round examination times to, or
|
The time-varying covariate is a single step,
x_1(t) = X_{11} I(t \le U_1) + X_{12} I(t > U_1), with
X_{11}, X_{12} \sim U(0, 1) and U_1 \sim U(0, \tau). The
time-invariant covariate x2 is U(0, 1). Events follow a
nonhomogeneous Poisson process with rate
r \lambda(t) \exp(\beta' X(t)), where r is one unless frailty
is positive. Examination times are the order statistics of a uniform sample
on (0, \bar T) with \bar T \sim U(0.9\tau, \tau).
A tibble in counting process form with columns id, tstart,
tstop, count, x1 and x2. Rows are intervals over which the
covariates are constant; count is the number of events since the previous
examination and is NA on rows that only record a covariate change.
Sun, D., Guo, Y., Li, Y., Tu, W. and Sun, J. (2024). A robust approach for regression analysis of panel count data. Bernoulli 30(4), 3251–3275. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.3150/23-BEJ1713")}
set.seed(42)
d <- sim_pcd(5, beta = c(1, -1), lambda = function(t) 8 / (1 + t))
head(d)
# Overdispersed counts: the rate model still holds, the Poisson one does not.
od <- sim_pcd(5, frailty = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.