sface {TheSFACE} | R Documentation |
Subtype Free Average Causal Effect
Description
A function to estimate the Subtype Free Average Causal Effect.
Usage
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
)
Arguments
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 |
Details
DETALIS
Value
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.
See Also
Examples
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")