From 72bd512a709800ad196449a3dbec942a5896fde7 Mon Sep 17 00:00:00 2001 From: Xiao Yan Date: Sun, 10 Nov 2024 16:10:56 -0500 Subject: [PATCH] Update documentation --- man/bayesmsm.Rd | 2 +- man/bayesweight.Rd | 16 ++++++++-------- man/bayesweight_cen.Rd | 37 ++++++++++++++++++------------------- 3 files changed, 27 insertions(+), 28 deletions(-) diff --git a/man/bayesmsm.Rd b/man/bayesmsm.Rd index 212400a..aae406f 100644 --- a/man/bayesmsm.Rd +++ b/man/bayesmsm.Rd @@ -30,7 +30,7 @@ bayesmsm( \item{family}{Character string specifying the outcome distribution family. The possible distributions are: "gaussian" (default) for continuous outcomes, and "binomial" for binary outcomes.} -\item{data}{Data table containing the variable names specified in ymodel.} +\item{data}{Data table containing the variable names in `ymodel`.} \item{wmean}{Vector of treatment assignment weights. The default is rep(1, nrow(data)).} diff --git a/man/bayesweight.Rd b/man/bayesweight.Rd index 540bd79..f1f0e6c 100644 --- a/man/bayesweight.Rd +++ b/man/bayesweight.Rd @@ -16,21 +16,21 @@ bayesweight( ) } \arguments{ -\item{trtmodel.list}{A list of formulas corresponding to each time point with the time-specific treatment variable on the left hand side and pre-treatment covariates to be balanced on the right hand side. Interactions and functions of covariates are allowed.} +\item{trtmodel.list}{A list of formulas corresponding to each time point with the time-specific treatment variable on the left hand side and pre-treatment covariates to be balanced on the right hand side. The formulas must be in temporal order, and must contain all covariates to be balanced at that time point. Interactions and functions of covariates are allowed.} -\item{data}{A dataframe containing the variables mentioned in the `trtmodel.list`.} +\item{data}{A data set in the form of a data frame containing the variables in `trtmodel.list`. This must be a wide data set with exactly one row per unit.} -\item{n.chains}{The number of MCMC chains to run. Set to 1 for non-parallel computation. For parallel computation, it is required to use at least 2 chains.} +\item{n.chains}{Integer specifying the number of MCMC chains to run. Set to 1 for non-parallel computation. For parallel computation, it is required to use at least 2 chains. The default is 2.} -\item{n.iter}{The total number of iterations for each chain (including burn-in).} +\item{n.iter}{Integer specifying the total number of iterations for each chain (including burn-in). The default is 25000.} -\item{n.burnin}{The number of burn-in iterations for each chain.} +\item{n.burnin}{Integer specifying the number of burn-in iterations for each chain. The default is 15000.} -\item{n.thin}{Thinning rate for the MCMC sampler.} +\item{n.thin}{Integer specifying the thinning rate for the MCMC sampler. The default is 5.} -\item{seed}{A seed to ensure reproducibility.} +\item{seed}{Starting seed for the JAGS model. The default is 890123.} -\item{parallel}{Logical. Indicates whether to run the MCMC chains in parallel. Default is TRUE.} +\item{parallel}{Logical scalar indicating whether to run the MCMC chains in parallel. The default is TRUE.} } \value{ A list of the calculated weights. diff --git a/man/bayesweight_cen.Rd b/man/bayesweight_cen.Rd index cad7ffe..ab7b44e 100644 --- a/man/bayesweight_cen.Rd +++ b/man/bayesweight_cen.Rd @@ -2,46 +2,45 @@ % Please edit documentation in R/bayesweight_cen.R \name{bayesweight_cen} \alias{bayesweight_cen} -\title{Bayesian Weight Estimation for Censored Data} +\title{Bayesian Treatment Effect Weight Estimation for Censored Data} \usage{ bayesweight_cen( - trtmodel.list = list(A1 ~ L11 + L21, A2 ~ L11 + L21 + L12 + L22 + A1, A3 ~ L11 + L21 + - L12 + L22 + A1 + L13 + L23 + A2), - cenmodel.list = list(C1 ~ L11 + L21, C2 ~ L11 + L21 + A1, C3 ~ L11 + L21 + A1 + L12 + - L22 + A2), + trtmodel.list, + cenmodel.list, data, - n.iter = 2500, - n.burnin = 1500, + n.iter = 25000, + n.burnin = 15000, n.thin = 5, - parallel = FALSE, - n.chains = 1, + parallel = TRUE, + n.chains = 2, seed = 890123 ) } \arguments{ -\item{trtmodel.list}{A list of formulas corresponding to each time point with the time-specific treatment variable on the left-hand side and pre-treatment covariates to be balanced on the right-hand side. Interactions and functions of covariates are allowed.} +\item{trtmodel.list}{A list of formulas corresponding to each time point with the time-specific treatment variable on the left-hand side and pre-treatment covariates to be balanced on the right-hand side. The formulas must be in temporal order, and must contain all covariates to be balanced at that time point. Interactions and functions of covariates are allowed.} -\item{cenmodel.list}{A list of formulas for the censoring data at each time point, with censoring indicators on the left-hand side and covariates on the right-hand side.} +\item{cenmodel.list}{A list of formulas for the censored data at each time point, with censoring indicators on the left-hand side and covariates on the right-hand side. The formulas must be in temporal order, and must contain all covariates to be balanced at that time point.} -\item{data}{A data frame containing the variables in the models (treatment, censoring, and covariates).} +\item{data}{A data set in the form of a data frame containing the variables in `trtmodel.list` and `cenmodel.list`. This must be a wide data set with exactly one row per unit.} -\item{n.iter}{Number of iterations to run the MCMC algorithm in JAGS.} +\item{n.iter}{Integer specifying the total number of iterations for each chain (including burn-in). The default is 25000.} -\item{n.burnin}{Number of iterations to discard as burn-in in the MCMC algorithm.} +\item{n.burnin}{Integer specifying the number of burn-in iterations for each chain. The default is 15000.} -\item{n.thin}{Thinning rate for the MCMC samples.} +\item{n.thin}{Integer specifying the thinning rate for the MCMC sampler. The default is 5.} -\item{parallel}{Logical, indicating whether to run the MCMC sampling in parallel (default is `FALSE`).} +\item{parallel}{Logical scalar indicating whether to run the MCMC chains in parallel. The default is TRUE.} -\item{n.chains}{Number of MCMC chains to run. If parallel is `TRUE`, this specifies the number of chains run in parallel.} +\item{n.chains}{Integer specifying the number of MCMC chains to run. Set to 1 for non-parallel computation. For parallel computation, it is required to use at least 2 chains. The default is 2.} -\item{seed}{A seed for random number generation to ensure reproducibility of the MCMC.} +\item{seed}{Starting seed for the JAGS model. The default is 890123.} } \value{ A vector of posterior mean weights, computed by taking the average of the weights across all MCMC iterations. } \description{ -This function computes posterior mean weights using Bayesian estimation for treatment models and censoring models across multiple time points. The models can be run in parallel to estimate the weights needed for causal inference with censored data. +This function computes posterior mean weights using Bayesian estimation for treatment models and censoring models across multiple time points. +The models can be run in parallel to estimate the weights for censored data. } \examples{ simdat_cen <- read.csv(system.file("extdata",