Skip to contents

In simulation settings where the true mean matrix is known and a set of estimated communities are provided, this function returns the true target of inference.

Usage

check_target_of_inference(
  M,
  u,
  communities,
  allow_self_loops = TRUE,
  is_directed = TRUE,
  bernoulli_target = FALSE,
  gamma = NULL,
  Atr = NULL
)

Arguments

M

The true mean matrix.

u

The linear combination vector (or matrix) which specifies which connectivity parameters should be considered when constructing the selected target of inference. This input should have norm 1. If `is_directed` is set to `FALSE`, then the matrix version of `u` must be upper triangular.

communities

A vector or matrix which specifies the estimated communities. If this is inputted as a vector, then if `M` is of size `n` x `n`, then this should be a vector of length `n`, where the ith element is the numbered community that the ith node belongs to. For example, `communities[2] = 3` would indicate that the 2nd node belongs to the 3rd estimated community. If this is inputted as a matrix, then it should be a matrix of 0s and 1s only, where `communities[i, k] = 1` indicates that the ith node belongs to the kth community. Each node is only allowed to belong to a single community, so there should only be a single 1 in each row of this matrix.

allow_self_loops

A logical indicating whether the network allows self loops (edges pointing from a node to itself.) By default this parameter is set to `TRUE`. If this is set to `FALSE`, then the values along the diagonal of the input `M` will be ignored.

is_directed

A logical indicating whether the network is a directed network, and by default is set to `TRUE`. If this is set to `FALSE`, then only the values in the upper triangular portion of `M` will be used.

bernoulli_target

A logical indicating whether we should calculate the alternative target for Bernoulli networks specified in the paper that is close to the actual target of interest. If this is set to `TRUE`, then the argument `Atr` must also be provided.

gamma

For Bernoulli networks, the parameter controlling the amount of information allocated to the train network versus the test network. This must be between 0 and 0.5 (non-inclusive) A larger value of `gamma` indicates less information in the train network, and more in the test network.

Atr

A matrix of the same size as `M` arising from the `split_network()` function. This argument will only be used if the `bernoulli_target` argument is set to `TRUE`.

Value

A single numeric which is the true target of inference sought.

Examples

# As an example, let's build our matrix M to be a 10x10 matrix where each
# element is sampled uniformly from a Uniform(0, 1) distribution.
M <- matrix(stats::runif(n = 10^2), nrow = 10)

# Set our "estimated_communities" to just have the first 5 nodes in the first
# community, and the last 5 nodes in the other community
communities_estimate <- c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2)

# This choice of "u" vector would be conducting inference for the mean
# connectivity within the first estimated community.
u_vector <- c(1, 0,
              0, 0)

# Conduct inference for the selected target (mean connectivity within the
# first estimated community)
target_of_inference <-
  check_target_of_inference(M = M, u = u_vector,
                            communities = communities_estimate,
                            allow_self_loops = TRUE, is_directed = TRUE)