rpsftm: Rank Preserving Structural Failure Time Model

View source: R/rpsftm.R

rpsftmR Documentation

Rank Preserving Structural Failure Time Model

Description

Main Function used for estimating causal parameters under the Rank Preserving Structural Failure Time Model

Usage

rpsftm(
  formula,
  data,
  censor_time,
  subset,
  na.action,
  test = survdiff,
  low_psi = -1,
  hi_psi = 1,
  alpha = 0.05,
  treat_modifier = 1,
  autoswitch = TRUE,
  n_eval_z = 100,
  ...
)

Arguments

formula

a formula with a minimal structure of Surv(time, status)~rand(arm,rx). Further terms can be added to the right hand side to adjust for covariates and use strata or cluster arguments.

data

an optional data frame that contains variables

censor_time

variable or constant giving the time at which censoring would, or has occurred. This should be provided for all observations unlike standard Kaplan-Meier or Cox regression where it is only given for censored observations. If no value is given then re-censoring is not applied.

subset

expression indicating which subset of the rows of data should be used in the fit. This can be a logical vector (which is replicated to have length equal to the number of observations), a numeric vector indicating which observation numbers are to be included (or excluded if negative), or a character vector of row names to be included. All observations are included by default.

na.action

a missing-data filter function. This is applied to the model.frame after any subset argument has been used. Default is options()$na.action.

test

the survival regression function to calculate the z-statistic: survdiff, coxph, survreg

low_psi

the lower limit of the range to search for the causal parameter

hi_psi

the upper limit of the range to search for the causal parameter

alpha

the significance level used to calculate confidence intervals

treat_modifier

an optional variable that psi is multiplied by on an individual observation level to give differing impact to treatment.

autoswitch

a logical to autodetect cases of no switching. If TRUE, then if all observations in an arm have perfect compliance then recensoring is not applied in that arm. If FALSE the recensoring is applied regardless of perfect compliance.

n_eval_z

The number of points between hi_psi and low_psi at which to evaluate the Z-statistics in the estimating equation. Default is 100.

...

arguments to supply to the test function.

Details

the formula object Surv(time, status)~rand(arm,rx). rand() stands for randomisation, both the randomly assigned and actual observed treatment.

  • arm: the randomised treatment arm. a factor with 2 levels, or numeric variable with values 0/1.

  • rx: the proportion of time on active treatment (arm=1 or the non-reference level of the factor)

Further adjustment terms can be added on the right hand side of the formula if desired, included strata() or cluster() terms.

Value

a rpsftm method object that is a list of the following:

  • psi: the estimated parameter

  • fit: a survdiff object to produce Kaplan-Meier curves of the estimated counterfactual untreated failure times for each treatment arm

  • CI: a vector of the confidence interval around psi

  • Sstar: the recensored Surv() data using the estimate value of psi to give counterfactual untreated failure times.

  • rand: the rand() object used to specify the allocated and observed amount of treatment.

  • ans: the values from uniroot_all used to solve the estimating equation, but embedded within a list as per uniroot, with an extra element root_all, a vector of all roots found in the case of multiple solutions. The first element of root_all is subsequently used.

  • eval_z: a data frame with the Z-statistics from the estimating equation evaluated at a sequence of values of psi. Used to plot and check if the range of values to search for solution and limits of confidence intervals need to be modified.

  • Further elements corresponding to either a survdiff, coxph, or survreg object. This will always include:

    • call: the R call object

    • formula: a formula representing any adjustments, strata or clusters- used for the update() function

    • terms: a more detailed representation of the model formula

Author(s)

Simon Bond

See Also

survdiff, coxph.object, survreg.object

Examples

?immdef
fit <- rpsftm(Surv(progyrs, prog)~rand(imm,1-xoyrs/progyrs),immdef, censyrs)
print(fit)
summary(fit)
plot(fit)


rpsftm documentation built on May 29, 2024, 2:37 a.m.