This is an internal simulation function for testing preformance of the top_order and graph_from_top function.

sim_graph_est(scenarios, top, graph = data.frame(measure = NA, which =
  NA), m)

kendall(true, est)

Arguments

scenarios

a data frame with columns p, graph_setting, l, u, unique_ordering, n and sigma. These variables are then used in the functions sim_B and sim_X to simulate a deteset for each row in scenarios.

top

a data frame with columns method, max.degree, search and M. These variables are used in the function top_order along with the data sets simulated based on scenarios.

graph

a data frame with columns measure and which. These variables are used in the function graph_from_top along with the data sets and their estimated topological orderings.

m

the number of realizations of each scenario.

true

the true topological ordering of the graph

est

one or more estimated topological orderings in a matrix, where each column is an estimated topological ordering.

Value

The Kendall function returnes one numeric value between -1 and 1.

The sim_graph_est function returns a data frame with 18 variables and ncol(scenarios) x ncol(top) x ncol(graph) x m rows. The first 14 variables are simply the input parameters that generated that particular output row. The remaning 5 variables describe the preformance measures:

  • Kendall Kendalls tau between the true and esimated topological ordering

  • Hamming Structual Hamming Distance between true and estimated graph

  • Recall percent of arrows true positive arrows in estimated graph

  • Flipped percent of arrows flipped compared to true graph

  • FDR percent of arrows false positivesin the estimateed graph

Details

The sim_graph_est function is used to simulate and evaluate the simulated data. The kendall is a function that finds the Kendall's Tau coefficient between two topological orderings and is used to evaluate the preformance of the estimated topological orderings found by top_order in the internal of graph_from_top. This coefficient is however only meaningfull when the true ordering is unique.

In the function sim_graph_est the three functions kendall, sim_B and sim_X are use. The functions sim_B and sim_X simulate the needed data and then the kendall's tau coefficient between the estimated and true topological ordering is calculated by kendall along with a few other preformance measures.

See also

Both sim_B and sim_X are used in the interior of sim_graph_est.

Examples

# NOT RUN {
####  The two low dimensional settings from the article

scenarios <- expand.grid(p = c(5, 20, 40),
                         graph_setting = c("dense", "sparse"),
                         l = 0.3,
                         u = 1,
                         unique_ordering = TRUE,
                         n = c(100, 500, 1000),
                         sigma = 1,
                         stringsAsFactors = FALSE)
top <- data.frame(method = c("TD", "BU"),
                  max.degree = NA,
                  search = NA,
                  M = NA,
                  stringsAsFactors = FALSE)
graph <- data.frame(measure = "deviance",
                    which = "1se",
                    stringAsFactors = FALSE)

SIM <- sim_graph_est(scenarios, top, graph, m = 500)



####  The two high dimensional settings from the article

scenarios <- data.frame(p = rep(c( 40,  60,  80, 120, 160,
                                   50,  75, 100, 150, 200,
                                  100, 150, 200, 300, 400), 2),
                         graph_setting = rep(c("A", "B"), each = 15),
                         l = 0.7,
                         u = 1,
                         unique_ordering = TRUE,
                         n = rep(rep(c(80, 100, 200), each = 5), 2),
                         sigma = 1,
                         stringsAsFactors = FALSE)
top <- data.frame(method = c("HTD", "HBU"),
                  max.degree = c(3L, NA),
                  search = c("B&B", NA),
                  M = c(NA, 0.5),
                  stringsAsFactors = FALSE)
graph <- data.frame(measure = NA,
                    which = NA,
                    stringAsFactors = FALSE)

SIM <- sim_graph_est(scenarios, top, graph, m = 50)
# }