tvma_3trt {tvmediation}R Documentation

Time Varying Mediation Function: Continuous Outcome and Three Treatment Groups

Description

Function to estimate the time-varying mediation effect and bootstrap standard errors for three treatment groups and a continuous outcome.

Usage

tvma_3trt(
  T1,
  T2,
  t.seq,
  mediator,
  outcome,
  t.est = t.seq,
  plot = FALSE,
  CI = "boot",
  replicates = 1000,
  grpname = "T",
  verbose = FALSE
)

Arguments

T1

a vector indicating assignment to treatment 1

T2

a vector indicating assignment to treatment 2

t.seq

a vector of time points for each observation

mediator

matrix of mediator values in wide format

outcome

matrix of outcome values in wide format

t.est

a vector of time points at which to make the estimation. Default = t.seq. (OPTIONAL ARGUMENT)

plot

TRUE or FALSE for plotting mediation effect. Default = "FALSE". (OPTIONAL ARGUMENT)

CI

"none" or "boot" method of deriving confidence intervals. Default = "boot". (OPTIONAL ARGUMENT)

replicates

number of replicates for bootstrapping confidence intervals. Default = 1000. (OPTIONAL ARGUMENT)

grpname

name of the treatment arms (exposure groups) to be displayed in the results. Default = "T". (OPTIONAL ARGUMENT)

verbose

TRUE or FALSE for printing results to screen. Default = "FALSE". (OPTIONAL ARGUMENT)

Value

hat.alpha1

estimated Treatment 1 effect on mediator

CI.lower.alpha1

CI lower limit for estimated coefficient hat.alpha1

CI.upper.alpha1

CI upper limit for estimated coefficient hat.alpha1

hat.alpha2

estimated Treatment 2 effect on mediator

CI.lower.alpha2

CI lower limit for estimated coefficient hat.alpha2

CI.upper.alpha2

CI upper limit for estimated coefficient hat.alpha2

hat.gamma1

estimated Treatment 1 direct effect on outcome

CI.lower.gamma1

CI lower limit for estimated coefficient hat.gamma1

CI.upper.gamma1

CI upper limit for estimated coefficient hat.gamma1

hat.gamma2

estimated Treatment 2 direct effect on outcome

CI.lower.gamma2

CI lower limit for estimated coefficient hat.gamma2

CI.upper.gamma2

CI upper limit for estimated coefficient hat.gamma2

hat.tau1

estimated Treatment 1 total effect on outcome

CI.lower.tau1

CI lower limit for estimated coefficient hat.tau1

CI.upper.tau1

CI upper limit for estimated coefficient hat.tau1

hat.tau2

estimated Treatment 2 total effect on outcome

CI.lower.tau2

CI lower limit for estimated coefficient hat.tau2

CI.upper.tau2

CI upper limit for estimated coefficient hat.tau2

hat.beta

estimated mediator effect on outcome

CI.lower.beta

CI lower limit for estimated coefficient hat.beta

CI.upper.beta

CI upper limit for estimated coefficient hat.beta

hat.mediation1

time varying mediation effect for Treatment 1 on outcome

SE_MedEff1

estimated standard errors of hat.mediation1

CI.upper.T1

CI upper limit for hat.mediation1

CI.lower.T1

CI lower limit for hat.mediation1

hat.mediation2

time varying mediation effect for Treatment 2 on outcome

SE_MedEff2

estimated standard errors of hat.mediation2

CI.upper.T2

CI upper limit for hat.mediation2

CI.lower.T2

CI lower limit for hat.mediation2

Plot Returns

  1. plot1_a1 plot for hat.alpha1 with CIs over t.est

  2. plot2_a2 plot for hat.alpha2 with CIs over t.est

  3. plot3_g1 plot for hat.gamma1 with CIs over t.est

  4. plot4_g2 plot for hat.gamma2 with CIs over t.est

  5. plot5_t1 plot for hat.tau1 with CIs over t.est

  6. plot6_t2 plot for hat.tau2 with CIs over t.est

  7. plot7_b plot for hat.beta with CIs over t.est

  8. MedEff_T1 plot for hat.mediation1 over t.est

  9. MedEff_T2 plot for hat.mediation2 over t.est

  10. MedEff_CI_T1 plot for hat.mediation1 with CIs over t.est

  11. MedEff_CI_T2 plot for hat.mediation2 with CIs over t.est

References

  1. Fan, J. and Gijbels, I. Local polynomial modelling and its applications: Monographs on statistics and applied probability 66. CRC Press; 1996.

  2. Fan J, Zhang W. Statistical Estimation in Varying Coefficient Models. The Annals of Statistics. 1999;27(5):1491-1518.

  3. Fan J, Zhang JT. Two-step estimation of functional linear models with applications to longitudinal data. Journal of the Royal Statistical Society: Series B (Statistical Methodology). 2000;62(2):303-322.

  4. Cai X, Coffman DL, Piper ME, Li R. Estimation and inference for the mediation effect in a time-varying mediation model. BMC Med Res Methodol. 2022;22(1):1-12.

  5. Baker TB, Piper ME, Stein JH, et al. Effects of Nicotine Patch vs Varenicline vs Combination Nicotine Replacement Therapy on Smoking Cessation at 26 Weeks: A Randomized Clinical Trial. JAMA. 2016;315(4):371.

  6. B. Efron, R. Tibshirani. Bootstrap Methods for Standard Errors, Confidence Intervals, and Other Measures of Statistical Accuracy. Statistical Science. 1986;1(1):54-75.

Examples

## Not run: data(smoker)

# GENERATE WIDE FORMATTED MEDIATORS
mediator <- LongToWide(smoker$SubjectID,
                        smoker$timeseq, 
                        smoker$NegMoodLst15min)

# GENERATE WIDE FORMATTED OUTCOMES
outcome <- LongToWide(smoker$SubjectID,
                      smoker$timeseq,
                      smoker$cessFatig)

# GENERATE TWO BINARY TREATMENT VARIABLES
NRT1 <- as.numeric(unique(smoker[,c("SubjectID","varenicline")])[,2])-1
NRT2 <- as.numeric(unique(smoker[,c("SubjectID","comboNRT")])[,2])-1

# GENERATE A VECTOR OF UNIQUE TIME POINTS
t.seq <- sort(unique(smoker$timeseq))

# COMPUTE TIME VARYING MEDIATION ANALYSIS USING BOOTSTRAPPED CONFIDENCE INTERVALS
results <- tvma_3trt(NRT1, NRT2, t.seq, mediator, outcome)

# COMPUTE TIME VARYING MEDIATION ANALYSIS FOR SPECIFIED POINTS IN TIME USING 250 REPLICATES
results <- tvma_3trt(NRT1, NRT2, t.seq, mediator, outcome,
                     t.est = c(0.2, 0.4, 0.6, 0.8),
                     replicates = 250)
## End(Not run)


[Package tvmediation version 1.1.0 Index]