test_U_stat | R Documentation |
This function tests the goodness-of-fit of a given Gaussian latent tree model to observed data. The parameter space of the model is characterized by polynomial constraints. The involved polynomials are estimable by a kernel function and the test statistic is the maximum of the corresponding incomplete U-statistic. A Gaussian multiplier bootstrap is used to estimate the limiting distribution of the test statistic and to compute the p-value of the test.
test_U_stat(
X,
ind_eq,
ind_ineq1 = NULL,
ind_ineq2 = NULL,
N = 5000,
E = 1000,
n1 = 500
)
X |
Matrix with observed data. The number of columns has to be equal to the number of leaves of the postulated tree (i.e. number of observed variables). Each row corresponds to one sample. |
ind_eq |
Representation of the equality constraints that have to be tested.
Create this object using the function |
ind_ineq1 |
Representation of the inequality constraints in three variables that have to be tested.
Create this object using the function |
ind_ineq2 |
Representation of the inequality constraints in four variables that have to be tested.
Create this object using the function |
N |
Integer, computational budget parameter. |
E |
Integer, number of bootstrap iterations. |
n1 |
Integer, cardinality of the set |
Named list with two entries: Test statistic (TSTAT
) and p-value (PVAL
).
TO BE WRITTEN
# Create tree
vertices <- data.frame(name=seq(1,8), type=c(rep(1,5), rep(2,3))) # 1=observed, 2=latent
edges <- data.frame(from=c(1,2,3,4,5,6,7), to=c(8,8,6,6,7,7,8))
tree <- igraph::graph_from_data_frame(edges, directed=FALSE, vertices=vertices)
# Sample data from tree
igraph::V(tree)$var = rep(1,8)
igraph::E(tree)$corr = rep(0.7,7)
X = sample_from_tree(tree, m=5, n=500)
# Determine the representation of the polynomials that have to be tested
res = collect_indices(tree, m=5)
ind_eq = res$ind_eq
ind_ineq1 = res$ind_ineq1
ind_ineq2 = res$ind_ineq2
# Apply the test
test_U_stat(X, ind_eq, ind_ineq1, ind_ineq2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.