DPI curve analysis across multiple random covariates.
DPI_curve(
model,
x,
y,
data = NULL,
k.covs = 1:10,
n.sim = 1000,
alpha = 0.05,
bonf = FALSE,
pseudoBF = FALSE,
seed = NULL,
progress,
file = NULL,
width = 6,
height = 4,
dpi = 500
)Return a data.frame of DPI curve results.
Model object (lm).
Independent (predictor) variable.
Dependent (outcome) variable.
[Optional] Defaults to NULL. If data is specified, then model will be ignored and a linear model lm({y} ~ {x} + .) will be fitted inside. This is helpful for exploring all variables in a dataset.
An integer vector of number of random covariates (simulating potential omitted variables) added to each simulation sample. Defaults to 1:10 (producing DPI results for k.cov=1~10). For details, see DPI().
Number of simulation samples. Defaults to 1000.
Significance level for computing the Significance score (0~1) based on p value of partial correlation between X and Y. Defaults to 0.05.
Direction = R2.Y - R2.X
Significance = 1 - tanh(p.beta.xy/alpha/2)
Bonferroni correction to control for false positive rates: alpha is divided by, and p values are multiplied by, the number of comparisons.
Defaults to FALSE: No correction, suitable if you plan to test only one pair of variables.
TRUE: Using k * (k - 1) / 2 (all pairs of variables) where k = length(data).
A user-specified number of comparisons.
Use normalized pseudo Bayes Factors sigmoid(log(PseudoBF10)) alternatively as the Significance score (0~1). Pseudo Bayes Factors are computed from p value of X-Y partial relationship and total sample size, using the transformation rules proposed by Wagenmakers (2022) tools:::Rd_expr_doi("10.31234/osf.io/egydq").
Defaults to FALSE because it makes less penalties for insignificant partial relationships between X and Y, see Examples in DPI() and online documentation.
Random seed for replicable results. Defaults to NULL.
Show progress bar. Defaults to TRUE (if length(k.covs) >= 5).
File name of saved plot (".png" or ".pdf").
Width and height (in inches) of saved plot. Defaults to 6 and 4.
Dots per inch (figure resolution). Defaults to 500.
S3method.dpi
DPI()
DPI_dag()
BNs_dag()
cor_net()
p_to_bf()
model = lm(Ozone ~ ., data=airquality)
DPIs = DPI_curve(model, x="Solar.R", y="Ozone", seed=1)
plot(DPIs) # ggplot object
Run the code above in your browser using DataLab