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)=β0+βaA+βyY+βayAY 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.
param
Dataframe 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)
b0
Baseline probability of being selected
ba
Effect of A on being selected
by
Effect of Y on being selected
bay
Effect 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)
b0
Baseline probability of being selected
ba
Effect of A on being selected
by
Effect of Y on being selected
bay
Effect 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_or
Target odds ratio. e.g. in an observational study this OR is observed, and the researcher seeks to find parameter ranges that could explain it
pS
Proportion 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_range
Baseline probability of being selected. Provide a range of values to explore e.g. c(0,1)
ba_range
Effect of A on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
by_range
Effect of Y on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
bay_range
Effect of AY interaction on being selected into the sample. Provide a range of values to explore e.g. c(-0.2, 0.2)
granularity
Granularity of the search space. Default=100
, going much higher can be computationally difficult
pS_tol
Tolerance 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", ... )
ticktype
Default="detailed"
theta
Default=130
phi
Default=0
bty
Default="g"
xlab
Default="ba"
ylab
Default="by"
zlab
Default="b0"
clab
Default="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 ≥ target_or
VBB$scatter()
histogram()
Histogram of odds ratios across the range of parameter values
VBB$histogram(bins = 30)
bins
How many bins to split histogram. Default=30
ggplot object
clone()
The objects of this class are cloneable with this method.
VBB$clone(deep = FALSE)
deep
Whether to make a deep clone.