anorm_cd {tensr}R Documentation

Array normal conditional distributions.

Description

Conditional mean and variance of a subarray.

Usage

anorm_cd(Y, M, S, saidx)

Arguments

Y

A real valued array.

M

Mean of Y.

S

List of mode-specific covariance matrices of Y.

saidx

List of indices for indexing sub-array for which the conditional mean and variance should be computed. For example, said_x = list(1:2, 1:2, 1:2) will compute the conditional means and variances for the 22 by 22 by 22 sub-array Y[1:2, 1:2, 1:2]. This is conditional on every other element in Y.

Details

This function calculates the conditional mean and variance in the array normal model. Let YY be array normal and let YaY_a be a subarray of YY. Then this function will calculate the conditional means and variances of YaY_a, conditional on every other element in YY.

Author(s)

Peter Hoff.

References

Hoff, P. D. (2011). Separable covariance arrays via the Tucker product, with applications to multivariate relational data. Bayesian Analysis, 6(2), 179-196.

Examples

p <- c(4, 4, 4)
Y <- array(stats::rnorm(prod(p)), dim = p)
saidx <- list(1:2, 1:2, 1:2)
true_cov <- tensr::start_ident(p)
true_mean <- array(0, dim = p)
cond_params <- anorm_cd(Y = Y, M = true_mean, S = true_cov, saidx = saidx)

## Since data are independent standard normals, conditional mean is 0 and
##    conditional covariance matrices are identities.
cond_params$Mab
cond_params$Sab

[Package tensr version 1.0.1 Index]