Title: | Latent Space Models for Multidimensional Networks |
---|---|
Description: | Latent space models for multivariate networks (multiplex) estimated via MCMC algorithm. See D Angelo et al. (2018) <arXiv:1803.07166> and D Angelo et al. (2018) <arXiv:1807.03874>. |
Authors: | Silvia D'Angelo [aut, cre], Michael Fop [aut]
|
Maintainer: | Silvia D'Angelo <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.2 |
Built: | 2025-02-28 02:51:42 UTC |
Source: | https://github.com/cran/spaceNet |
Computes the value for the intercept in the reference network.
alphaRef(Y, D = 2, sender = NULL, receiver = NULL)
alphaRef(Y, D = 2, sender = NULL, receiver = NULL)
Y |
A three-dimensional array or list of |
D |
The dimension of the latent space, with |
sender , receiver
|
The type of node-specific sender and receiver effects to be included in the model. If specified, these effects can be set to constant ( |
The function computes the value for the intercept in the reference network (first network) of the multiplex. It is calculated taking into account the average effect of the latent space on edge probabilities (approximated with the constant ) and the observed mean probability of an edge in the first network (
):
with the number of nodes in the network.
Then, the reference intercept is computed as:
When sender and/or receiver effects are included in the model, the intercept for the reference network is forced to be positive, see references.
The function returns the intercept value in the reference network.
D'Angelo, S. and Murphy, T. B. and Alfò, M. (2018). Latent space modeling of multidimensional networks with application to the exchange of votes in the Eurovision Song Contest. arXiv.
D'Angelo, S. and Alfò, M. and Murphy, T. B. (2018). Node-specific effects in latent space modelling of multidimensional networks. arXiv.
data(vickers) alphaR <- alphaRef(vickers, D = 2) # model without node-specific effect
data(vickers) alphaR <- alphaRef(vickers, D = 2) # model without node-specific effect
This function performs an heuristic model search, to select which type of sender and receiver effects should be included in the model. The sender/receiver effects can be either absent, constant or variable.
heuSearch( Y, D = 2, nrep = 1000)
heuSearch( Y, D = 2, nrep = 1000)
Y |
A three-dimensional array or list of |
D |
The dimension of the latent space, with |
nrep |
The number of datasets to be simulated for each model type. By default |
The function performs an heuristic model search for the type of sender/receiver effects to be included in the model for the multidimensional network Y
with nodes and
networks.
The function simulates nrep
different multidimensional networks of dimensions from the nine models arising from different combinations of sender/receiver effects:
"NN"
, "CN"
, "NC"
, "CC"
, "VN"
, "NV"
, "VC"
, "CV"
, "VV"
. The first letter indicates the sender effect type, while the second letter denotes the receiver effect type. The effects can be constrained across the networks, with "N"
indicating no effects, "C"
constant effects and "V"
variable effects. The simulated multidimensional networks are then used to train a classifier, which is employed to assign the observed multiplex Y
to the most plausible node-specific effect model.
The function returns a list containing the following objects:
bestModel
The selected combination of sender and receiver effects.
modelProbs
The estimated probabilities that Y
has been generated by the models corresponding to all the sender/receiver effects combinations.
modClass
The model-specific accuracies of the classifier. Rows correspond to the predicted model, while columns to the model the simualted data have been generated from.
D'Angelo, S. and Murphy, T. B. and Alfò, M. (2018). Latent space modeling of multidimensional networks with application to the exchange of votes in the Eurovision Song Contest. arXiv.
D'Angelo, S. and Alfò, M. and Murphy, T. B. (2018). Node-specific effects in latent space modelling of multidimensional networks. arXiv.
data(vickers) #heuS <- heuSearch( vickers, D = 2, nrep = 10) # nrep is set to 10 as an example.
data(vickers) #heuS <- heuSearch( vickers, D = 2, nrep = 10) # nrep is set to 10 as an example.
Implements latent space models for multivariate networks (multiplex) via MCMC algorithm.
multiNet(Y, niter = 1000, D = 2, muA = 0, tauA = NULL, nuA = 3, muB = 0, tauB = NULL, nuB = 3, muL = 0, tauL = NULL, nuL = 3, alphaRef = NULL, sender = c("const", "var"), receiver = c("const", "var"), covariates = NULL, DIC = FALSE, WAIC = FALSE, burnIn = round(niter*0.3), trace = TRUE, allChains = FALSE, refSpace = NULL)
multiNet(Y, niter = 1000, D = 2, muA = 0, tauA = NULL, nuA = 3, muB = 0, tauB = NULL, nuB = 3, muL = 0, tauL = NULL, nuL = 3, alphaRef = NULL, sender = c("const", "var"), receiver = c("const", "var"), covariates = NULL, DIC = FALSE, WAIC = FALSE, burnIn = round(niter*0.3), trace = TRUE, allChains = FALSE, refSpace = NULL)
Y |
A three-dimensional array or list of |
niter |
The number of MCMC iterations. The default value is |
D |
The dimension of the latent space, with |
muA , muB , muL
|
Mean hyperparameters, see details. |
tauA , tauB , tauL
|
Mean hyperparameters, see details. |
nuA , nuB , nuL
|
Variance hyperparameters, see details. |
alphaRef |
The value for the intercept in the first network (the reference network). This value can be specified by the user on the basis of prior knowledge. By default is computed using the function |
sender , receiver
|
The type of node-specific sender and receiver effects to be included in the model. If specified, these effects can be set to constant ( |
covariates |
An array or a list with edge-covariates matrices. A list is automatically converted to an array. Covariates can be either continuous or discrete and must be constant throughout the views of the multiplex. The dimension of |
DIC |
A logical value indicating wether the DIC (Deviance Information Criterion) should be computed. The default is |
WAIC |
A logical value indicating wether the WAIC (Widely Available Information Criterion) should be computed. The default is |
burnIn |
A numerical value, the number of iterations of the chain to be discarded when computing the posterior estimates. The default value is |
trace |
A logical value indicating if a progress bar should be printed. |
allChains |
A logical value indicating if the full parameter chains should also be returned in output. The default value is |
refSpace |
Optional. A matrix containing a set of reference values for the latent coordinates of the nodes. Its dimension must be |
The function estimates a latent space model for multidimensional networks (multiplex) via MCMC. The model assumes that the probability of observing an arc between any two nodes is inversely related to their distance in a low-dimensional latent space. Hence, nodes close in the latent space have a higher probability of being connected across the views of the multiplex than nodes far apart. The model allows the inclusion of node-specific sender and receiver effects and edge-specific covariates.
The probability of an edge beteween nodes and
in the
network is defined as:
with when node-specific effects are not present and
when they are included in the model.
The arguments of are:
The squared Euclidean distance between nodes and
in the latent space,
A coefficient to scale the edge-specific covariate
. If more than one covariate is introduced in the model, their sum is considered, with each covariate being rescaled by a specific coefficient
. Edge-specific covariates are assumed to be inversely related to edge probabilities, hence
.
A vector of network-specific parameters, . These parameters are:
A rescaling coefficient , which weights the importance of the latent space in the
network, with
. In the first network (that is the reference network), the coefficient is fixed to
for identifiability reasons.
An intercept parameter , which corresponds to the largest edge probability allowed in the
network. Indeed, when
and when no covariate is included, the probability of having a link between a couple of nodes is that of the random graph:
The intercepts have a lower bound corresponding to . For identifiability reasons, the intercept of the first network needs to be fixed. Its value can be either specified by the user on the basis of prior knowledge or computed with the function
alphaRef
.
When node-specific effects are included in the model,
with :
the sender effect of node
in network
.
the receiver effect of node
in network
.
a scalar. When both sender and receiver effects are present,
; when only one type of effect is included in the model,
.
When the sender and/or receiver effects are set to constant ("const"
), each node is assumed to have a constant effect across the different networks:
and/or
. Instead, when they are set to variable (
"var"
), each node has a different effect across the networks: and/or
.
Inference on the model parameters is carried out via a MCMC algorithm. A hierarchical framework is adopted for estimation, where the parameters of the distributions of ,
and
are considered nuisance parameters and assumed to follow hyper-prior distributions. The parameters of these hyperpriors need to be fixed and are the following:
tauA, tauB
and tauL
are the scale factors for the variances of the hyperprior distributions for the mean parameters of and
. If not specified by the user,
tauA
and tauB
are computed as , if
, otherwise they are set to
. Parameter
tauL
is calculated as , if
, otherwise it is set to
.
muA, muB
and muL
are the means of the hyperprior distributions for the mean parameters of and
. If not specified by the user, they are all set to
.
nuA, nuB
and nuL
are the degrees of freedom of the hyperprior distributions for the variance parameters of and
. If not specified by the user, they are all set to
.
Missing data are considered structural and correspond to edges missing because one or more nodes are not observable in some of the networks of the multiplex. No imputation is performed, instead, the term corresponding to the missing edge is discarded in the computation of the likelihood function. For example, if either node or
is not observable in network
, the edge
is missing and the likelihood function for network
is calculated discarding the corresponding
term. Notice that the model assumes a single common generative latent space for the whole multidimensional network. Thus, discarding the
term in the
network does not prevent from recovering the coordinates of nodes
and
in the latent space.
An object of class 'multiNet'
containing the following components:
n |
The number of nodes in the multidimensional network. |
K |
The number of networks in the multidimensional network. |
D |
The number of dimensions of the estimated latent space. |
parameters |
A list with the following components:
|
latPos |
A list with posterior estimates of means and standard deviations of the latent coordinates. |
accRates |
A list with the following components:
|
DIC |
The Deviance Information Criterion of the estimated model. Computed only if |
WAIC |
The Widely Available Information Criterion of the estimated model. Computed only if |
allChains |
If
|
corrRefSpace |
A numerical vector containing the values of the Procrustes correlation between the reference space and the estimated one, computed at each mcmc iteration. Only outputed when |
info |
A list with some information on the estimated model:
|
D'Angelo, S. and Murphy, T. B. and Alfò, M. (2018). Latent space modeling of multidimensional networks with application to the exchange of votes in the Eurovision Song Contest. arXiv.
D'Angelo, S. and Alfò, M. and Murphy, T. B. (2018). Node-specific effects in latent space modelling of multidimensional networks. arXiv.
data(vickers) it <- 10 # small number of iterations just for example # 2-dimensional latent space model, no covariates mod <- multiNet(vickers, niter = it, D = 2) # 2-dimensional latent space model, sex as covariate mod <- multiNet(vickers, niter = it, D = 2, covariates = sex) # 2-dimensional latent space model, with constant sender # effect and variable receiver effect mod <- multiNet(vickers, niter = it, D = 2, sender = "const", receiver = "var")
data(vickers) it <- 10 # small number of iterations just for example # 2-dimensional latent space model, no covariates mod <- multiNet(vickers, niter = it, D = 2) # 2-dimensional latent space model, sex as covariate mod <- multiNet(vickers, niter = it, D = 2, covariates = sex) # 2-dimensional latent space model, with constant sender # effect and variable receiver effect mod <- multiNet(vickers, niter = it, D = 2, sender = "const", receiver = "var")
A package for latent space models for binary multivariate networks (multiplex). The model assumes that the nodes in the multiplex lie in a low-dimensional latent space. The probability of two nodes being connected is inversely related to their distance in this latent space: nodes close in the space are more likely to be linked, while nodes that are far apart are less likely to be connected. The model allows the inclusion of node-specific sender and receiver effects and edge-specific covariates. Inference is carried out via a MCMC algorithm.
The main function is multiNet
, which estimates the latent space model via MCMC algorithm. Data can be inputed either as a list or an array. Also, edge-specific covariates in the form of a list or an array can be included in the model.
Silvia D'Angelo and Michael Fop.
Mantainer: Silvia D'Angelo [email protected]
D'Angelo, S. and Murphy, T. B. and Alfò, M. (2018). Latent space modeling of multidimensional networks with application to the exchange of votes in the Eurovision Song Contest. arXiv.
D'Angelo, S. and Alfò, M. and Murphy, T. B. (2018). Node-specific effects in latent space modelling of multidimensional networks. arXiv.
The data by Vickers et al. (1981) represent three different social relations among 29 seventh grade students in a school in Victoria, Australia. A binary covariate matrix is available and it describes if two students share the same sex or not.
data(vickers)
data(vickers)
The data by Vickers et al. (1981) are stored in a list named vickers
and represent three different social relations among 29 seventh grade students, 12 boys and 17 girls, in a school in Victoria, Australia. Each student was asked if
Network 1: he\ she got on with another given student;
Network 2: he\ she considered another given student as his\ her best friend;
Network 3: he\ she would have liked to work with another given student.
The matrix sex
is an edge-specific binary covariate recording the gender of pairs of students. If a pair of students is of the same sex, the corresponding entry in the matrix is 0, otherwise is 1.
Vickers, M. and Chan, S. (1981). Representing Classroom Social Structure. Melbourne: Victoria Institue of Secondary Education.
data(vickers)
data(vickers)