Title: | The Subtype Free Average Causal Effect |
---|---|
Description: | Estimation of the SF-ACE, a Causal Inference estimand proposed in the paper "The Subtype-Free Average Causal Effect For Heterogeneous Disease Etiology" (soon on arXiv). |
Authors: | Amit Sasson [aut, cre] |
Maintainer: | Amit Sasson <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.0 |
Built: | 2024-11-17 03:54:38 UTC |
Source: | https://github.com/cran/TheSFACE |
In order to perform the sensitivity analysis, the researcher must choose which values of lambda1 and lambda2 to explore. We give here an upper limit for lambda1 and lambda2, estimated from the data.
max_lambda(stand_formula, exposure, df, weight = 1)
max_lambda(stand_formula, exposure, df, weight = 1)
stand_formula |
A formula for standartization and DR, y ~ A + X, the outcome as a function of the exposure and covariates |
exposure |
The treatment/exposure vector pf length n. Must be encoded 1 for treated and 0 for untreated. |
df |
a data frame with columns for the outcome, exposure and covariates. |
weight |
A numerical vector of length n, holding weights to adjust for missing subtyps, Default: 1 |
a vector of two numeric values, the first element is the maximum possible lambda1 value and the second element is the maximum possible lambda2 value.
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- rep(1, n = 1000) df <- data.frame(y, A, X1, X2, weight) max_lambda(stand_formula = y ~ A + X1 + X2, exposure = "A", df = df, weight = weight)
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- rep(1, n = 1000) df <- data.frame(y, A, X1, X2, weight) max_lambda(stand_formula = y ~ A + X1 + X2, exposure = "A", df = df, weight = weight)
this function plots lists of the class "sface"
## S3 method for class 'sface' plot(x, ...)
## S3 method for class 'sface' plot(x, ...)
x |
a list of class "sface", usually the output of the function sface |
... |
not used |
a plot of the estimated SF-ACEs as a function of lambda1, lambda2 or both. The plot is separated into panels based on method and scale, and shows each subtype in a different color.
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) lst <- sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, weight = "weight", lambda1 = c(0.3, 0.5, 0.7)) plot(lst)
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) lst <- sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, weight = "weight", lambda1 = c(0.3, 0.5, 0.7)) plot(lst)
this function prints lists of the class "sface"
## S3 method for class 'sface' print(x, digits = 4, ...)
## S3 method for class 'sface' print(x, digits = 4, ...)
x |
a list of class "sface", usually the output of the function sface |
digits |
number of digits chosen for the print. Default: 4 . |
... |
not used |
This function does not return a value, it prints the estimated SF-ACEs in the chosen methods and scales.
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) lst <- sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, weight = "weight", lambda1 = c(0.3, 0.5, 0.7)) print(lst)
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) lst <- sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, weight = "weight", lambda1 = c(0.3, 0.5, 0.7)) print(lst)
A function to estimate the Subtype Free Average Causal Effect.
sface( stand_formula, iptw_formula, exposure, outcome, df, subtype = c(1, 2), scale = c("diff", "RR"), method = c("stand", "IPTW", "DR"), lambda1 = 0, lambda2 = 0, weight = 1, MultPer = 1 )
sface( stand_formula, iptw_formula, exposure, outcome, df, subtype = c(1, 2), scale = c("diff", "RR"), method = c("stand", "IPTW", "DR"), lambda1 = 0, lambda2 = 0, weight = 1, MultPer = 1 )
stand_formula |
A formula for standartization and DR, y ~ A + X, the outcome as a function of the exposure and covariates |
iptw_formula |
A formula for IPTW and DR, A ~ X, the exposure as a function of the covariates. |
exposure |
The treatment/exposure vector pf length n. Must be encoded 1 for treated and 0 for untreated. |
outcome |
The categorical outcome vector of length n. Must be encoded 0 for disease-free, 1 for the first subtype and 2 for the second subtype. |
df |
a data frame with columns for the outcome, expousre and covariates. |
subtype |
Should the SF-ACE be estimated for subtype 1 or subtype 2 |
scale |
Should the SF-ACE be estimated on the difference or risk ratio scale. |
method |
Which method to use when adjusting for covariates, possibilities include standardization ("stand"), Inverse Probability Treatment Weighting ("IPTW"), and doubly robust estimation ("DR") |
lambda1 |
sensitivity parameter for subtype 1. Can range between 0 (S-Monotonicity for subtype 1) and 1 (D-Monotonicity for subtype 1), Default: 0 |
lambda2 |
sensitivity parameter for subtype 2. Can range between 0 (S-Monotonicity for subtype 2) and 1 (D-Monotonicity for subtype 2), Default: 0 |
weight |
A numerical vector of length n, holding weights to adjust for missing subtypes, Default: 1 |
MultPer |
A numeric value indicating per how many people the effect should be calculated on the difference scale, Default: 1 |
DETALIS
a list of class "sface". In the cell "sface", there is a list holding the estimated SF_ACEs in the chosen methods and scales. In the cell "additional info", there is with additional info regarding the params used.
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, scale = c("diff","RR"), method = c("stand", "IPTW"), weight = "weight")
A <- rbinom(n = 1000, size = 1, prob = 0.5) X1 <- rbinom(n = 1000, size = 1, prob = 0.5) X2 <- rnorm(n = 1000, mean = 0, sd = 1) y <- sample(c(0,1,2), 1000, replace=TRUE, prob=c(0.8, 0.1, 0.1) ) weight <- runif(n = 1000, 0,1) df <- data.frame(y, A, X1, X2, weight) sface(stand_formula = y ~ A + X1 + X2, iptw_formula = A ~ X1 + X2, exposure = "A", outcome = "y", df = df, scale = c("diff","RR"), method = c("stand", "IPTW"), weight = "weight")