slpm_gof {SparseLPM} | R Documentation |
slpm_gof
Description
Evaluates the expected adjacency matrix for a fitted SparseLPM.
Usage
slpm_gof(var_pars)
Arguments
var_pars |
A list defining the variational parameters of the model. See Details for more specific indications. |
Details
The list var_pars
must contain:
- alpha_u_tilde
M*K
matrix denoting the Gaussian means for senders.- alpha_v_tilde
N*K
matrix denoting the Gaussian means for receivers.- beta_u_tilde
M*K
matrix denoting the Gaussian variances for senders.- beta_v_tilde
N*K
matrix denoting the Gaussian variances for receivers.- lambda_tilde
M*N*K
array representing the soft clustering for the edges. This may be interpreted as the posterior probability that edgeij
is determined by thek
-th latent dimension.- delta_tilde
K
dimensional vector containing the variational parameters for the mixing proportions. This may be interpreted as the importance of each of the latent dimensions.- a_tilde
K
dimensional vector containing the shapes of the variational Gamma distributions associated to the precisions.- b_tilde
K
dimensional vector containing the rates of the variational Gamma distributions associated to the precisions.
Note that this function only uses the alphas and the lambdas. Also, to avoid numerical instability, the lambdas are automatically pre-transformed into a hard partitioning using a Maximum A Posterior method.
Value
An adjacency matrix with non-negative entries.
Examples
set.seed(12345)
M <- N <- 10
K <- 2
fitted_var_pars <- list()
fitted_var_pars$alpha_u_tilde = matrix(rnorm(M*K),M,K)
fitted_var_pars$alpha_v_tilde = matrix(rnorm(N*K),N,K)
fitted_var_pars$lambda_tilde = array(NA,c(M,N,K))
fitted_var_pars$lambda_tilde[,,1] = matrix(runif(M*N),M,N)
fitted_var_pars$lambda_tilde[,,2] = 1-fitted_var_pars$lambda_tilde[,,1]
expected_adj <- slpm_gof(fitted_var_pars)