diff --git a/pkgdown.yml b/pkgdown.yml index dc987d7..46a93a2 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: bayesmsm-censoring: bayesmsm-censoring.html bayesmsm-nocensoring: bayesmsm-nocensoring.html -last_built: 2024-10-23T21:52Z +last_built: 2024-11-05T22:35Z urls: reference: https://kuan-liu-lab.github.io/bayesmsm/reference article: https://kuan-liu-lab.github.io/bayesmsm/articles diff --git a/reference/bayesweight_cen.html b/reference/bayesweight_cen.html index 39ca983..b310f4d 100644 --- a/reference/bayesweight_cen.html +++ b/reference/bayesweight_cen.html @@ -119,9 +119,9 @@

Examples C3 ~ L11 + L21 + A1 + L12 + L22 + A2), data = simdat_cen, - n.iter = 2500, - n.burnin = 1500, - n.thin = 5, + n.iter = 1500, + n.burnin = 500, + n.thin = 1, parallel = FALSE, n.chains = 1, seed = 890123) diff --git a/reference/plot_APO-1.png b/reference/plot_APO-1.png index a3efa95..101c9b6 100644 Binary files a/reference/plot_APO-1.png and b/reference/plot_APO-1.png differ diff --git a/reference/plot_APO-2.png b/reference/plot_APO-2.png index 0e3e167..1dfd884 100644 Binary files a/reference/plot_APO-2.png and b/reference/plot_APO-2.png differ diff --git a/reference/plot_est_box-1.png b/reference/plot_est_box-1.png index 45c2aa1..c3c6fcc 100644 Binary files a/reference/plot_est_box-1.png and b/reference/plot_est_box-1.png differ diff --git a/search.json b/search.json index 400b1b0..51c4fcf 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://kuan-liu-lab.github.io/bayesmsm/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 bayesmsm authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Longitudinal causal analysis with informative right-censoring","text":"bayesmsm package enables easy implementation Bayesian marginal structural models (BMSMs) longitudinal data. methodology BMSMs can divided 2 estimation steps: Step 1. Bayesian treatment effect weight estimation Step 2. Bayesian non-parametric bootstrap maximize utility function respect causal effect Step 1, estimate treatment weights wijw_{ij} using posterior samples α\\alpha β\\beta via fitting series logistic regressions Bayesian framework. package incorporates Inverse Probability Treatment Weighting (IPTW) Inverse Probability Censoring Weighting (IPCW) handle longitudinal data without right-censoring. Step 2, Pn(vij)P_n(v_{ij}) estimated via non-parametric Bayesian bootstrap Dir(1,...,1)Dir(1,...,1) sampling weights. main functions package include: bayesweight: Calculates Bayesian weights subject-specific treatment effects. bayesweight_cen: Calculates Bayesian weights subject-specific treatment effects right-censored data. bayesmsm: Estimates marginal structural models using calculated Bayesian weights. plot_ATE: Plots estimated Average Treatment Effect (ATE). plot_APO: Plots estimated Average Potential Outcome (APO). plot_est_box: Plots distribution estimated treatment effects. summary_bayesmsm: Summarizes model results bayesmsm. Installation install bayesmsm package, can use devtools package install directly GitHub:","code":"devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"simulated-observational-data-with-right-censoring","dir":"Articles","previous_headings":"","what":"Simulated observational data with right-censoring","title":"Longitudinal causal analysis with informative right-censoring","text":"illustrate implementation bayesmsm package using simulated dataset. simulated dataset contains right-censoring binary end--study outcome. example provide comprehensive understanding apply package real-world data.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"dataset-introduction","dir":"Articles","previous_headings":"","what":"Dataset Introduction","title":"Longitudinal causal analysis with informative right-censoring","text":"simulation study, use simulated longitudinal dataset mimic complex real-world clinical data right-censoring. dataset consists 500 patients observed 3 visits. binary outcome variable represents end--study status patients. dataset includes baseline covariates L11L11 L21L21, L11L11 binary L21L21 continuous. Time-dependent covariates L12L12 L22L22 observed second visit, L13L13 L23L23 third visit. treatment variables represented A1A1, A2A2, A3A3 three visits. Right-censoring indicators represented C1C1, C2C2, C3C3. example, observations C1=1C1 = 1, records visit 1 censored. Description Simulated Right-Censored Dataset","code":"# simulating causal data with censoring; simdat_cen <- read.csv(system.file(\"extdata\", \"sim_causal.csv\", package = \"bayesmsm\")) # look at the data; head(simdat_cen) #> L11 L21 A1 L12 L22 A2 L13 L23 A3 C1 C2 C3 Y #> 1 0 -0.37560287 NA NA NA NA NA NA NA 1 NA NA NA #> 2 1 -0.56187636 NA NA NA NA NA NA NA 1 NA NA NA #> 3 0 -0.34391723 1 1 -0.8053290 1 1 -2.5508298 1 0 0 0 0 #> 4 1 0.09049665 1 1 -1.7754302 1 1 -2.2849997 0 0 0 0 0 #> 5 1 1.59850877 1 1 0.5604468 1 0 2.1787137 0 0 0 0 1 #> 6 0 -0.08856511 0 0 1.4798603 0 1 0.7025151 0 0 0 0 1"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"bayesian-treatment-effect-weight-estimation-using-bayesweight_cen","dir":"Articles","previous_headings":"","what":"Bayesian treatment effect weight estimation using bayesweight_cen","title":"Longitudinal causal analysis with informative right-censoring","text":"Next, use bayesweight_cen function estimate weights censoring. specify treatment censoring models time point, including relevant covariates. trtmodel.list: list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. cenmodel.list: list formulas censoring model censoring indicators left hand side covariates prior censoring indicators right hand side. data: dataset containing variables specified trtmodel.list. n.iter: Total number iterations chain (including burn-). n.burnin: Number iterations discard beginning simulation (burn-). n.thin: Thinning rate MCMC sampler. n.chains: Number MCMC chains run. non-parallel execution, set 1. parallel execution, requires least 2 chains. seed: Seed ensure reproducibility. parallel: Logical flag indicating whether run MCMC chains parallel. Default TRUE. Similarly, function automatically run MCMC JAGS based specified treatment censoring model inputs, saving JAGS model file working directory model customization. function returns list containing updated weights subject-specific treatment censoring effects.","code":"weights <- 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), data = simdat_cen, n.iter = 250, n.burnin = 150, n.thin = 5, n.chains = 1, seed = 890123, parallel = FALSE) #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 4836 #> Unobserved stochastic nodes: 44 #> Total graph size: 16501 #> #> Initializing model summary(weights) #> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's #> 0.2191 1.2419 2.1838 3.9613 5.1154 53.1423 136"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"bayesian-non-parametric-bootstrap-to-maximize-the-utility-function-with-respect-to-the-causal-effect-using-bayesmsm","dir":"Articles","previous_headings":"","what":"Bayesian non-parametric bootstrap to maximize the utility function with respect to the causal effect using bayesmsm","title":"Longitudinal causal analysis with informative right-censoring","text":"Using weights estimated bayesweight_cen, now fit Bayesian Marginal Structural Model estimate marginal treatment effects using bayesmsm function . specify outcome model relevant parameters. bayesmsm function returns model object containing following: mean, standard deviation, 95% credible interval Risk Difference (RD), Risk Ratio (RR), Odds Ratio (). also includes data frame containing bootstrap samples reference effect, comparator effect, RD, RR, , well reference comparator levels chosen user. can extract visualize results follows:","code":"# Remove all NAs (censored observations) from the original dataset and weights simdat_cen <- na.omit(simdat_cen) weights <- na.omit(weights) model <- bayesmsm(ymodel = Y ~ A1+A2+A3, nvisit = 3, reference = c(rep(0, 3)), comparator = c(rep(1, 3)), family = \"binomial\", data = simdat_cen, wmean = weights, nboot = 364, optim_method = \"BFGS\", parallel = FALSE, seed = 890123, ncore = 1) str(model) #> List of 12 #> $ RD_mean : num 0.308 #> $ RR_mean : num 1.84 #> $ OR_mean : num 4.48 #> $ RD_sd : num 0.124 #> $ RR_sd : num 0.507 #> $ OR_sd : num 2.87 #> $ RD_quantile: Named num [1:2] 0.0792 0.5402 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ RR_quantile: Named num [1:2] 1.14 3.13 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ OR_quantile: Named num [1:2] 1.39 11.29 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ bootdata :'data.frame': 364 obs. of 5 variables: #> ..$ effect_reference : num [1:364] -0.7733 -0.9519 -0.1119 -0.6218 0.0165 ... #> ..$ effect_comparator: num [1:364] 1.374 1.12 0.853 1.195 0.504 ... #> ..$ RD : num [1:364] 0.482 0.476 0.229 0.418 0.119 ... #> ..$ RR : num [1:364] 2.53 2.71 1.49 2.2 1.24 ... #> ..$ OR : num [1:364] 8.56 7.94 2.62 6.15 1.63 ... #> $ reference : num [1:3] 0 0 0 #> $ comparator : num [1:3] 1 1 1 # Extract results head(model$bootdata) #> effect_reference effect_comparator RD RR OR #> 1 -0.77330885 1.3741127 0.4822800 2.527344 8.562751 #> 2 -0.95194861 1.1201767 0.4755284 2.707505 7.941684 #> 3 -0.11185065 0.8530526 0.2291406 1.485399 2.624534 #> 4 -0.62184259 1.1949757 0.4182673 2.197230 6.152253 #> 5 0.01652478 0.5042640 0.1193298 1.236704 1.628630 #> 6 -0.27175158 0.8775624 0.2738397 1.633189 3.156027"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"visualization-functions-plot_ate-plot_apo-plot_est_box","dir":"Articles","previous_headings":"","what":"Visualization functions: plot_ATE, plot_APO, plot_est_box","title":"Longitudinal causal analysis with informative right-censoring","text":"Similarly, can use built-functions well summary_bayesmsm visualize summarize results. plot_ATE function generates plot estimated ATE 95% credible interval. plot_APO function plots estimated APO reference comparator level effects. plot_est_box function generates error bar plot estimated treatment effects (APO ATE) bootstrap samples. summary_bayesmsm function automatically generates summary table model output function bayesmsm.","code":"plot_ATE(model) plot_APO(model, effect_type = \"effect_comparator\") plot_APO(model, effect_type = \"effect_reference\") plot_est_box(model) summary_bayesmsm(model) #> mean sd 2.5% 97.5% #> Reference -0.3648858 0.3505655 -1.11200604 0.2898218 #> Comparator 0.9691181 0.3111957 0.38740379 1.5981192 #> RD 0.3083083 0.1238811 0.07919336 0.5402016 #> RR 1.8412739 0.5071578 1.14213799 3.1259907 #> OR 4.4819705 2.8740524 1.39094085 11.2924450"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"reference","dir":"Articles","previous_headings":"","what":"Reference","title":"Longitudinal causal analysis with informative right-censoring","text":"Liu, K. (2021). Bayesian causal inference longitudinal data. Tspace.library.utoronto.ca. https://tspace.library.utoronto.ca/handle/1807/109330 Saarela, O., Stephens, D. ., Moodie, E. E. M., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279–288. https://doi.org/10.1111/biom.12269 Robins, J. M., Hernán, M. ., & Brumback, B. (2000). Marginal structural models causal inference epidemiology. Epidemiology, 11(5), 550–560. https://doi.org/10.1097/00001648-200009000-00011 Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical Methods Medical Research, 29(9), 2507–2519. https://doi.org/10.1177/0962280219900362","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Longitudinal causal analysis without censoring","text":"bayesmsm package enables easy implementation Bayesian marginal structural models (BMSMs) longitudinal data. methodology BMSMs can divided 2 estimation steps: Step 1. Bayesian treatment effect weight estimation Step 2. Bayesian non-parametric bootstrap maximize utility function respect causal effect Step 1, estimate treatment weights wijw_{ij} using posterior samples α\\alpha β\\beta via fitting series logistic regressions Bayesian framework. package incorporates Inverse Probability Treatment Weighting (IPTW) Inverse Probability Censoring Weighting (IPCW) handle longitudinal data without right-censoring. Step 2, Pn(vij)P_n(v_{ij}) estimated via non-parametric Bayesian bootstrap Dir(1,...,1)Dir(1,...,1) sampling weights. main functions package include: bayesweight: Calculates Bayesian weights subject-specific treatment effects. bayesweight_cen: Calculates Bayesian weights subject-specific treatment effects right-censored data. bayesmsm: Estimates marginal structural models using calculated Bayesian weights. plot_ATE: Plots estimated Average Treatment Effect (ATE). plot_APO: Plots estimated Average Potential Outcome (APO). plot_est_box: Plots distribution estimated treatment effects. summary_bayesmsm: Summarizes model results bayesmsm. Installation install bayesmsm package, can use devtools package install directly GitHub:","code":"devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"simulated-observational-data-with-a-time-dependent-treatment","dir":"Articles","previous_headings":"","what":"Simulated observational data with a time-dependent treatment","title":"Longitudinal causal analysis without censoring","text":"1000 patients 3 visits (2 patients assigned treatment) y, end--study continuous outcome z, binary treatment w1 w2 two baseline covariates (one continuous one binary, mimicking age sex) L1 L2 two time-dependent covariates (also one continuous one binary) missing data simulated DAG Frequency Counts Treatment Combinations Suppose causal parameter interest average treatment effect always treated never treated, ATE=E(Y∣Z1=1,Z2=1)−E(Y∣Z1=0,Z2=0) ATE = E(Y \\mid Z_1 = 1, Z_2 = 1) - E(Y \\mid Z_1 = 0, Z_2 = 0)","code":"library(DiagrammeR) grViz(\" digraph causal { # Nodes node [shape=plaintext] W [label = 'w1, w2'] L1 [label = 'L11, L21'] Z1 [label = 'Z1'] L2 [label = 'L12, L22'] Z2 [label = 'Z2'] Y [label = 'Y'] # Edges edge [color=black, arrowhead=vee] rankdir = LR W->L1 W->Z1 W->L2 W->Z2 W->Y L1->Z1 L1->L2 L1->Z2 L1->Y Z1->L2 Z1->Z2 Z1->Y L2->Z2 L2->Y Z2->Y # Graph graph [overlap=true, fontsize=14] }\") library(DT) options(scipen = 999) testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) # look at the data; datatable(testdata, rownames = FALSE, options = list(dom = 't')) %>% formatRound(columns=c('w2', 'L2_1', 'L2_2', 'y'), digits=2) # frequency counts by treatment combinations; table(testdata$a_1, testdata$a_2) #> #> 0 1 #> 0 520 201 #> 1 111 168"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"bayesian-treatment-effect-weight-estimation-using-bayesweight","dir":"Articles","previous_headings":"","what":"Bayesian treatment effect weight estimation using bayesweight","title":"Longitudinal causal analysis without censoring","text":"Non-parallel computing requires n.chains = 1. Parallel MCMC requires least 2 chains computing running 1 core per chain, recommend using 2 chains less number available cores computer. Running function automatically saves JAGS model file working directory, user can check review model specifications. trtmodel.list: list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. data: dataset containing variables specified trtmodel.list. n.iter: Total number iterations chain (including burn-). n.burnin: Number iterations discard beginning simulation (burn-). n.thin: Thinning rate MCMC sampler. n.chains: Number MCMC chains run. non-parallel execution, set 1. parallel execution, requires least 2 chains. seed: Seed ensure reproducibility. parallel: Logical flag indicating whether run MCMC chains parallel. Default TRUE. weights: calculated weights subject-specific treatment effects.","code":"weights <- bayesweight(trtmodel.list = list(a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1), data = testdata, n.iter = 2000, n.burnin = 1000, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE) str(weights) #> num [1:1000] 1.234 1.134 1.021 0.82 0.795 ..."},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"bayesian-non-parametric-bootstrap-to-maximize-the-utility-function-with-respect-to-the-causal-effect-using-bayesmsm","dir":"Articles","previous_headings":"","what":"Bayesian non-parametric bootstrap to maximize the utility function with respect to the causal effect using bayesmsm","title":"Longitudinal causal analysis without censoring","text":"function bayesmsm estimates causal effect time-varying treatments. uses subject-specific treatment assignmennt weights weights calculated using bayesweight, performs Bayesian non-parametric bootstrap estimate causal parameters. ymodel: formula representing outcome model, can include interactions functions covariates. nvisit: Specifies number visits time points considered model. reference: baseline reference intervention across visits, typically represented vector zeros indicating treatment (default vector zeros). comparator: comparison intervention across visits, typically represented vector ones indicating full treatment (default vector ones). family: Specifies outcome distribution family; use “gaussian” continuous outcomes “binomial” binary outcomes (default “gaussian”). data: dataset containing variables required model. wmean: vector treatment assignment weights. Default vector ones, implying equal weighting. nboot: number bootstrap iterations perform estimating uncertainty around causal estimates. optim_method: optimization method used find best parameters model (default ‘BFGS’). seed: seed value ensure reproducibility results. parallel: logical flag indicating whether perform computations parallel (default TRUE). ncore: number cores use parallel computation (default 4). mean, sd, quantile: mean, standard deviation 95% credible interval estimated causal effect (ATE). results, mean ATE approximately -3.161, indicates expected outcome always treated patients , average, 3.161 units less never treated patients. bootdata: data frame containing bootstrap samples reference effect, comparator effect, average treatment effect (ATE). reference, comparator: reference level comparator level user chooses compare. reference level never treated (0,0), comparator level always treated (1,1).","code":"model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = weights, nboot = 1000, optim_method = \"BFGS\", parallel = TRUE, seed = 890123, ncore = 2) str(model) #> List of 6 #> $ RD_mean : num -3.16 #> $ RD_sd : num 0.0948 #> $ RD_quantile: Named num [1:2] -3.34 -2.98 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ bootdata :'data.frame': 1000 obs. of 3 variables: #> ..$ effect_reference : num [1:1000] 2.36 2.29 2.26 2.34 2.31 ... #> ..$ effect_comparator: num [1:1000] -0.946 -0.825 -0.754 -0.796 -0.764 ... #> ..$ RD : num [1:1000] -3.31 -3.11 -3.02 -3.13 -3.08 ... #> $ reference : num [1:2] 0 0 #> $ comparator : num [1:2] 1 1"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"visualization-functions-plot_ate-plot_apo-plot_est_box","dir":"Articles","previous_headings":"","what":"Visualization functions: plot_ATE, plot_APO, plot_est_box","title":"Longitudinal causal analysis without censoring","text":"bayesmsm package also provides several functions visualizing results: plot_ATE, plot_APO, plot_est_box. functions help user better interpret estimated causal effects. plot_ATE function generates plot estimated ATE 95% credible interval. Similarly, plot_APO function plots estimated APO reference comparator level effects. plot_est_box function generates error bar plot estimated treatment effects (APO ATE) bootstrap samples.","code":"plot_ATE(model) plot_APO(model, \"effect_reference\") plot_APO(model, \"effect_comparator\") plot_est_box(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"reference","dir":"Articles","previous_headings":"","what":"Reference","title":"Longitudinal causal analysis without censoring","text":"Liu, K. (2021). Bayesian causal inference longitudinal data. Tspace.library.utoronto.ca. https://tspace.library.utoronto.ca/handle/1807/109330 Saarela, O., Stephens, D. ., Moodie, E. E. M., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279–288. https://doi.org/10.1111/biom.12269 Robins, J. M., Hernán, M. ., & Brumback, B. (2000). Marginal structural models causal inference epidemiology. Epidemiology, 11(5), 550–560. https://doi.org/10.1097/00001648-200009000-00011 Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical Methods Medical Research, 29(9), 2507–2519. https://doi.org/10.1177/0962280219900362","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kuan Liu. Author, maintainer. https://Kuan-Liu.com/ Xiao Yan. Author. https://www.linkedin.com//xiaoyan1596/ Martin Urner. Author. https://criticalcaretoronto.com/-fellows/dr-martin-urner/","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Liu K, Yan X, Urner M (2024). bayesmsm: Fitting Bayesian Marginal Structural Models Longitudinal observational Data. R package version 0.1.0, https://github.com/Kuan-Liu-Lab/bayesmsm, https://kuan-liu-lab.github.io/bayesmsm/.","code":"@Manual{, title = {bayesmsm: Fitting Bayesian Marginal Structural Models for Longitudinal observational Data}, author = {Kuan Liu and Xiao Yan and Martin Urner}, year = {2024}, note = {R package version 0.1.0, https://github.com/Kuan-Liu-Lab/bayesmsm}, url = {https://kuan-liu-lab.github.io/bayesmsm/}, }"},{"path":[]},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"overview","dir":"","previous_headings":"","what":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"bayesmsm R package implements Bayesian marginal structrual models estimate average treatment effect drawing causal inference time-varying treatment assignment confoudning extension handle informative right-censoring. Bayesian marginal structural models semi-parametric approach features two-step estimation process. first step involves Bayesian parametric estimation time-varying treatment assignment models second step involves non-parametric Bayesian bootstrap estimate average treatment effect two distinct treatment sequences interest. Reference paper Bayesian marginal structural models: Saarela, O., Stephens, D. ., Moodie, E. E., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279-288. Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical methods medical research, 29(9), 2507-2519.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"Install using devtools package:","code":"## install.packages(devtools) ## make sure to have devtools installed devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"dependency","dir":"","previous_headings":"","what":"Dependency","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"package depends following R packages: MCMCpack doParallel foreach parallel R2jags coda","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"quickstart","dir":"","previous_headings":"","what":"Quickstart","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"examples demonstrating use bayesmsm package:","code":"# Load example data testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) # Calculate Bayesian weights weights <- bayesweight( trtmodel.list = list( a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1 ), data = testdata, n.iter = 250, n.burnin = 150, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE ) # Perform Bayesian non-parametric bootstrap model <- bayesmsm( ymodel = y ~ a_1 + a_2, nvisit = 2, reference = c(rep(0, 2)), comparator = c(rep(1, 2)), family = \"gaussian\", data = testdata, wmean = weights, nboot = 1000, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2 ) # View model summary summary.bayesmsm(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"package licensed MIT License. See LICENSE file details.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"Please cite software using:","code":"@Manual{, title = {bayesmsm: An R package for longitudinal causal analysis using Bayesian Marginal Structural Models}, author = {Xiao Yan and Martin Urner and Olli Saarela and Kuan Liu}, year = {2024}, note = { https://github.com/Kuan-Liu-Lab/bayesmsm}, url = {https://kuan-liu-lab.github.io/bayesmsm/}, }"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"contact","dir":"","previous_headings":"","what":"Contact","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"e-mail: kuan.liu@utoronto.ca, Clarence.YXA@gmail.com Please report bugs opening issue.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"function performs Bayesian non-parametric bootstrap estimate causal effects Bayesian marginal structural models. supports continuous (gaussian) binary (binomial) outcome variables.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"","code":"bayesmsm( ymodel, nvisit, reference = c(rep(0, nvisit)), comparator = c(rep(1, nvisit)), family = \"gaussian\", data, wmean = rep(1, nrow(data)), nboot = 1000, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 6 )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"ymodel formula representing outcome model interactions. nvisit Number visits time points. reference Reference intervention across visits. Default vector 0's length nvisit (.e. never treated). comparator Comparison intervention across visits. Default vector 1's length nvisit (.e. always treated). family Outcome distribution family; \"gaussian\" (default) continuous outcomes \"binomial\" binary outcomes. data dataset. wmean Vector treatment assignment weights. Default rep(1, 1000). nboot Number bootstrap iterations. optim_method Optimization method used. Default 'BFGS'. seed seed ensure reproducibility. parallel Whether parallel computation used. Default TRUE. ncore Number cores use parallel computation. Default 4.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"returns object class `bayesmsm` contains information data, model, etc. object class `bayesmsm` list containing least following components: * `mean`, mean bootstrap estimates * `sd`, standard deviation bootstrap estimates * `quantile`, 95 * `bootdata`, data frame bootstrapped estimates * `reference`, reference intervention level * `comparator`, camparison intervention level","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"function estimates Bayesian weights time-varying treatment effects using specified models treatment time point. uses JAGS Bayesian inference supports parallel computation speed MCMC simulations.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"","code":"bayesweight( trtmodel.list, data, n.chains = 2, n.iter = 25000, n.burnin = 15000, n.thin = 5, seed = 890123, parallel = TRUE )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"trtmodel.list list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. data dataframe containing variables mentioned `trtmodel.list`. n.chains number MCMC chains run. Set 1 non-parallel computation. parallel computation, required use least 2 chains. n.iter total number iterations chain (including burn-). n.burnin number burn-iterations chain. n.thin Thinning rate MCMC sampler. seed seed ensure reproducibility. parallel Logical. Indicates whether run MCMC chains parallel. Default TRUE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"list calculated weights.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) weights <- bayesweight(trtmodel.list = list(a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1), data = testdata, n.iter = 2500, n.burnin = 1500, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"function computes posterior mean weights using Bayesian estimation treatment models censoring models across multiple time points. models can run parallel estimate weights needed causal inference censored data.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"","code":"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), data, n.iter = 2500, n.burnin = 1500, n.thin = 5, parallel = FALSE, n.chains = 1, seed = 890123 )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"trtmodel.list list formulas corresponding time point time-specific treatment variable left-hand side pre-treatment covariates balanced right-hand side. Interactions functions covariates allowed. cenmodel.list list formulas censoring data time point, censoring indicators left-hand side covariates right-hand side. data data frame containing variables models (treatment, censoring, covariates). n.iter Number iterations run MCMC algorithm JAGS. n.burnin Number iterations discard burn-MCMC algorithm. n.thin Thinning rate MCMC samples. parallel Logical, indicating whether run MCMC sampling parallel (default `FALSE`). n.chains Number MCMC chains run. parallel `TRUE`, specifies number chains run parallel. seed seed random number generation ensure reproducibility MCMC.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"vector posterior mean weights, computed taking average weights across MCMC iterations.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"","code":"simdat_cen <- read.csv(system.file(\"extdata\", \"sim_causal.csv\", package = \"bayesmsm\")) weights_cen <- 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), data = simdat_cen, n.iter = 2500, n.burnin = 1500, n.thin = 5, parallel = FALSE, n.chains = 1, seed = 890123) #> module glm loaded #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 4836 #> Unobserved stochastic nodes: 44 #> Total graph size: 16501 #> #> Initializing model #> #> Warning: Some parameters have not converged with Geweke index > 1.96. More iterations may be needed."},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":null,"dir":"Reference","previous_headings":"","what":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"function calculate effect intervention given parameter estimates intervention levels","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"","code":"calculate_effect(intervention_levels, variables, param_estimates)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"intervention_levels numeric vector indicating levels intervention predictor variable. variables list names response variable predictor variables extracted model. param_estimates vector parameter estimates model.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"numeric value representing calculated effect specified intervention.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Average Potential Outcomes (APO) — plot_APO","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"function plots density APO specified effect type bootstrap simulation results.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"","code":"plot_APO(input, effect_type, ...)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"input data frame model object containing 'bootdata', include 'effect_comparator' 'effect_reference' columns. effect_type character string specifying effect plot: 'effect_comparator' 'effect_reference'. ... Additional arguments passed plotting function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"density plot showing distribution specified average potential outcome (reference comparison).","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = FALSE, ncore = 2) plot_APO(model$bootdata, effect_type = \"effect_comparator\") plot_APO(model, effect_type = \"effect_reference\")"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"Plot Average Treatment Effect Density Bootstrap Results","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"","code":"plot_ATE( input, ATE = \"RD\", col_density = \"blue\", fill_density = \"lightblue\", main = \"Posterior Predictive Distribution of Average Treatment Effect\", xlab = \"ATE\", ylab = \"Posterior Predictive Distribution\", xlim = NULL, ylim = NULL, ... )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"input model object, data frame vector containing bootstrap estimates ATE. ATE define causal estimand interest RD, , RR. col_density Color density plot (default \"blue\"). fill_density Fill color density plot (default \"lightblue\"). main Title plot (default \"Density ATE Estimates\"). xlab X-axis label (default \"ATE\"). ylab Y-axis label (default \"Density\"). xlim Limits x-axis (default NULL). ylim Limits y-axis (default NULL). ... Additional graphical parameters passed plot function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = TRUE, ncore = 2) plot_ATE(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":null,"dir":"Reference","previous_headings":"","what":"Error bar plots for treatment effects — plot_est_box","title":"Error bar plots for treatment effects — plot_est_box","text":"Error bar plots treatment effects","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Error bar plots for treatment effects — plot_est_box","text":"","code":"plot_est_box(input, ...)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Error bar plots for treatment effects — plot_est_box","text":"input data frame model object containing 'bootdata', include 'effect_comparator', 'effect_reference', 'RD' columns. ... Additional arguments passed plotting function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Error bar plots for treatment effects — plot_est_box","text":"error bar plot mean effects 95% confidence intervals comparator level, reference level, ATE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Error bar plots for treatment effects — plot_est_box","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = FALSE, ncore = 2) plot_est_box(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary function to generate result table from bayesmsm — summary_bayesmsm","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"Summary function generate result table bayesmsm","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"","code":"summary_bayesmsm(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"model model object bayesmsm","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"summary table results bayesmsm.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2) summary_bayesmsm(model) #> mean sd 2.5% 97.5% #> Reference 2.3085940 0.04479799 2.2341584 2.406479 #> Comparator -0.8348404 0.07909260 -0.9703483 -0.698226 #> RD -3.1434345 0.09738841 -3.3193351 -2.961105"}] +[{"path":"https://kuan-liu-lab.github.io/bayesmsm/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 bayesmsm authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Longitudinal causal analysis with informative right-censoring","text":"bayesmsm package enables easy implementation Bayesian marginal structural models (BMSMs) longitudinal data. methodology BMSMs can divided 2 estimation steps: Step 1. Bayesian treatment effect weight estimation Step 2. Bayesian non-parametric bootstrap maximize utility function respect causal effect Step 1, estimate treatment weights wijw_{ij} using posterior samples α\\alpha β\\beta via fitting series logistic regressions Bayesian framework. package incorporates Inverse Probability Treatment Weighting (IPTW) Inverse Probability Censoring Weighting (IPCW) handle longitudinal data without right-censoring. Step 2, Pn(vij)P_n(v_{ij}) estimated via non-parametric Bayesian bootstrap Dir(1,...,1)Dir(1,...,1) sampling weights. main functions package include: bayesweight: Calculates Bayesian weights subject-specific treatment effects. bayesweight_cen: Calculates Bayesian weights subject-specific treatment effects right-censored data. bayesmsm: Estimates marginal structural models using calculated Bayesian weights. plot_ATE: Plots estimated Average Treatment Effect (ATE). plot_APO: Plots estimated Average Potential Outcome (APO). plot_est_box: Plots distribution estimated treatment effects. summary_bayesmsm: Summarizes model results bayesmsm. Installation install bayesmsm package, can use devtools package install directly GitHub:","code":"devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"simulated-observational-data-with-right-censoring","dir":"Articles","previous_headings":"","what":"Simulated observational data with right-censoring","title":"Longitudinal causal analysis with informative right-censoring","text":"illustrate implementation bayesmsm package using simulated dataset. simulated dataset contains right-censoring binary end--study outcome. example provide comprehensive understanding apply package real-world data.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"dataset-introduction","dir":"Articles","previous_headings":"","what":"Dataset Introduction","title":"Longitudinal causal analysis with informative right-censoring","text":"simulation study, use simulated longitudinal dataset mimic complex real-world clinical data right-censoring. dataset consists 500 patients observed 3 visits. binary outcome variable represents end--study status patients. dataset includes baseline covariates L11L11 L21L21, L11L11 binary L21L21 continuous. Time-dependent covariates L12L12 L22L22 observed second visit, L13L13 L23L23 third visit. treatment variables represented A1A1, A2A2, A3A3 three visits. Right-censoring indicators represented C1C1, C2C2, C3C3. example, observations C1=1C1 = 1, records visit 1 censored. Description Simulated Right-Censored Dataset","code":"# simulating causal data with censoring; simdat_cen <- read.csv(system.file(\"extdata\", \"sim_causal.csv\", package = \"bayesmsm\")) # look at the data; head(simdat_cen) #> L11 L21 A1 L12 L22 A2 L13 L23 A3 C1 C2 C3 Y #> 1 0 -0.37560287 NA NA NA NA NA NA NA 1 NA NA NA #> 2 1 -0.56187636 NA NA NA NA NA NA NA 1 NA NA NA #> 3 0 -0.34391723 1 1 -0.8053290 1 1 -2.5508298 1 0 0 0 0 #> 4 1 0.09049665 1 1 -1.7754302 1 1 -2.2849997 0 0 0 0 0 #> 5 1 1.59850877 1 1 0.5604468 1 0 2.1787137 0 0 0 0 1 #> 6 0 -0.08856511 0 0 1.4798603 0 1 0.7025151 0 0 0 0 1"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"bayesian-treatment-effect-weight-estimation-using-bayesweight_cen","dir":"Articles","previous_headings":"","what":"Bayesian treatment effect weight estimation using bayesweight_cen","title":"Longitudinal causal analysis with informative right-censoring","text":"Next, use bayesweight_cen function estimate weights censoring. specify treatment censoring models time point, including relevant covariates. trtmodel.list: list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. cenmodel.list: list formulas censoring model censoring indicators left hand side covariates prior censoring indicators right hand side. data: dataset containing variables specified trtmodel.list. n.iter: Total number iterations chain (including burn-). n.burnin: Number iterations discard beginning simulation (burn-). n.thin: Thinning rate MCMC sampler. n.chains: Number MCMC chains run. non-parallel execution, set 1. parallel execution, requires least 2 chains. seed: Seed ensure reproducibility. parallel: Logical flag indicating whether run MCMC chains parallel. Default TRUE. Similarly, function automatically run MCMC JAGS based specified treatment censoring model inputs, saving JAGS model file working directory model customization. function returns list containing updated weights subject-specific treatment censoring effects.","code":"weights <- 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), data = simdat_cen, n.iter = 250, n.burnin = 150, n.thin = 5, n.chains = 1, seed = 890123, parallel = FALSE) #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 4836 #> Unobserved stochastic nodes: 44 #> Total graph size: 16501 #> #> Initializing model summary(weights) #> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's #> 0.2191 1.2419 2.1838 3.9613 5.1154 53.1423 136"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"bayesian-non-parametric-bootstrap-to-maximize-the-utility-function-with-respect-to-the-causal-effect-using-bayesmsm","dir":"Articles","previous_headings":"","what":"Bayesian non-parametric bootstrap to maximize the utility function with respect to the causal effect using bayesmsm","title":"Longitudinal causal analysis with informative right-censoring","text":"Using weights estimated bayesweight_cen, now fit Bayesian Marginal Structural Model estimate marginal treatment effects using bayesmsm function . specify outcome model relevant parameters. bayesmsm function returns model object containing following: mean, standard deviation, 95% credible interval Risk Difference (RD), Risk Ratio (RR), Odds Ratio (). also includes data frame containing bootstrap samples reference effect, comparator effect, RD, RR, , well reference comparator levels chosen user. can extract visualize results follows:","code":"# Remove all NAs (censored observations) from the original dataset and weights simdat_cen <- na.omit(simdat_cen) weights <- na.omit(weights) model <- bayesmsm(ymodel = Y ~ A1+A2+A3, nvisit = 3, reference = c(rep(0, 3)), comparator = c(rep(1, 3)), family = \"binomial\", data = simdat_cen, wmean = weights, nboot = 364, optim_method = \"BFGS\", parallel = FALSE, seed = 890123, ncore = 1) str(model) #> List of 12 #> $ RD_mean : num 0.308 #> $ RR_mean : num 1.84 #> $ OR_mean : num 4.48 #> $ RD_sd : num 0.124 #> $ RR_sd : num 0.507 #> $ OR_sd : num 2.87 #> $ RD_quantile: Named num [1:2] 0.0792 0.5402 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ RR_quantile: Named num [1:2] 1.14 3.13 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ OR_quantile: Named num [1:2] 1.39 11.29 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ bootdata :'data.frame': 364 obs. of 5 variables: #> ..$ effect_reference : num [1:364] -0.7733 -0.9519 -0.1119 -0.6218 0.0165 ... #> ..$ effect_comparator: num [1:364] 1.374 1.12 0.853 1.195 0.504 ... #> ..$ RD : num [1:364] 0.482 0.476 0.229 0.418 0.119 ... #> ..$ RR : num [1:364] 2.53 2.71 1.49 2.2 1.24 ... #> ..$ OR : num [1:364] 8.56 7.94 2.62 6.15 1.63 ... #> $ reference : num [1:3] 0 0 0 #> $ comparator : num [1:3] 1 1 1 # Extract results head(model$bootdata) #> effect_reference effect_comparator RD RR OR #> 1 -0.77330885 1.3741127 0.4822800 2.527344 8.562751 #> 2 -0.95194861 1.1201767 0.4755284 2.707505 7.941684 #> 3 -0.11185065 0.8530526 0.2291406 1.485399 2.624534 #> 4 -0.62184259 1.1949757 0.4182673 2.197230 6.152253 #> 5 0.01652478 0.5042640 0.1193298 1.236704 1.628630 #> 6 -0.27175158 0.8775624 0.2738397 1.633189 3.156027"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"visualization-functions-plot_ate-plot_apo-plot_est_box","dir":"Articles","previous_headings":"","what":"Visualization functions: plot_ATE, plot_APO, plot_est_box","title":"Longitudinal causal analysis with informative right-censoring","text":"Similarly, can use built-functions well summary_bayesmsm visualize summarize results. plot_ATE function generates plot estimated ATE 95% credible interval. plot_APO function plots estimated APO reference comparator level effects. plot_est_box function generates error bar plot estimated treatment effects (APO ATE) bootstrap samples. summary_bayesmsm function automatically generates summary table model output function bayesmsm.","code":"plot_ATE(model) plot_APO(model, effect_type = \"effect_comparator\") plot_APO(model, effect_type = \"effect_reference\") plot_est_box(model) summary_bayesmsm(model) #> mean sd 2.5% 97.5% #> Reference -0.3648858 0.3505655 -1.11200604 0.2898218 #> Comparator 0.9691181 0.3111957 0.38740379 1.5981192 #> RD 0.3083083 0.1238811 0.07919336 0.5402016 #> RR 1.8412739 0.5071578 1.14213799 3.1259907 #> OR 4.4819705 2.8740524 1.39094085 11.2924450"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-censoring.html","id":"reference","dir":"Articles","previous_headings":"","what":"Reference","title":"Longitudinal causal analysis with informative right-censoring","text":"Liu, K. (2021). Bayesian causal inference longitudinal data. Tspace.library.utoronto.ca. https://tspace.library.utoronto.ca/handle/1807/109330 Saarela, O., Stephens, D. ., Moodie, E. E. M., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279–288. https://doi.org/10.1111/biom.12269 Robins, J. M., Hernán, M. ., & Brumback, B. (2000). Marginal structural models causal inference epidemiology. Epidemiology, 11(5), 550–560. https://doi.org/10.1097/00001648-200009000-00011 Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical Methods Medical Research, 29(9), 2507–2519. https://doi.org/10.1177/0962280219900362","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Longitudinal causal analysis without censoring","text":"bayesmsm package enables easy implementation Bayesian marginal structural models (BMSMs) longitudinal data. methodology BMSMs can divided 2 estimation steps: Step 1. Bayesian treatment effect weight estimation Step 2. Bayesian non-parametric bootstrap maximize utility function respect causal effect Step 1, estimate treatment weights wijw_{ij} using posterior samples α\\alpha β\\beta via fitting series logistic regressions Bayesian framework. package incorporates Inverse Probability Treatment Weighting (IPTW) Inverse Probability Censoring Weighting (IPCW) handle longitudinal data without right-censoring. Step 2, Pn(vij)P_n(v_{ij}) estimated via non-parametric Bayesian bootstrap Dir(1,...,1)Dir(1,...,1) sampling weights. main functions package include: bayesweight: Calculates Bayesian weights subject-specific treatment effects. bayesweight_cen: Calculates Bayesian weights subject-specific treatment effects right-censored data. bayesmsm: Estimates marginal structural models using calculated Bayesian weights. plot_ATE: Plots estimated Average Treatment Effect (ATE). plot_APO: Plots estimated Average Potential Outcome (APO). plot_est_box: Plots distribution estimated treatment effects. summary_bayesmsm: Summarizes model results bayesmsm. Installation install bayesmsm package, can use devtools package install directly GitHub:","code":"devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"simulated-observational-data-with-a-time-dependent-treatment","dir":"Articles","previous_headings":"","what":"Simulated observational data with a time-dependent treatment","title":"Longitudinal causal analysis without censoring","text":"1000 patients 3 visits (2 patients assigned treatment) y, end--study continuous outcome z, binary treatment w1 w2 two baseline covariates (one continuous one binary, mimicking age sex) L1 L2 two time-dependent covariates (also one continuous one binary) missing data simulated DAG Frequency Counts Treatment Combinations Suppose causal parameter interest average treatment effect always treated never treated, ATE=E(Y∣Z1=1,Z2=1)−E(Y∣Z1=0,Z2=0) ATE = E(Y \\mid Z_1 = 1, Z_2 = 1) - E(Y \\mid Z_1 = 0, Z_2 = 0)","code":"library(DiagrammeR) grViz(\" digraph causal { # Nodes node [shape=plaintext] W [label = 'w1, w2'] L1 [label = 'L11, L21'] Z1 [label = 'Z1'] L2 [label = 'L12, L22'] Z2 [label = 'Z2'] Y [label = 'Y'] # Edges edge [color=black, arrowhead=vee] rankdir = LR W->L1 W->Z1 W->L2 W->Z2 W->Y L1->Z1 L1->L2 L1->Z2 L1->Y Z1->L2 Z1->Z2 Z1->Y L2->Z2 L2->Y Z2->Y # Graph graph [overlap=true, fontsize=14] }\") library(DT) options(scipen = 999) testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) # look at the data; datatable(testdata, rownames = FALSE, options = list(dom = 't')) %>% formatRound(columns=c('w2', 'L2_1', 'L2_2', 'y'), digits=2) # frequency counts by treatment combinations; table(testdata$a_1, testdata$a_2) #> #> 0 1 #> 0 520 201 #> 1 111 168"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"bayesian-treatment-effect-weight-estimation-using-bayesweight","dir":"Articles","previous_headings":"","what":"Bayesian treatment effect weight estimation using bayesweight","title":"Longitudinal causal analysis without censoring","text":"Non-parallel computing requires n.chains = 1. Parallel MCMC requires least 2 chains computing running 1 core per chain, recommend using 2 chains less number available cores computer. Running function automatically saves JAGS model file working directory, user can check review model specifications. trtmodel.list: list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. data: dataset containing variables specified trtmodel.list. n.iter: Total number iterations chain (including burn-). n.burnin: Number iterations discard beginning simulation (burn-). n.thin: Thinning rate MCMC sampler. n.chains: Number MCMC chains run. non-parallel execution, set 1. parallel execution, requires least 2 chains. seed: Seed ensure reproducibility. parallel: Logical flag indicating whether run MCMC chains parallel. Default TRUE. weights: calculated weights subject-specific treatment effects.","code":"weights <- bayesweight(trtmodel.list = list(a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1), data = testdata, n.iter = 2000, n.burnin = 1000, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE) str(weights) #> num [1:1000] 1.234 1.134 1.021 0.82 0.795 ..."},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"bayesian-non-parametric-bootstrap-to-maximize-the-utility-function-with-respect-to-the-causal-effect-using-bayesmsm","dir":"Articles","previous_headings":"","what":"Bayesian non-parametric bootstrap to maximize the utility function with respect to the causal effect using bayesmsm","title":"Longitudinal causal analysis without censoring","text":"function bayesmsm estimates causal effect time-varying treatments. uses subject-specific treatment assignmennt weights weights calculated using bayesweight, performs Bayesian non-parametric bootstrap estimate causal parameters. ymodel: formula representing outcome model, can include interactions functions covariates. nvisit: Specifies number visits time points considered model. reference: baseline reference intervention across visits, typically represented vector zeros indicating treatment (default vector zeros). comparator: comparison intervention across visits, typically represented vector ones indicating full treatment (default vector ones). family: Specifies outcome distribution family; use “gaussian” continuous outcomes “binomial” binary outcomes (default “gaussian”). data: dataset containing variables required model. wmean: vector treatment assignment weights. Default vector ones, implying equal weighting. nboot: number bootstrap iterations perform estimating uncertainty around causal estimates. optim_method: optimization method used find best parameters model (default ‘BFGS’). seed: seed value ensure reproducibility results. parallel: logical flag indicating whether perform computations parallel (default TRUE). ncore: number cores use parallel computation (default 4). mean, sd, quantile: mean, standard deviation 95% credible interval estimated causal effect (ATE). results, mean ATE approximately -3.161, indicates expected outcome always treated patients , average, 3.161 units less never treated patients. bootdata: data frame containing bootstrap samples reference effect, comparator effect, average treatment effect (ATE). reference, comparator: reference level comparator level user chooses compare. reference level never treated (0,0), comparator level always treated (1,1).","code":"model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = weights, nboot = 1000, optim_method = \"BFGS\", parallel = TRUE, seed = 890123, ncore = 2) str(model) #> List of 6 #> $ RD_mean : num -3.16 #> $ RD_sd : num 0.0948 #> $ RD_quantile: Named num [1:2] -3.34 -2.98 #> ..- attr(*, \"names\")= chr [1:2] \"2.5%\" \"97.5%\" #> $ bootdata :'data.frame': 1000 obs. of 3 variables: #> ..$ effect_reference : num [1:1000] 2.36 2.29 2.26 2.34 2.31 ... #> ..$ effect_comparator: num [1:1000] -0.946 -0.825 -0.754 -0.796 -0.764 ... #> ..$ RD : num [1:1000] -3.31 -3.11 -3.02 -3.13 -3.08 ... #> $ reference : num [1:2] 0 0 #> $ comparator : num [1:2] 1 1"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"visualization-functions-plot_ate-plot_apo-plot_est_box","dir":"Articles","previous_headings":"","what":"Visualization functions: plot_ATE, plot_APO, plot_est_box","title":"Longitudinal causal analysis without censoring","text":"bayesmsm package also provides several functions visualizing results: plot_ATE, plot_APO, plot_est_box. functions help user better interpret estimated causal effects. plot_ATE function generates plot estimated ATE 95% credible interval. Similarly, plot_APO function plots estimated APO reference comparator level effects. plot_est_box function generates error bar plot estimated treatment effects (APO ATE) bootstrap samples.","code":"plot_ATE(model) plot_APO(model, \"effect_reference\") plot_APO(model, \"effect_comparator\") plot_est_box(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/articles/bayesmsm-nocensoring.html","id":"reference","dir":"Articles","previous_headings":"","what":"Reference","title":"Longitudinal causal analysis without censoring","text":"Liu, K. (2021). Bayesian causal inference longitudinal data. Tspace.library.utoronto.ca. https://tspace.library.utoronto.ca/handle/1807/109330 Saarela, O., Stephens, D. ., Moodie, E. E. M., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279–288. https://doi.org/10.1111/biom.12269 Robins, J. M., Hernán, M. ., & Brumback, B. (2000). Marginal structural models causal inference epidemiology. Epidemiology, 11(5), 550–560. https://doi.org/10.1097/00001648-200009000-00011 Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical Methods Medical Research, 29(9), 2507–2519. https://doi.org/10.1177/0962280219900362","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Kuan Liu. Author, maintainer. https://Kuan-Liu.com/ Xiao Yan. Author. https://www.linkedin.com//xiaoyan1596/ Martin Urner. Author. https://criticalcaretoronto.com/-fellows/dr-martin-urner/","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Liu K, Yan X, Urner M (2024). bayesmsm: Fitting Bayesian Marginal Structural Models Longitudinal observational Data. R package version 0.1.0, https://github.com/Kuan-Liu-Lab/bayesmsm, https://kuan-liu-lab.github.io/bayesmsm/.","code":"@Manual{, title = {bayesmsm: Fitting Bayesian Marginal Structural Models for Longitudinal observational Data}, author = {Kuan Liu and Xiao Yan and Martin Urner}, year = {2024}, note = {R package version 0.1.0, https://github.com/Kuan-Liu-Lab/bayesmsm}, url = {https://kuan-liu-lab.github.io/bayesmsm/}, }"},{"path":[]},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"overview","dir":"","previous_headings":"","what":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"bayesmsm R package implements Bayesian marginal structrual models estimate average treatment effect drawing causal inference time-varying treatment assignment confoudning extension handle informative right-censoring. Bayesian marginal structural models semi-parametric approach features two-step estimation process. first step involves Bayesian parametric estimation time-varying treatment assignment models second step involves non-parametric Bayesian bootstrap estimate average treatment effect two distinct treatment sequences interest. Reference paper Bayesian marginal structural models: Saarela, O., Stephens, D. ., Moodie, E. E., & Klein, M. B. (2015). Bayesian estimation marginal structural models. Biometrics, 71(2), 279-288. Liu, K., Saarela, O., Feldman, B. M., & Pullenayegum, E. (2020). Estimation causal effects repeatedly measured outcomes Bayesian framework. Statistical methods medical research, 29(9), 2507-2519.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"Install using devtools package:","code":"## install.packages(devtools) ## make sure to have devtools installed devtools::install_github(\"Kuan-Liu-Lab/bayesmsm\") library(bayesmsm)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"dependency","dir":"","previous_headings":"","what":"Dependency","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"package depends following R packages: MCMCpack doParallel foreach parallel R2jags coda","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"quickstart","dir":"","previous_headings":"","what":"Quickstart","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"examples demonstrating use bayesmsm package:","code":"# Load example data testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) # Calculate Bayesian weights weights <- bayesweight( trtmodel.list = list( a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1 ), data = testdata, n.iter = 250, n.burnin = 150, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE ) # Perform Bayesian non-parametric bootstrap model <- bayesmsm( ymodel = y ~ a_1 + a_2, nvisit = 2, reference = c(rep(0, 2)), comparator = c(rep(1, 2)), family = \"gaussian\", data = testdata, wmean = weights, nboot = 1000, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2 ) # View model summary summary.bayesmsm(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"package licensed MIT License. See LICENSE file details.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"Please cite software using:","code":"@Manual{, title = {bayesmsm: An R package for longitudinal causal analysis using Bayesian Marginal Structural Models}, author = {Xiao Yan and Martin Urner and Olli Saarela and Kuan Liu}, year = {2024}, note = { https://github.com/Kuan-Liu-Lab/bayesmsm}, url = {https://kuan-liu-lab.github.io/bayesmsm/}, }"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/index.html","id":"contact","dir":"","previous_headings":"","what":"Contact","title":"Fitting Bayesian Marginal Structural Models for Longitudinal observational Data","text":"e-mail: kuan.liu@utoronto.ca, Clarence.YXA@gmail.com Please report bugs opening issue.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"function performs Bayesian non-parametric bootstrap estimate causal effects Bayesian marginal structural models. supports continuous (gaussian) binary (binomial) outcome variables.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"","code":"bayesmsm( ymodel, nvisit, reference = c(rep(0, nvisit)), comparator = c(rep(1, nvisit)), family = \"gaussian\", data, wmean = rep(1, nrow(data)), nboot = 1000, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 6 )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"ymodel formula representing outcome model interactions. nvisit Number visits time points. reference Reference intervention across visits. Default vector 0's length nvisit (.e. never treated). comparator Comparison intervention across visits. Default vector 1's length nvisit (.e. always treated). family Outcome distribution family; \"gaussian\" (default) continuous outcomes \"binomial\" binary outcomes. data dataset. wmean Vector treatment assignment weights. Default rep(1, 1000). nboot Number bootstrap iterations. optim_method Optimization method used. Default 'BFGS'. seed seed ensure reproducibility. parallel Whether parallel computation used. Default TRUE. ncore Number cores use parallel computation. Default 4.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"returns object class `bayesmsm` contains information data, model, etc. object class `bayesmsm` list containing least following components: * `mean`, mean bootstrap estimates * `sd`, standard deviation bootstrap estimates * `quantile`, 95 * `bootdata`, data frame bootstrapped estimates * `reference`, reference intervention level * `comparator`, camparison intervention level","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesmsm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Marginal Structural Model Bootstrap Estimation — bayesmsm","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"function estimates Bayesian weights time-varying treatment effects using specified models treatment time point. uses JAGS Bayesian inference supports parallel computation speed MCMC simulations.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"","code":"bayesweight( trtmodel.list, data, n.chains = 2, n.iter = 25000, n.burnin = 15000, n.thin = 5, seed = 890123, parallel = TRUE )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"trtmodel.list list formulas corresponding time point time-specific treatment variable left hand side pre-treatment covariates balanced right hand side. Interactions functions covariates allowed. data dataframe containing variables mentioned `trtmodel.list`. n.chains number MCMC chains run. Set 1 non-parallel computation. parallel computation, required use least 2 chains. n.iter total number iterations chain (including burn-). n.burnin number burn-iterations chain. n.thin Thinning rate MCMC sampler. seed seed ensure reproducibility. parallel Logical. Indicates whether run MCMC chains parallel. Default TRUE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"list calculated weights.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Treatment Effect Weight Estimation Using JAGS — bayesweight","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) weights <- bayesweight(trtmodel.list = list(a_1 ~ w1 + w2 + L1_1 + L2_1, a_2 ~ w1 + w2 + L1_1 + L2_1 + L1_2 + L2_2 + a_1), data = testdata, n.iter = 2500, n.burnin = 1500, n.thin = 5, n.chains = 2, seed = 890123, parallel = TRUE)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":null,"dir":"Reference","previous_headings":"","what":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"function computes posterior mean weights using Bayesian estimation treatment models censoring models across multiple time points. models can run parallel estimate weights needed causal inference censored data.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"","code":"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), data, n.iter = 2500, n.burnin = 1500, n.thin = 5, parallel = FALSE, n.chains = 1, seed = 890123 )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"trtmodel.list list formulas corresponding time point time-specific treatment variable left-hand side pre-treatment covariates balanced right-hand side. Interactions functions covariates allowed. cenmodel.list list formulas censoring data time point, censoring indicators left-hand side covariates right-hand side. data data frame containing variables models (treatment, censoring, covariates). n.iter Number iterations run MCMC algorithm JAGS. n.burnin Number iterations discard burn-MCMC algorithm. n.thin Thinning rate MCMC samples. parallel Logical, indicating whether run MCMC sampling parallel (default `FALSE`). n.chains Number MCMC chains run. parallel `TRUE`, specifies number chains run parallel. seed seed random number generation ensure reproducibility MCMC.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"vector posterior mean weights, computed taking average weights across MCMC iterations.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/bayesweight_cen.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bayesian Weight Estimation for Censored Data — bayesweight_cen","text":"","code":"simdat_cen <- read.csv(system.file(\"extdata\", \"sim_causal.csv\", package = \"bayesmsm\")) weights_cen <- 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), data = simdat_cen, n.iter = 1500, n.burnin = 500, n.thin = 1, parallel = FALSE, n.chains = 1, seed = 890123) #> module glm loaded #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 4836 #> Unobserved stochastic nodes: 44 #> Total graph size: 16501 #> #> Initializing model #> #> Warning: Some parameters have not converged with Geweke index > 1.96. More iterations may be needed."},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":null,"dir":"Reference","previous_headings":"","what":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"function calculate effect intervention given parameter estimates intervention levels","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"","code":"calculate_effect(intervention_levels, variables, param_estimates)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"intervention_levels numeric vector indicating levels intervention predictor variable. variables list names response variable predictor variables extracted model. param_estimates vector parameter estimates model.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/calculate_effect.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"A function to calculate the effect of an intervention given the parameter estimates and intervention levels — calculate_effect","text":"numeric value representing calculated effect specified intervention.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Average Potential Outcomes (APO) — plot_APO","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"function plots density APO specified effect type bootstrap simulation results.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"","code":"plot_APO(input, effect_type, ...)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"input data frame model object containing 'bootdata', include 'effect_comparator' 'effect_reference' columns. effect_type character string specifying effect plot: 'effect_comparator' 'effect_reference'. ... Additional arguments passed plotting function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"density plot showing distribution specified average potential outcome (reference comparison).","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_APO.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Average Potential Outcomes (APO) — plot_APO","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = FALSE, ncore = 2) plot_APO(model$bootdata, effect_type = \"effect_comparator\") plot_APO(model, effect_type = \"effect_reference\")"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"Plot Average Treatment Effect Density Bootstrap Results","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"","code":"plot_ATE( input, ATE = \"RD\", col_density = \"blue\", fill_density = \"lightblue\", main = \"Posterior Predictive Distribution of Average Treatment Effect\", xlab = \"ATE\", ylab = \"Posterior Predictive Distribution\", xlim = NULL, ylim = NULL, ... )"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"input model object, data frame vector containing bootstrap estimates ATE. ATE define causal estimand interest RD, , RR. col_density Color density plot (default \"blue\"). fill_density Fill color density plot (default \"lightblue\"). main Title plot (default \"Density ATE Estimates\"). xlab X-axis label (default \"ATE\"). ylab Y-axis label (default \"Density\"). xlim Limits x-axis (default NULL). ylim Limits y-axis (default NULL). ... Additional graphical parameters passed plot function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_ATE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Average Treatment Effect Density from Bootstrap Results — plot_ATE","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = TRUE, ncore = 2) plot_ATE(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":null,"dir":"Reference","previous_headings":"","what":"Error bar plots for treatment effects — plot_est_box","title":"Error bar plots for treatment effects — plot_est_box","text":"Error bar plots treatment effects","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Error bar plots for treatment effects — plot_est_box","text":"","code":"plot_est_box(input, ...)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Error bar plots for treatment effects — plot_est_box","text":"input data frame model object containing 'bootdata', include 'effect_comparator', 'effect_reference', 'RD' columns. ... Additional arguments passed plotting function.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Error bar plots for treatment effects — plot_est_box","text":"error bar plot mean effects 95% confidence intervals comparator level, reference level, ATE.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/plot_est_box.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Error bar plots for treatment effects — plot_est_box","text":"","code":"testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", parallel = FALSE, ncore = 2) plot_est_box(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary function to generate result table from bayesmsm — summary_bayesmsm","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"Summary function generate result table bayesmsm","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"","code":"summary_bayesmsm(model)"},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"model model object bayesmsm","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"summary table results bayesmsm.","code":""},{"path":"https://kuan-liu-lab.github.io/bayesmsm/reference/summary_bayesmsm.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary function to generate result table from bayesmsm — summary_bayesmsm","text":"","code":"# Continuous outcome testdata <- read.csv(system.file(\"extdata\", \"continuous_outcome_data.csv\", package = \"bayesmsm\")) model <- bayesmsm(ymodel = y ~ a_1+a_2, nvisit = 2, reference = c(rep(0,2)), comparator = c(rep(1,2)), family = \"gaussian\", data = testdata, wmean = rep(1, 1000), nboot = 100, optim_method = \"BFGS\", seed = 890123, parallel = TRUE, ncore = 2) summary_bayesmsm(model) #> mean sd 2.5% 97.5% #> Reference 2.3085940 0.04479799 2.2341584 2.406479 #> Comparator -0.8348404 0.07909260 -0.9703483 -0.698226 #> RD -3.1434345 0.09738841 -3.3193351 -2.961105"}]