specify_priors {JANE} | R Documentation |
Specify prior hyperparameters for EM algorithm
Description
A function that allows the user to specify the prior hyperparameters for the EM algorithm in a structure accepted by JANE
.
Usage
specify_priors(
D,
K,
model,
family = "bernoulli",
noise_weights = FALSE,
n_interior_knots = NULL,
a,
b,
c,
G,
nu,
e,
f,
h,
l,
e_2,
f_2,
m_1,
o_1,
m_2,
o_2
)
Arguments
D |
An integer specifying the dimension of the latent positions. |
K |
An integer specifying the total number of clusters. |
model |
A character string specifying the model:
|
family |
A character string specifying the distribution of the edge weights.
|
noise_weights |
A logical; if TRUE then a Hurdle model is used to account for noise weights, if FALSE simply utilizes the supplied network (converted to an unweighted binary network if a weighted network is supplied, i.e., (A > 0.0)*1.0) and fits a latent space cluster model (default is FALSE). |
n_interior_knots |
An integer specifying the number of interior knots used in fitting a natural cubic spline for degree heterogeneity models (i.e., 'RS' and 'RSR' only; default is |
a |
A numeric vector of length |
b |
A positive numeric scalar specifying the scaling factor on the precision of the multivariate normal prior on |
c |
A numeric scalar |
G |
A numeric |
nu |
A positive numeric vector of length |
e |
A numeric vector of length |
f |
A numeric p.s.d square matrix of dimension |
h |
A positive numeric scalar specifying the first shape parameter for the Beta prior on |
l |
A positive numeric scalar specifying the second shape parameter for the Beta prior on |
e_2 |
A numeric vector of length |
f_2 |
A numeric p.s.d square matrix of dimension |
m_1 |
A positive numeric scalar specifying the shape parameter for the Gamma prior on |
o_1 |
A positive numeric scalar specifying the rate parameter for the Gamma prior on |
m_2 |
A positive numeric scalar specifying the shape parameter for the Gamma prior on |
o_2 |
A positive numeric scalar specifying the rate parameter for the Gamma prior on |
Details
Prior on \mu_k
and \Omega_k
(note: the same prior is used for k = 1,\ldots,K
) :
\pi(\mu_k, \Omega_k) = \pi(\mu_k | \Omega_k) \pi(\Omega_k)
, thus
\mu_k | \Omega_k \sim MVN(a, (b\Omega_k)^{-1})
\Omega_k \sim Wishart(c, G^{-1})
Prior on p
:
For the current implementation we require that all elements of the nu
vector be \ge 1
to prevent against negative mixture weights for empty clusters.
p \sim Dirichlet(\nu_1 ,\ldots,\nu_K)
Prior on \beta_{LR}
:
\beta_{LR} \sim MVN(e, f^{-1})
Prior on \beta_{GLM}
:
\beta_{GLM} \sim MVN(e_{2}, f_{2}^{-1})
Prior on q
:
q \sim Beta(h, l)
Prior on \tau^2_{weights}
:
\tau^2_{weights} \sim Gamma(\frac{m_1}{2}, \frac{o_1}{2})
Prior on \tau^2_{noise \ weights}
:
\tau^2_{noise \ weights} \sim Gamma(\frac{m_2}{2}, \frac{o_2}{2})
Value
A list of prior hyperparameters for the EM algorithm generated from the input values in a structure accepted by JANE
.
Examples
# Simulate network
mus <- matrix(c(-1,-1,1,-1,1,1),
nrow = 3,
ncol = 2,
byrow = TRUE)
omegas <- array(c(diag(rep(7,2)),
diag(rep(7,2)),
diag(rep(7,2))),
dim = c(2,2,3))
p <- rep(1/3, 3)
beta0 <- 1.0
sim_data <- JANE::sim_A(N = 100L,
model = "RS",
mus = mus,
omegas = omegas,
p = p,
params_LR = list(beta0 = beta0),
remove_isolates = TRUE)
# Specify prior hyperparameters
D <- 3L
K <- 5L
n_interior_knots <- 5L
a <- rep(1, D)
b <- 3
c <- 4
G <- 10*diag(D)
nu <- rep(2, K)
e <- rep(0.5, 1 + (n_interior_knots + 1))
f <- diag(c(0.1, rep(0.5, n_interior_knots + 1)))
my_prior_hyperparameters <- specify_priors(D = D,
K = K,
model = "RS",
n_interior_knots = n_interior_knots,
a = a,
b = b,
c = c,
G = G,
nu = nu,
e = e,
f = f)
# Run JANE on simulated data using supplied prior hyperparameters
res <- JANE::JANE(A = sim_data$A,
D = D,
K = K,
initialization = "GNN",
model = "RS",
case_control = FALSE,
DA_type = "none",
control = list(priors = my_prior_hyperparameters))