Returns a closure function(x, y, S, suffStat) matching the interface
pcalg::pc() / pcalg::skeleton() expect: x and y are 1-based
integer node indices, S is an integer vector of conditioning node indices
(possibly empty), and the return value is the test's p-value. The node
indices are mapped back to the bound dataset's column names in their bound
order, so pass labels = colnames(df) (in the same order) to the pcalg
driver. suffStat is accepted for interface compatibility and ignored (the
data is already captured in test); pass suffStat = list().
as_pcalg(test)A fastcit_test from one of the factory functions. Must be a
standard null-of-independence test; pearson_equivalence() is rejected
because its inverted decision rule (independence when p < alpha) would be
interpreted backwards by pcalg.
A function (x, y, S, suffStat) -> numeric p-value.
if (FALSE) { # \dontrun{
df <- data.frame(X = rnorm(200), Y = rnorm(200), Z = rnorm(200))
indepTest <- as_pcalg(pearson_correlation(dataset(df)))
pcalg::pc(suffStat = list(), indepTest = indepTest,
labels = colnames(df), alpha = 0.05)
} # }