cmrRestrictedNodeswap.Rd
Conducts node-swap randomisations for CMRnet outputs with restrictions on which nodes can be swapped
cmrRestrictedNodeswap( cmrnet, restrict, n.rand, n.burnin, n.swaps, multi = FALSE )
cmrnet | A cmrnet object from the DynamicNetCreate, MoveNetCreate or MultiMoveNetCreate functions |
---|---|
restrict | An array showing which swaps are allowed and which are not within each network window (needs to be the same dimensions as the array being permuted). Value of 1 allows a swap. Value of 0 prevents a swap |
n.rand | The number of permutations |
n.burnin | The number of permutations to be discarded prior to recording results |
n.swaps | The number of swaps conducted before each output matrix is saved |
multi | (TRUE/FALSE). Indicates whether the input object is a monolayer network (from DynamicNetCreate or MoveNetCreate) or multiplex network (MultiMoveNetCreate) |
The randomised networks. If multi=FALSE then this consists of a list in which each element of the list corresponds to a particular network window and contains an array consisting of all of the randomised networks. If multi=TRUE then this consists of a nested list arrangement in which each element of the first list corresponds to a particular network window, and each element of the second list a layer of the multiplex for that network window. Each element of the second level contains an array consisting of all of the randommised versions of that layer in that network window
This function conducts network permutations of CMRnet objects, acting as a wrapper for sna::rmperm()
# load in data data(cmrData) # set parameters mindate<-"2010-01-01" maxdate<-"2015-01-01" intwindow<-60 netwindow<-12 overlap<-0 # create network movenetdat<-MoveNetCreate(data=cmrData, intwindow=intwindow, mindate=mindate, maxdate=maxdate, netwindow=netwindow, overlap=overlap, nextonly=TRUE)#> [1] "End of final network window aligns with end of study"res_arr<-array(sample(c(0,1),162000,replace=TRUE,prob=c(0.9,0.1)),dim=c(180,180,5)) diag(res_arr[,,1])<-diag(res_arr[,,2])<-0 diag(res_arr[,,3])<-diag(res_arr[,,4])<-diag(res_arr[,,5])<-0 # run permutations A<-cmrRestrictedNodeswap(cmrnet=movenetdat, restrict=res_arr, n.rand=1000, n.burnin=500, n.swaps=10, multi=FALSE)