Description Usage Arguments Value Author(s) See Also Examples
multiRDPG
is used to fit Multiple Random Dot Product Graphs from a set of adjacency matrices.
1 | multiRDPG(A, d, maxiter = 100, tol = 1e-06)
|
A |
List of adjacency matrices representing graphs. Each matrix must be symmetric. All matrices of the same size n x n. |
d |
Dimension of latent space. d<= n. |
maxiter |
Maximal number of iterations. Default is 100. |
tol |
Tolerance for update of the objective function. Default is 1e-6. |
Returns a list of the following:
U | Matrix of the joint vectors. n x d. |
Lambda | List of diagonal matrices. One for each graph. d x d. |
Converged | Represent of the algorithm converged. 1 if converged, 0 if not. |
iter | Number of iterations |
maxiter | Maximal number of iterations.Default is 100. |
objfun | Value of the objective function. sum_k ||A^k - U Lambda U^T||_F^2 |
Agnes Martine Nielsen (agni@dtu.dk)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #simulate data
U <- matrix(0, nrow=20, ncol=3)
U[,1] <- 1/sqrt(20)
U[,2] <- rep(c(1,-1), 10)/sqrt(20)
U[,3] <- rep(c(1,1,-1,-1), 5)/sqrt(20)
L<-list(diag(c(11,6,2)),diag(c(15,4,1)))
A <- list()
for(i in 1:2){
P <- U%*%L[[i]]%*%t(U)
A[[i]] <-apply(P,c(1,2),function(x){rbinom(1,1,x)})
A[[i]][lower.tri(A[[i]])]<-t(A[[i]])[lower.tri(A[[i]])]
}
#fit model
multiRDPG(A,3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.