V-structure bias, binary exposure and binary outcome.
V-structure bias, binary exposure and binary outcome.
Explore bias due to sample ascertainment when the exposure and outcome are binary variables. This class explores the range or OR generated by parameters in the following model: \(P(S = 1 | A,Y) = \beta_0 + \beta_a A + \beta_y Y + \beta_{ay}AY\) Where A is a binary exposure, Y is a binary outcome and S indicates whether an individual is present in the dataset \(P(S = 1)\) is the proportion of the population that is present in the data.
paramDataframe of parameter range list
or_calc()Calculate the expected OR under collider bias when null hypothoses of OR = 1 is true:
VBB$or_calc(b0, ba, by, bay)
b0Baseline probability of being selected
baEffect of A on being selected
byEffect of Y on being selected
bayEffect of joint AY interaction on being selected
Odds ratio
ps_calc()Calculate the proportion of samples included in the model for a given set of parameters
VBB$ps_calc(b0, ba, by, bay, pA, pY, pAY)
b0Baseline probability of being selected
baEffect of A on being selected
byEffect of Y on being selected
bayEffect of joint AY interaction on being selected
pA\(P(A = 1)\) in the general population
pY\(P(Y = 1)\) in the general population
pAY\(P(A = 1, Y = 1)\) in the general population
P(S = 1)
parameter_space()Specify a set of parameters for the structural equation, and calculate the set of odds ratios that would be obtained, assuming the odds ratio of A on Y in the total population is 1.
VBB$parameter_space( target_or, pS, pA, pY, pAY, b0_range, ba_range, by_range, bay_range, granularity = 100, pS_tol = 0.0025 )
target_orTarget odds ratio. e.g. in an observational study this OR is observed, and the researcher seeks to find parameter ranges that could explain it
pSProportion of the population present in the sample
pA\(P(A = 1)\) in the general population
pY\(P(Y = 1)\) in the general population
pAY\(P(A = 1, Y = 1)\) in the general population
b0_rangeBaseline probability of being selected. Provide a range of values to explore e.g. c(0,1)
ba_rangeEffect of A on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
by_rangeEffect of Y on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
bay_rangeEffect of AY interaction on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
granularityGranularity of the search space. Default=100, going much higher can be computationally difficult
pS_tolTolerance of pS value Default=0.0025
Data frame of parameters that satisfy the target_or and target pS values
scatter3d()3D scatterplot of output from parameter_space function. See plot3D::scatter3D for info on parameters
VBB$scatter3d( ticktype = "detailed", theta = 130, phi = 0, bty = "g", xlab = "ba", ylab = "by", zlab = "b0", clab = "OR", ... )
ticktypeDefault="detailed"
thetaDefault=130
phiDefault=0
btyDefault="g"
xlabDefault="ba"
ylabDefault="by"
zlabDefault="b0"
clabDefault="OR"
...Further parameters to be passed to plot3D::scatter3D
Scatterplot
scatter()Simple scatterplot of output from parameter_space function. Plotted are the parameter values of b0, ba and by that can give rise to an OR \(\ge\) target_or
VBB$scatter()
histogram()Histogram of odds ratios across the range of parameter values
VBB$histogram(bins = 30)
binsHow many bins to split histogram. Default=30
ggplot object
clone()The objects of this class are cloneable with this method.
VBB$clone(deep = FALSE)
deepWhether to make a deep clone.