A copy of the slides can be found here.
We will now make use of the fact that the variables in
nlsdata
are organized in three temporal tiers,
corresponding to the survey round in which they were measured:
r1
, r6
, and r12
.
Run the temporal PC algorithm:
tpcres <- tpc(nlsdata, sparsity = 0.05, order = c("r1", "r6", "r12"))
Plot the result and compare it with what you found in exercise 1.2 (ordinary PC algorithm):
pcres
and tpcres
,
do you find to be overall most plausible?We will now make three alternative versions of the dataset where variables are assigned differently to tiers:
# new dataset where mcollege is assigned to its own (first) tier
nlsdata_4tiers <- nlsdata
names(nlsdata_4tiers)[names(nlsdata_4tiers) == "r1_mcollege"] <- "r0_mcollege"
# new dataset where tiers r1 and r6 are collapsed into one (named r1)
nlsdata_bigearlytier <- nlsdata
names(nlsdata_bigearlytier)[names(nlsdata_bigearlytier) %in% c("r6_depressed", "r6_docvisits", "r6_exercise")] <- c("r1_depressed6", "r1_docvisits6", "r1_exercise6")
# new dataset where tiers r6 and r12 are collapsed into one
nlsdata_biglatetier <- nlsdata
names(nlsdata_biglatetier)[names(nlsdata_biglatetier) %in% c("r6_depressed", "r6_docvisits", "r6_exercise")] <- c("r12_depressed6", "r12_docvisits6", "r12_exercise6")
Run the TPC algorithm on each of these new datasets using this code (note how tiers are specified):
tpcres_4tiers <- tpc(nlsdata_4tiers, sparsity = 0.05, order = c("r0", "r1", "r6", "r12"))
tpcres_bigearlytier <- tpc(nlsdata_bigearlytier, sparsity = 0.05, order = c("r1", "r12"))
tpcres_biglatetier <- tpc(nlsdata_biglatetier, sparsity = 0.05, order = c("r1", "r12"))
Look at each of the models, and compare them with each other and the results from 3.1 and 2.1. Which version of tiered information seems to be most useful for the algorithm?
Now, consider whether you want to change any parts of our first attempt at an expert CPDAG for these data, based on what you found using TPC.
Go back to exercises 2.1, 2.3, or 2.4 and rerun them using the TPC algorithm instead of the PC algorithm.