View source: R/hoff_functions.R
anorm_cd | R Documentation |
Conditional mean and variance of a subarray.
anorm_cd(Y, M, S, saidx)
Y |
A real valued array. |
M |
Mean of |
S |
List of mode-specific covariance matrices of |
saidx |
List of indices for indexing sub-array for which the conditional
mean and variance should be computed. For example, |
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.
Peter Hoff.
Hoff, P. D. (2011). Separable covariance arrays via the Tucker product, with applications to multivariate relational data. Bayesian Analysis, 6(2), 179-196.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.