Learn R Programming

tensr (version 1.0.2)

anorm_cd: 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 \(2\) by \(2\) by \(2\) sub-array Y[1:2, 1:2, 1:2]. This is conditional on every other element in Y.

Author

Peter Hoff.

Details

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

References

  • Hoff, P. D. (2011). Separable covariance arrays via the Tucker product, with applications to multivariate relational data. Bayesian Analysis, 6(2), 179-196. tools:::Rd_expr_doi("10.1214/11-BA606")

Examples

Run this code
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

Run the code above in your browser using DataLab