tm_bias {tmsens} | R Documentation |
Calculating Bias For Trimmed Mean Linear Models:
Description
tm_bias
calculates the bias and the bias-adjusted estimate for a trimmed means analysis (tm
) of a given
dataset, for a user-specified trimming fraction and dropout spread. tm_bias
calculates, under assumption
of normally distributed outcomes, the bias components resulting from violation of the
location shift assumption and violation of the strong MNAR assumption.
Usage
tm_bias(
formula,
GR,
trF,
side = c("LOW", "HIGH"),
spread_TG = "max_bias",
spread_CG = "max_bias",
data
)
Arguments
formula |
an object of class |
GR |
a string denoting the name of the binary treatment variable. This function assumes the lowest value to be the comparator/reference group |
trF |
a number between 0 and 1, specifying the trimming fraction: the proportion of the data that is trimmed away
for each treatment group. |
side |
specifies if higher value trimming ( |
spread_TG |
a number between 0 and 1, specifying the dropout spread for the treatment group.
|
spread_CG |
a number between 0 and 1, specifying the dropout spread for the comparator group.
|
data |
a data frame containing the variables in the model. |
Value
tm_bias
returns an object of class tm_bias
.
An object of class "tm_bias
" is a list containing the following components:
call |
the matched call |
bias_components |
an array of bias components, including location shift assumption bias (LS), Strong MNAR bias in the treatment group (TG) and the comparator group (CG) |
total_bias |
the sum of all bias components |
TM_estimate |
the trimmed means estimate of the treatment effect |
bias_adj_TM_estimate |
the bias adjusted trimmed means estimate |
analysis_details |
the user-specified trimming fraction, trimming side, and dropout spread in the treatment (TG) and comparator groups (CG) |
observed_TG_SD |
observed standard deviation of the treatment group (TG) outcome |
observed_CG_SD |
observed standard deviation of the comparator group (CG) outcome |
inferred_TG_SD |
inferred full sample standard deviation of the treatment group (TG) outcome |
max_bias_CG |
an array of bias components, total bias, the bias adjusted estimate, and inferred full sample group standard deviations, calculated under the assumption of worst-case scenario dropout, with dropout in the comparator group (CG) on the opposite side of the distribution from the one that is being trimmed |
max_bias_TG |
an array of bias components, total bias, the bias adjusted estimate, and inferred full sample group standard deviations, calculated under the assumption of worst-case scenario dropout, with dropout in the treatment group (TG) on the opposite side of the distribution from the one that is being trimmed |
Details
The trimmed means estimate is subject to two assumptions: the strong MNAR assumption requires that all dropouts (unobserved outcome values) are located in the fraction of the distribution that is trimmed away; the location shift assumption requires the group variances of the full sample to be equal. The bias resulting from the violation of either assumption can be calculated under assumption of normally distributed outcomes.
Obtaining the strong MNAR assumption bias requires an additional assumption about
the distribution of the dropouts: it is assumed that the dropouts are spread homogeneously across the specified
dropout spread. For example, under lower value trimming (side="LOW"
), and a treatment group dropout
spread of 0.6 (spread_TG=0.6
), any value in the bottom 60% of the treatment group outcome distribution
is equally likely to be missing.
The specified dropout spread for a given treatment group has implications for the unobserved full sample variance that is inferred from the observed data. For example, for an observed dropout of 0.4 and an assumed dropout spread of 0.5, the inferred full sample variance will be larger than for an assumed dropout spread of e.g., 0.8.
In addition to calculating the bias for a user-specified dropout spread, tm_bias
also calculates
the maximal bias. For example, for lower value trimming (side="LOW"
), the worst-case scenario would
involve lower value dropout in the treatment group (TG) and higher value dropout in the comparator group (CG),
and vice versa. Bias components are calculated for both scenarios. If the dropout spread
(spread_TG
, spread_CG
) is left unspecified for either treatment group, the function will
return only these quantities.
Examples
test_dat <- as.data.frame(cbind(c(rep(0, 500), rep(1, 500)),
c(sort(rnorm(500, 0, 1)), sort(rnorm(500, 1, 1.5)))))
colnames(test_dat) <- c("TR", "Y")
test_dat$Y[which(test_dat$TR == 0)[1:150]] <- NA
test_dat$Y[which(test_dat$TR == 1)[sample(seq(1, 400), 200, replace = FALSE)]] <- NA
tm_bias_obj <- tm_bias(formula = Y ~ TR, "TR", trF = 0.5,
side = "LOW", spread_TG = 0.4,
spread_CG = 0.6, data = test_dat)
print(tm_bias_obj)