This is the source code for the GSAMU
package in R. GSAMU
is a
package aimed at providing a novel sensitivity model to investigate the
effect of correlated multiple exposures on the Gaussian, non-Gaussian,
and time-to-event outcome variables. Given a user-specified sensitivity
parameters, the sensitivity interval is calculated. See reference for
details.
Lee S, Jeong B, Lee D, Lee W (2024): Sensitivity analysis for effects of multiple exposures in the presence of unmeasured confounding: non-Gaussian and time-to-event outcomes. submitted.
Installation using R package remotes
:
if (!require("remotes", quietly=TRUE)) install.packages("remotes") # if remotes not already installed
remotes::install_github("seungjae2525/GSAMU")
library(GSAMU)
This is a basic example which shows you how to solve a common problem:
library(GSAMU)
### basic example code
## Set the bound of correlations
bound <- c(## Lower bound
# L1 L2 L3
0.01, 0.0, 0.0,
# X1, X2
rep(-0.19, 2),
# X3, X4
rep(-0.19, 2),
## Upper bound
# L1 L2 L3
0.32, 0.5, 0.29,
# X1, X2
rep(0.15, 2),
# X3, X4
rep(0.10, 2))
## For count outcome
continuous.re <- GSAMU(data=dataset,
outcome="Y", outcome.type="continuous",
link="identity", hazard.model=NULL,
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(continuous.re)
## For count outcome
count.re <- GSAMU(data=dataset,
outcome="Y", outcome.type="count",
link="log", hazard.model=NULL,
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(count.re)
## For binary outcome with logit link
binary.re1 <- GSAMU(data=dataset,
outcome="Y", outcome.type="count",
link="log", hazard.model=NULL,
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(binary.re1)
## For binary outcome with logit link
binary.re2 <- GSAMU(data=dataset,
outcome="Y", outcome.type="count",
link="log", hazard.model=NULL,
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(binary.re2)
## For time-to-event outcome with the cox PH model
cox.re <- GSAMU(data=dataset,
outcome=c("time", "status"), outcome.type="timetoevent",
link=NULL, hazard.model="coxph",
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(cox.re)
## For time-to-event outcome with the additive hazard model
ah.re <- GSAMU(data=dataset,
outcome=c("time", "status"), outcome.type="timetoevent",
link=NULL, hazard.model="ah",
confounder=c("L1", "L2", "L3"),
exposure=c("X1", "X2", "X3", "X4"),
delta=c(0.11, 0.22, 0.33, 0.44), bound=bound,
bootsCI=FALSE, B=1000, seed=231111, verbose=TRUE)
print(ah.re)
You can also resulted plots, for example:
autoplot(object=continuous.re, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
autoplot(object=count.re, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
autoplot(object=binary.re1, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
autoplot(object=binary.re2, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
autoplot(object=cox.re, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
autoplot(object=ah.re, point.size=2.75, width.SI=1.55, width.CI=0.6,
axis.title.x.size=15, axis.text.size=16, legend.text.size=15,
myxlim=c(-0.25, 2))
You can also report bugs on GitHub under Issues.