calc_Wncdf function

Calculate cdf of singletons W_n for CUSUM

Calculate cdf of singletons W_n for CUSUM

Internal function to calculate cdf of singletons WnWn

of the Bernoulli CUSUM chart. The cdf is used to create the transition matrix when Markov Chain methodology is used or to determine the integral equation/probabilities of a Wald test when integral equation or Kemp's methodology is used.

calc_Wncdf(glmmod, theta, theta_true, p0, smooth_prob = FALSE)

Arguments

  • glmmod: Generalized linear regression model used for risk-adjustment as produced by the function glm(). Suggested:

    glm(as.formula("(survtime <= followup) & (censorid == 1) ~covariates"), data = data).

    Alternatively, a list containing the following elements:

    • formula:: a formula() in the form ~ covariates;
    • coefficients:: a named vector specifying risk adjustment coefficients for covariates. Names must be the same as in formula and colnames of data.
  • theta: The θ\theta value used to specify the odds ratio eθe^\theta under the alternative hypothesis. If θ>=0\theta >= 0, the average run length for the upper one-sided Bernoulli CUSUM will be determined. If θ<0\theta < 0, the average run length for the lower one-sided CUSUM will be determined. Note that

p1=p0eθ1p0+p0eθ.p1=(p0eθ)/(1p0+p0eθ). p_1 = \frac{p_0 e^\theta}{1-p_0 +p_0 e^\theta}.p1 = (p0 * e^\theta)/(1-p0+p0 * e^\theta).
  • theta_true: The true log odds ratio θ\theta, describing the true increase in failure rate from the null-hypothesis. Default = log(1), indicating no increase in failure rate.
  • p0: The baseline failure probability at entrytime + followup for individuals.
  • smooth_prob: Should the probability distribution of failure under the null distribution be smoothed? Useful for small samples. Can only be TRUE when glmmod is supplied. Default = FALSE.