poisson_bstrp {marp} | R Documentation |
A function to generate (double) bootstrap samples and fit Poisson renewal model
Description
A function to generate (double) bootstrap samples and fit Poisson renewal model
Usage
poisson_bstrp(n, t, B, BB, par_hat, mu_hat, pr_hat, haz_hat, y)
Arguments
n |
number of inter-event times |
t |
user-specified time intervals (used to compute hazard rate) |
B |
number of bootstrap samples |
BB |
number of double-bootstrap samples |
par_hat |
estimated parameters |
mu_hat |
estimated mean inter-event times |
pr_hat |
estimated time to event probability |
haz_hat |
estimated hazard rates |
y |
user-specified time point (used to compute time-to-event probability) |
Value
returns list of estimates after fitting Poisson renewal model on (double) bootstrap samples
- mu_star
Estimated mean from bootstrapped samples
- pr_star
Estimated probability from bootstrapped samples
- haz_star
Estimated hazard rates from bootstrapped samples
- mu_var_hat
Variance of estimated mean
- pr_var_hat
Variance of estimated probability
- haz_var_hat
Variance of estimated hazard rates
- mu_var_double
Variance of estimated mean of bootstrapped samples (via double-bootstrapping)
- pr_var_double
Variance of estimated probability of bootstrapped samples (via double-bootstrapping)
- haz_var_double
Variance of estimated hazard rates of bootstrapped samples (via double-bootstrapping)
- mu_Tstar
Pivot quantity of the estimated mean
- pr_Tstar
Pivot quantity of the estimated probability
- haz_Tstar
Pivot quantity of the estimated hazard rates
Examples
# set some parameters
n <- 30 # sample size
t <- seq(100, 200, by = 10) # time intervals
B <- 100 # number of bootstraps
BB <- 100 # number of double-bootstraps
# m <- 10 # number of iterations for MLE optimization
par_hat <- c(
3.41361e-03, 2.76268e+00, 2.60370e+00, 3.30802e+02, 5.48822e+00, 2.92945e+02, NA,
9.43071e-03, 2.47598e+02, 1.80102e+00, 6.50845e-01, 7.18247e-01
)
mu_hat <- c(292.94512, 292.94513, 319.72017, 294.16945, 298.87286, 292.94512)
pr_hat <- c(0.60039, 0.42155, 0.53434, 0.30780, 0.56416, 0.61795)
haz_hat <- matrix(c(
-5.67999, -5.67999, -5.67999, -5.67999, -5.67999, -5.67999,
-5.67999, -5.67999, -5.67999, -5.67999, -5.67999, -6.09420,
-5.99679, -5.91174, -5.83682, -5.77031, -5.71085, -5.65738,
-5.60904, -5.56512, -5.52504, -5.48833, -6.09902, -5.97017,
-5.85769, -5.75939, -5.67350, -5.59856, -5.53336, -5.47683,
-5.42805, -5.38621, -5.35060, -6.17146, -6.09512, -6.02542,
-5.96131, -5.90194, -5.84668, -5.79498, -5.74642, -5.70064,
-5.65733, -5.61624, -5.92355, -5.80239, -5.70475, -5.62524,
-5.55994, -5.50595, -5.46106, -5.42359, -5.39222, -5.36591,
-5.34383, -5.79111, -5.67660, -5.58924, -5.52166, -5.46879,
-5.42707, -5.39394, -5.36751, -5.34637, -5.32946, -5.31596
),length(t),6)
y <- 304 # cut-off year for estimating probablity
# generate bootstrapped samples then fit renewal model
res <- marp::poisson_bstrp(n, t, B, BB, par_hat, mu_hat, pr_hat, haz_hat, y)