sim_graph_est: Simulation tool for graph_est

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

1
2
3
4
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.

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.

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:

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
## 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)                  

## End(Not run)

Laksafoss/CausDiscEqVar documentation built on May 23, 2019, 1:58 a.m.