Learn R Programming

blockmodeling (version 0.1.9)

crit.fun: Computes the criterion function for a given network and partition

Description

The function computes the value of a criterion function for a given network and partition for Generalized blockmodeling. (<U+017D>iberna, 2006) based on other parameters (see below).

Usage

crit.fun(M, clu, approach, ...)

Arguments

M

A matrix representing the (usually valued) network. For multi-relational networks, this should be an array with the third dimension representing the relation. The network can have one or more modes (diferent kinds of units with no ties among themselvs. If the network is not two-mode, the matrix must be square.

clu

A partition. Each unique value represents one cluster. If the nework is one-mode, than this should be a vector, else a list of vectors, one for each mode

approach

One of the approaches (for each relation in multi-relational netowrks in a vector) described in <U+017D>iberna (2006). Possible values are: "bin" - binary blockmodeling, "val" - valued blockmodeling, "imp" - implicit blockmodeling, "ss" - sum of squares homogenity blockmodeling, and "ad" - absolute deviations homogenity blockmodeling.

Several other arguments, which are explaind below. They are actually used by the function gen.crit.fun, however since this function is not intented to be called directly, it also has no help files. Therefore these arguments are described below. Which are needed depends on the approach selected: blocks: A vector with names of allowed blocktypes. For multi-relational networks, it can be a list of such vectors. For approaches "bin", and "val", at least two should be selected. Possible values are are: "null" - null or empty block "com" - complete block "rdo", "cdo" - row and column-dominant blocks (binary, valued, and implicit approach only) "reg" - (f-)regular block "rre", "cre" - row and column-(f-)regular blocks "rfn", "cfn" - row and column-dominant blocks (binary, valued, and implicit approach only) "den" - density block (binary approach only) "avg" - average block (valued and implicit approach only) "dnc" - do not care block - the error is always zero The ordering is important, since if several block types have identical error, the first on the list is selected. BLOCKS: An alternative to blocks. A pre-specified blockmodel. An array with dimensions three dimensions (see example below). The second and the third repreent the clusters (for rows and columns), while the first is as long as the maxsimum number of allows block types for a given block. If some block has less possible block types, the empty slots should have values NA. The values in the array should be the ones from above. For multi-relational networks, it can be a list of such arrays. m: Suficient value for individual cells for valued approach. Can be a number or a character string giving the name of a function. Set to "max" for implicit approach. For multi-relational networks, it can be a vector of such values. cut: (default = min(M[M > 0])) The threshold used for binerizing the network for use with binary blockmodeling. All values with values lower than cut are recoded into 0s, all other into 1s. For multi-relational networks, it can be a vector of such values. FUN: (default = "max") Function f used in row-f-regular, column-f-regular, and f-regular blocks. Not used in binary approach. For multi-relational networks, it can be a vector of such character strings. norm: Should the block errors (inconsistencies) be normalized with the size of the blocks, the block error does not depend on block size? The default is FALSE. Original version of implicit approach suggests TRUE, however the default is FALSE even for this approach based on better results in simulations. For multi-relational networks, it can be a vector. normbym: The default is FALSE for valued and implicit approach, elsewher not used. Original version of implicit approach suggests TRUE, however the default is FALSE even for this approach based on better results in simulations. For multi-relational networks, it can be a vector. allow.max0: Should the maximum that is the basis for calculation of inconsistencies in implicit blockmodeling be allowed to be 0. If FALSE, the maximum is in such case set to the maximum of the network (if maximum of a block is 0) or to the maxsimum of the block (if row or column maxismum is 0)Used only in implicit blockmodeling. If TRUE, the incosistency of an ideal null block is 0 for all block types. The default is FALSE if null blocks are incluede in the allowed blocks in at least one block and TRUE otherwise. allow.dom0: Should the dominant row or column (in row- or column-dominant blocks) be allowed to be 0. Used only in implicit blockmodeling. The default is FALSE. normMto2rel: Create two-realation netowrk from one relational network through row and column normalization. The default is FALSE: sameModel: Should we damand the same blockmodel for all relations. If set to TRUE, it demands that accros all relations the ideal block on the same position in the matrix BLOCKS should be chosen. Usually, these positions are occupied by the same blocks. If not, use with caution. The default is the value of normMto2rel. max.con.val: Should the largest values be cencored, limited to (larger values set to) - resonoble values are: "non" - (the default) no transformation is done "m" - (the default for implicit blockmodeling) the maximum value equals the value of the parameter m numerical values (usually) larger then parameter m and lower the the maximum value in M.

mindim: (default = 2) Minimal dimension (number of rows or columns) demanded for row and column-dominant and -functional blocks. mindimreg: (default = FALSE) Should the mindim argument also be used for (row or coulum-)(f-)regular blocks blockWeights: Weights for each type of block used, if they are to be different accros block types (see blocks above). It must be suplied in form of a named vetor blockWeights = c(name.of.block.type1=weight,...) If some of the block types used are not listed, they are given weight 1. positionWeights: weigths for positions in the blockmodel (the dimensions must be the same as the error matrix). For now this is a matix (two-dimensional) even for multi-relational networks. save.err.v: (default = FALSE) Should the error vector for all allowed block types in each block be saved? BLOCK.CV: An array with the same dimmesions as BLOCKS of central values for pre-specified homogenity (sum of squares and absolute deviations) approach. For multi-relational networks, it can be a list of such arrays. CV.use: An array with the same dimmesions as BLOCKS.CV with instuctions how to treat these centarl values. For multi-relational networks, it can be a list of such arrays. Possible alternatives are: "fixed" - the central value is fixed to the value specified in BLOCKS.CV. "min" - the central value specified in BLOCKS.CV is the minimal possible central value for a block. The central value for the block is computed as the maximum of the value specified in BLOCKS.CV and the empirical value computed based on tie values in the block. "max" - the central value specified in BLOCKS.CV is the maximal possible central value for a block. The central value for the block is computed as the minimum of the value specified in BLOCKS.CV and the empirical value computed based on tie values in the block. "free" - the central value is free, the value specified in BLOCKS.CV is igneored. The central value for the block is computed as the empirical value computed based on tie values in the block. use.for: (default = TRUE) Should FORTRAN subrutines be used where available (available for only very special cases, currently only for using "ss" aproach and only complete blocks. If you are using such setting and some special features (these are not implemented in FORTRAN subrutines), it's safer to set it to FASLE, as the fuction may miss that these features are not implemented in FORTRAN subrutines and use them nevertheless, leading to wrong results. diag: (default = TRUE) Should the special stauts of diagonal be acknowladged.

Value

A list:

M

The matrix of the network analyzed

err

The error or inconsistency emplirical network with the ideal network for a given blockmodel (model,approach,...) and paritition

clu

The analyzed partition

E

Block errors by blocks

IM

The obtained image

BM

Block means by block - only for Homogeneity blockmodeling

ERR.V

If selected. The error vector of errors for all allowed block types by blocks. The dimmensions are [rows, columns (,relations - if more than 1)]. Each cell contains a list of errors by block types

References

<U+017D>IBERNA, Ale<U+0161> (2006): Generalized Blockmodeling of Valued Networks. Social Networks, Jan. 2007, vol. 29, no. 1, 105-126. http://dx.doi.org/10.1016/j.socnet.2006.04.002.

<U+017D>IBERNA, Ale<U+0161>. Direct and indirect approaches to blockmodeling of valued networks in terms of regular equivalence. J. math. sociol., 2008, vol. 32, no. 1, 57-84. http://www.informaworld.com/smpp/content?content=10.1080/00222500701790207.

DOREIAN, Patrick, BATAGELJ, Vladimir, FERLIGOJ, Anu<U+0161>ka (2005): Generalized blockmodeling, (Structural analysis in the social sciences, 25). Cambridge [etc.]: Cambridge University Press, 2005. XV, 384 p., ISBN 0-521-84085-6.

See Also

opt.par, opt.random.par, opt.these.par, check.these.par, plot.crit.fun

Examples

Run this code
# NOT RUN {
#generating a simple network corresponding to the simple Sum of squares
#structural equivalence with blockmodel:
# null com
# null null
n<-20
net<-matrix(NA,ncol=n,nrow=n)
clu<-rep(1:2,times=c(5,15))
tclu<-table(clu)
net[clu==1,clu==1]<-rnorm(n=tclu[1]*tclu[1],mean=0,sd=1)
net[clu==1,clu==2]<-rnorm(n=tclu[1]*tclu[2],mean=4,sd=1)
net[clu==2,clu==1]<-rnorm(n=tclu[2]*tclu[1],mean=0,sd=1)
net[clu==2,clu==2]<-rnorm(n=tclu[2]*tclu[2],mean=0,sd=1)

#computation of criterion function with the correct partition
res<-crit.fun(M=net,clu=clu,approach="ss",blocks="com")
res$err #the error is relativly small
res$BM  #The block means are around 0 or 4
plot(res)

#computation of criterion function with the correct partition and correct pre-specified blockmodel
#prespecified blockmodel used
# null   com
# null   null
B<-array(NA,dim=c(1,2,2))
B[1,,]<-"null"
B[1,1,2]<-"com"
B[1,,]
res<-crit.fun(M=net,clu=clu,approach="ss",BLOCKS=B)
res$err #the error is relativly small
res$IM 
plot(res)

#computation of criterion function with the correct partition and
# pre-specified blockmodel with some alternatives

#prespecified blockmodel used
# null null|com
# null   null
B<-array(NA,dim=c(2,2,2))
B[1,,]<-"null"
B[2,1,2]<-"com"
res<-crit.fun(M=net,clu=clu,approach="ss",BLOCKS=B)
res$err #the error is relativly small
res$IM 
plot(res)

#computation of criterion function with random partition
clu.rnd<-sample(1:2,size=n,replace=TRUE)
res.rnd<-crit.fun(M=net,clu=clu.rnd,approach="ss",blocks="com")
res.rnd$err #the error is larger
res.rnd$BM  #random block means
plot(res.rnd)

#adapt network for Valued blockmodeling with the same model
net[net>4]<-4
net[net<0]<-0

#computation of criterion function with the correct partition
res<-crit.fun(M=net,clu=clu,approach="val",
   blocks=c("null","com"),m=4)
res$err #the error is relativly small
res$IM 
#The image corresponds to the one used for generation of
#the network
plot(res)

#computation of criterion function with random partition
res.rnd<-crit.fun(M=net,clu=clu.rnd,approach="val",
   blocks=c("null","com")
 , m=4)
res.rnd$err #the error is larger
res.rnd$IM #all blocks are probably null
plot(res.rnd)
# }

Run the code above in your browser using DataLab