test_U_stat: Tests the goodness-of-fit of a Gaussian latent tree model by...

View source: R/tests.R

test_U_statR Documentation

Tests the goodness-of-fit of a Gaussian latent tree model by the maximum of a high-dimensional incomplete U-statistic

Description

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.

Usage

test_U_stat(
  X,
  ind_eq,
  ind_ineq1 = NULL,
  ind_ineq2 = NULL,
  N = 5000,
  E = 1000,
  n1 = 500
)

Arguments

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 collect_indices.

ind_ineq1

Representation of the inequality constraints in three variables that have to be tested. Create this object using the function collect_indices. If NULL inequality constraints are not tested.

ind_ineq2

Representation of the inequality constraints in four variables that have to be tested. Create this object using the function collect_indices. If NULL inequality constraints are not tested.

N

Integer, computational budget parameter.

E

Integer, number of bootstrap iterations.

n1

Integer, cardinality of the set S_1 to compute the divide-and-conquer estimators. The subset S_1 is chosen randomly from {1,...,n}.

Value

Named list with two entries: Test statistic (TSTAT) and p-value (PVAL).

References

TO BE WRITTEN

Examples

# 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)


NilsSturma/TestGGM documentation built on June 30, 2023, 3:09 p.m.