Description Usage Arguments Details Value See Also Examples
Estimates the graph of a linear SEM with assumed equal variance of the noise terms.
1 |
X |
A matrix containing the observed variables |
method |
The estimation method. Possible choises are "TD", "BU", "HTD" and "HBU". |
measure |
Either "mse", "mae" |
which |
Either "min" or "1se" |
... |
Terms passed to the method specific estimation steps. If the method "HBU" is specified it is possible to specify a tuning
parameter If the method "HTD" is specified it is posible to specify a
The "full" search method simply looks at all possible subsets of the
current ansestreal set of size |
graph_est
is a simple wrapper function which given data will fist
estimate the topological ordering of the causal graph using the function
top_order
, and then estimate the causal graph itself using the
function graph_from_top
.
The graph_est
function returns a vector top_order
with the estimated topological ordering of the causal graph, a matrix
G
of the estimated causal graph, and lastly a matrix B
of the
estimated regression matrix.
graph_est
is simply a wrapper functio for the two functions
top_order
and graph_from_top
which givem data
will estimate the topological ordering of the causal graph and estimates
the causal graph itself given an ordering respectivly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # we create some data from the graph B
n <- 1000
B <- matrix(c(0,1,0,1,
0,0,2,0,
0,0,0,1,
0,0,0,0), ncol = 4, nrow = 4, byrow = TRUE)
X <- matrix(0, ncol = 4, nrow = n)
for (i in 1:4) {
X[ ,i] <- X %*% B[ ,i] + rnorm(n)
}
# from the simulated data we etimate in two different way to illustrate
graph_est(X, method = "TD", measure = "deviance", which = "1se")
graph_est(X, method = "HTD",
measure = "deviance", which = "1se",
max.degree = 2L, search = "full")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.