Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5c9dda
commit bb0442e
Showing
32 changed files
with
742 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
Package: VBLPCM | ||
Type: Package | ||
Title: Variational Bayes Latent Position Cluster Model for networks. | ||
Version: 1.3 | ||
Date: 2012-01-30 | ||
Version: 2.0 | ||
Date: 2012-02-08 | ||
Author: Michael Salter-Townshend | ||
Maintainer: Michael Salter-Townshend <michael.salter-townshend@ucd.ie> | ||
Description: A package to fit and simulate latent position and cluster | ||
models for statistical networks using a Variational Bayes | ||
approximation. | ||
Depends: MASS, boot, mclust, network, sna, ergm | ||
Depends: MASS, boot, mclust, network, ergm, sna | ||
SystemRequirements: Gnu Scientific Library version >= 1.12 | ||
License: GPL (>= 2) | ||
LazyLoad: yes | ||
Packaged: 2012-01-30 14:59:12 UTC; saltertm | ||
Packaged: 2012-02-15 15:40:36 UTC; ripley | ||
Repository: CRAN | ||
Date/Publication: 2012-01-30 16:10:41 | ||
Date/Publication: 2012-02-15 15:44:03 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,3 @@ | ||
# Export all names | ||
exportPattern(".") | ||
# Export everything | ||
exportPattern("*") | ||
|
||
# Import all packages listed as Imports or Depends | ||
import( | ||
MASS, | ||
boot, | ||
mclust, | ||
network, | ||
sna, | ||
ergm | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,33 @@ | ||
vblpcmcovs<-function(N, model, Y, edgecovs=NULL,nodecovs=NULL) | ||
{ | ||
XX<-matrix(rep(1,N^2),ncol=1) # all get the intercept term | ||
P=ncol(XX) | ||
if (model=="receiver") | ||
XX_n<-NULL | ||
XX_e<-matrix(rep(1,N^2),ncol=1) # all get the intercept term | ||
if (model=="rreceiver") | ||
{ | ||
# receiver random effects | ||
#P=P+N | ||
#XX<-cbind(XX,t(matrix(rep(diag(1,N),N),N))) | ||
P=P+1 | ||
tmp<-apply(Y,2,sum,na.rm=1) | ||
tmp<-(tmp-mean(tmp))/sd(tmp) | ||
XX<-cbind(XX,rep(tmp,N)) | ||
XX_n<-cbind(XX_n,rep(1,N)) | ||
} | ||
|
||
if (model=="sender") | ||
if (model=="rsender") | ||
{ | ||
# sender random effects | ||
#XX<-cbind(XX,matrix(0,N^2,N)) | ||
#for (i in 1:N) | ||
# XX[((i-1)*N+1):(i*N),i+P]<-1 | ||
#P=P+N | ||
P=P+1 | ||
tmp<-apply(Y,1,sum,na.rm=1) | ||
tmp<-(tmp-mean(tmp))/sd(tmp) | ||
XX<-cbind(XX,c(t(matrix(rep(tmp,N),N)))) | ||
XX_n<-cbind(XX_n,rep(1,N)) | ||
} | ||
|
||
if (model=="social") | ||
if (model=="rsocial") | ||
{ | ||
# sender random effects | ||
#XX<-cbind(XX,matrix(0,N^2,N)) | ||
#for (i in 1:N) | ||
# XX[((i-1)*N+1):(i*N),i+P]<-1 | ||
#P=P+N | ||
#XX[,(P-N+1):P]<-XX[,(P-N+1):P]+t(matrix(rep(diag(1,N),N),N)) | ||
#XX[,(P-N+1):P][XX[,(P-N+1):P]>1]<-1 | ||
tmp1<-apply(Y,1,sum,na.rm=1) | ||
tmp1<-(tmp1-mean(tmp1))/sd(tmp1) | ||
tmp2<-apply(Y,2,sum,na.rm=1) | ||
tmp2<-(tmp2-mean(tmp2))/sd(tmp2) | ||
P=P+2 | ||
XX<-cbind(XX,c(t(matrix(rep(tmp1,N),N))),rep(tmp2,N)) | ||
XX_n<-cbind(XX_n,rep(1,N),rep(1,N)) | ||
} | ||
if (!is.null(nodecovs)) | ||
if (!is.null(nodecovs)) # include option to not model nodecovs as edgecovs? | ||
{ | ||
tmp<-expand.grid(1:N,1:N) | ||
nodecovs<-as.matrix(nodecovs) | ||
nodeedgecovs<-nodecovs[tmp[,1],]-nodecovs[tmp[,2],] | ||
} | ||
if (!is.null(nodecovs)) | ||
XX<-cbind(XX,nodeedgecovs) | ||
XX_n<-cbind(XX_n,nodeedgecovs) | ||
if (!is.null(edgecovs)) | ||
XX<-cbind(XX,edgecovs) | ||
return(as.matrix(XX)) | ||
XX_e<-cbind(XX_e,edgecovs) | ||
return(list("XX_n"=XX_n,"XX_e"=XX_e)) | ||
} | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.