View source: R/bernoulli_control_limit.R
bernoulli_control_limit | R Documentation |
This function can be used to determine control limits for the
BK-CUSUM (bk_cusum
) procedure by restricting the type I error alpha
of the
procedure over time
.
bernoulli_control_limit(time, alpha = 0.05, followup, psi, n_sim = 20, theta, p0, p1, glmmod, baseline_data, h_precision = 0.01, seed = 1041996, pb = FALSE)
time |
A numeric value over which the type I error |
alpha |
A proportion between 0 and 1 indicating the required maximal type I error. |
followup |
The value of the follow-up time to be used to determine event time.
Event time will be equal to |
psi |
A numeric value indicating the estimated Poisson arrival rate of subjects
at their respective units. Can be determined using
|
n_sim |
An integer value indicating the amount of units to generate for the determination of the control limit. Larger values yield more precise control limits, but greatly increase computation times. Default is 20. |
theta |
The theta value used to specify the odds ratio e^θ under the alternative hypothesis. Note that p1 = (p0 * e^θ)/((1-p0) * (1+p0 e^θ)). |
p0 |
The baseline failure probability at |
p1 |
The alternative hypothesis failure probability at |
glmmod |
Generalized linear regression model used for risk-adjustment as produced by
the function
|
baseline_data |
(optional): A
and optionally additional covariates used for risk-adjustment. Can only be specified
in combination with |
h_precision |
(optional): A numerical value indicating how precisely the control limit should be determined. By default, control limits will be determined up to 2 significant digits. |
seed |
(optional): A numeric seed for survival time generation. Default is 01041996 (my birthday). |
pb |
(optional): A boolean indicating whether a progress bar should
be shown. Default is |
This function performs 3 steps to determine a suitable control limit.
Step 1: Generates n_sim
in-control units (failure rate as baseline).
If data
is provided, subject covariates are resampled from the data set.
Step 2: Determines chart values for all simulated units.
Step 3: Determines control limits such that at most a proportion alpha
of all units cross the control limit.
The generated data as well as the charts are also returned in the output.
A list containing three components:
call
: the call used to obtain output;
charts
: A list of length n_sim
containing the constructed charts;
data
: A data.frame
containing the in-control generated data.
h
: Determined value of the control limit.
Daniel Gomon
plot.bkcusum
, runlength.bkcusum
Other control limit simulation:
bk_control_limit()
,
cgr_control_limit()
## Not run: #We consider patient outcomes 100 days after their entry into the study. followup <- 100 #Determine a risk-adjustment model using a generalized linear model. #Outcome (failure within 100 days) is regressed on the available covariates: exprfitber <- as.formula("(survtime <= followup) & (censorid == 1)~ age + sex + BMI") glmmodber <- glm(exprfitber, data = surgerydat, family = binomial(link = "logit")) a <- bernoulli_control_limit(time = 500, alpha = 0.1, followup = followup, psi = 0.5, n_sim = 10, theta = log(2), glmmod = glmmodber, baseline_data = surgerydat) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.