tskeleton | R Documentation |
Like pcalg::skeleton
, but takes a user-specified partial node
ordering into account. The conditional independence
between x
and y
given S
is not tested if any variable in
S
lies in the future of both x
and y
.
tskeleton( suffStat, indepTest, alpha, labels, p, method = c("stable", "original"), m.max = Inf, fixedGaps = NULL, fixedEdges = NULL, NAdelete = TRUE, tiers = NULL, verbose = FALSE )
suffStat |
A list of sufficient statistics, containing all necessary elements for
the conditional independence decisions in the function |
indepTest |
Predefined |
alpha |
Significance level (number in (0,1) for the individual conditional independence tests. |
labels |
(optional) character vector of variable (or "node") names.
Typically preferred to specifying |
p |
(optional) number of variables (or nodes). May be specified if |
method |
Character string specifying method; the default, "stable" provides an order-independent skeleton, see 'Details' below. |
m.max |
Maximal size of the conditioning sets that are considered in the conditional independence tests. |
fixedGaps |
logical symmetric matrix of dimension |
fixedEdges |
a logical symmetric matrix of dimension |
NAdelete |
logical needed for the case |
tiers |
Numeric vector specifying the tier / time point for each variable.
Must be of length 'p', if specified, or have the same length as 'labels', if specified.
A smaller number corresponds to an earlier tier / time point. Conditional independence
testing is restricted such that if |
verbose |
if |
See pcalg::skeleton
for further information on the
skeleton algorithm.
An object of class "pcAlgo" (see pcalg::pcAlgo
)
containing an estimate of the skeleton of the underlying DAG, the conditioning
sets (sepset) that led to edge removals and several other parameters.
Original code by Markus Kalisch, Martin Maechler, Alain Hauser and Diego Colombo. Modifications by Janine Witte.
# load simulated cohort data data("dat_sim") n <- nrow(dat_sim) lab <- colnames(dat_sim) # estimate skeleton without taking background information into account tskel.fit <- tskeleton(suffStat = list(C = cor(dat_sim), n = n), indepTest = gaussCItest, alpha = 0.01, labels = lab) skel.fit <- pcalg::skeleton(suffStat = list(C = cor(dat_sim), n = n), indepTest = gaussCItest, alpha = 0.01, labels = lab) identical(skel.fit@graph, tskel.fit@graph) # TRUE # estimate skeleton with temporal ordering as background information tiers <- rep(c(1,2,3), times=c(3,3,3)) tskel.fit2 <- tskeleton(suffStat = list(C = cor(dat_sim), n = n), indepTest = gaussCItest, alpha = 0.01, labels = lab, tiers = tiers) # in this case, the skeletons estimated with and without # background knowledge are identical, but fewer conditional # independence tests were performed when background # knowledge was taken into account identical(tskel.fit@graph, tskel.fit2@graph) # TRUE tskel.fit@n.edgetests tskel.fit2@n.edgetests
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.