Reconstruct EZ and UVPM matrices from AME model output
Source:R/reconstruct_matrices.R
reconstruct_EZ.RdHelper functions to recover EZ (linear predictor) and UVPM (posterior
mean of the multiplicative product) matrices. When the fit stores the
quantity (UVPM on asymmetric fits, ULUPM on symmetric
fits), the stored posterior mean is returned directly; otherwise it is
reconstructed from the saved factors.
Note: EZ returns the linear predictor (\(\eta\)), not the response:
For Gaussian: \(EZ = \eta = \mu\) (identity link)
For Poisson: \(EZ = \eta = \log(\lambda)\) (can be negative)
For Binary: \(EZ = \eta\) = probit inverse of p (can be any real value) Use YPM for predictions on the response scale.
Details
Fits that carry the stored posterior mean (UVPM or, for
symmetric fits, ULUPM) have it returned as-is; older fit objects
without one are rebuilt from the posterior factor means.
Examples
set.seed(1)
n <- 12
Y <- matrix(rnorm(n * n), n, n); diag(Y) <- NA
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- ame(Y, R = 1, nscan = 20, burn = 5, odens = 1, verbose = FALSE, chains = 1)
EZ <- reconstruct_EZ(fit)
UVPM <- reconstruct_UVPM(fit)
dim(EZ)
#> [1] 12 12