Title: | Cognitive Social Structure Tools |
---|---|
Description: | A collection of tools for estimating a network from a random sample of cognitive social structure (CSS) slices. Also contains functions for evaluating a CSS in terms of various error types observed in each slice. |
Authors: | Deniz Yenigun, Gunes Ertan, Michael Siciliano |
Maintainer: | Deniz Yenigun <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2025-03-03 04:17:57 UTC |
Source: | https://github.com/cran/cssTools |
Formalized by Krackhardt (1987), Cognitive Social Structure (CSS) network studies collect relational data on respondents direct ties and their cognition of ties among all other individuals in the network. This package provides a collection of tools for estimating a network from a random sample of CSS slices. The package also contains functions for evaluating a CSS in terms of various error types observed in each slice.
The DESCRIPTION file:
Package: | cssTools |
Type: | Package |
Title: | Cognitive Social Structure Tools |
Version: | 1.0 |
Date: | 2016-06-04 |
Author: | Deniz Yenigun, Gunes Ertan, Michael Siciliano |
Maintainer: | Deniz Yenigun <[email protected]> |
Description: | A collection of tools for estimating a network from a random sample of cognitive social structure (CSS) slices. Also contains functions for evaluating a CSS in terms of various error types observed in each slice. |
License: | GPL (>= 2) |
Depends: | sna |
Imports: | graphics |
NeedsCompilation: | no |
Packaged: | 2016-06-15 09:04:08 UTC; Deniz |
Date/Publication: | 2016-06-15 11:42:58 |
Repository: | https://denizyenigun.r-universe.dev |
RemoteUrl: | https://github.com/cran/cssTools |
RemoteRef: | HEAD |
RemoteSha: | 77ed7ddcd92895d30cb6b89ceebf029eda49d7fa |
Index of help topics:
atm Estimate a Network Using the Adaptive Threshold Method cssTools-package Cognitive Social Structure Tools cssTools2sna Convert a CSS in 'cssTools' Format to a CSS in 'sna' Format ftm Aggregate CSS Slices for a Fixed Threshod highTechManagers High Tech Managers Data Set rtm Estimate a Network Using the ROC Based Threshold Method rtmPlot Plots for the ROC Based Threshold Method for Estimating Networks s14 Calculate s14 Similarity Index sliceQuality Evaluate Several Characteristics of Slices from a CSS sna2cssTools Convert a CSS in 'sna' Format to a CSS in 'cssTools' Format
Deniz Yenigun, Gunes Ertan, Michael Siciliano Maintainer: Deniz Yenigun <[email protected]>
Krackhardt, D. (1987). Cognitive social structures. Social Networks 9, 109-134. http://dx.doi.org/10.1016/0378-8733(87)90009-8
D. Yenigun, G. Ertan, M.D. Siciliano (2016). Omission and commission errors in network cognition and estimation using ROC curve. arXiv:1606.03245 [stat.CO] https://arxiv.org/abs/1606.03245
atm
, cssTools2sna
, ftm
,
highTechManagers
, rtm
, rtmPlot
,
s14
, sliceQuality
, sna2cssTools
Estimate a network of interest by aggregating the sampled CSS slices using the adaptive threshold method. This requires setting a tolerable level of type 1 error.
atm(d, sampled, alpha)
atm(d, sampled, alpha)
d |
Sampled CSS slices in |
sampled |
A vector indicating which network individuals are sampled. |
alpha |
Tolerable type 1 error. |
Given a random sample of observed CSS slices and a tolerable type 1 error,
the atm
function uses the adaptive threshold method (ATM) of Siciliano et. al. (2012) to aggregate
the observed slices and provides an estimate for the network of interest.
estimatedNetwork |
An estimate of the network of interest. |
threshold |
The threshold value required to reach the given type 1 error rate. |
Deniz Yenigun, Gunes Ertan, Michael Siciliano
M.D. Siciliano, D. Yenigun, G. Ertan (2012). Estimating network structure via random sampling: Cognitive social structures and adaptive threshold method. Social Networks, Vol. 34, No. 4, 585-600. http://dx.doi.org/10.1016/j.socnet.2012.06.004
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # For a given alpha value, say 0.2, we can combine these slices as follows, # which gives an estimate of the complete network atm(dSampled,sampled,0.2)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # For a given alpha value, say 0.2, we can combine these slices as follows, # which gives an estimate of the complete network atm(dSampled,sampled,0.2)
cssTools
Format to a CSS in sna
FormatConverts a CSS in cssTools
package format to a CSS in sna
package format.
cssTools2sna(d)
cssTools2sna(d)
d |
A CSS in |
In cssTools
package, a CSS d
is coded in a three dimensional array
such that d[,,i]
is the i-th slice. In sna
package, the same object
is coded in a three dimensional array such that d[i,,]
is the i-th slice.
The cssTools2sna
function transforms cssTools
format to sna
format.
The same CSS coded in sna
format.
Deniz Yenigun, Gunes Ertan, Michael Siciliano
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Here d is coded in cssTools package format # Switching between sna and cssTools formats e=cssTools2sna(d) f=sna2cssTools(e)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Here d is coded in cssTools package format # Switching between sna and cssTools formats e=cssTools2sna(d) f=sna2cssTools(e)
Estimate a network of interest by aggregating the sampled CSS slices for a fixed threshold.
ftm(d, sampled, k)
ftm(d, sampled, k)
d |
Sampled CSS slices in |
sampled |
A vector indicating which network individuals are sampled. |
k |
A threshold for aggregating the CSS slices. |
Given a random sample of observed CSS slices and a fixed threshold
value k for aggregation, the ftm
function aggregates the observed
slices and provides an estimate for the network of interest by using
the fixed threshold method (FTM) given in Yenigun et. al. (2016).
The function also returns the estimated type 1 and type 2 errors.
estimatedNetwork |
An estimate of the network of interest. |
type1Error |
Estimated type 1 error rate. |
type2Error |
Estimated type 2 error rate. |
type1Count |
Total number of type 1 errors committed. |
type1Instances |
Number of instances for a potential type 1 error.
In other words, number of zeros in the knowledge region of the true network.
Here by knowledge region we mean the ties in the network such that both
actors are sampled, and the tie is estimated by the intersection of
the self reports from both actors.
Note that |
type2Count |
Total number of type 2 errors committed. |
type2Instances |
Number of instances for a potential type 2 error.
In other words, number of ones in the knowledge region of the true network.
Note that |
Deniz Yenigun, Gunes Ertan, Michael Siciliano
D. Yenigun, G. Ertan, M.D. Siciliano (2016). Omission and commission errors in network cognition and estimation using ROC curve. arXiv:1606.03245 [stat.CO] https://arxiv.org/abs/1606.03245
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # For a given threshold, say 2, we can combine these slices as follows, # which gives an estimate of the complete network ftm(dSampled,sampled,2)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # For a given threshold, say 2, we can combine these slices as follows, # which gives an estimate of the complete network ftm(dSampled,sampled,2)
Krackhardt (1987) reports the CSS data collected from 21 managers in a high tech machinery firm. Perceptions of all individuals on the whole network is provided.
data(highTechManagers)
data(highTechManagers)
A 21 by 21 by 21 array of zeroes (nonexistence of tie) and ones (existence of tie), where the
perception slice of the i-th individual correspons to highTechManagers[,,i]
.
In a CSS data set, each actor not only reports his or her self-ties, but also answers questions on all
possible ties in the network. Then a CSS for a network involving N individuals may be represented
by a three dimensional array (
), where i is the sender, j
is the receiver, and m is the perceiver of the relationship.
This data set contains the CSS given in Krackhardt (1987), which reports the perceptions of
all individuals in a network of 21 managers in a high tech machinery firm. In the original data 17th slice is
problematic since row 17 in this slice consists of ones only. To overcome this, we replaced row 17 with column 17.
Krackhardt, D. (1987). Cognitive social structures. Social Networks 9, 109-134. http://dx.doi.org/10.1016/0378-8733(87)90009-8
data(highTechManagers) sliceQuality(highTechManagers)
data(highTechManagers) sliceQuality(highTechManagers)
Estimate a network of interest by aggregating the sampled CSS slices using the ROC based threshold method.
rtm(d, sampled)
rtm(d, sampled)
d |
Sampled CSS slices in |
sampled |
A vector indicating which network individuals are sampled. |
Given a random sample of observed CSS slices, the rtm
function uses the density weighted
ROC based threshold method (RTM) of Yenigun et. al. (2016) to aggregate the observed slices,
and provides an estimate for the network of interest. Slice densities are computed by the
gden
function in the sna
package.
estimatedNetwork |
An estimate of the network of interest. |
type1Error |
Estimated type 1 error rate at the optimum threshold returned by the density weighted ROC method. |
type2Error |
Estimated type 2 error rate at the optimum threshold returned by the density weighted ROC method. |
threshold |
The optimum threshold value. |
details |
A table giving the details of the density weighted ROC method.Columns indicate the threshold, type 1 error (false positive rate), type 2 error, true positive rate (1 - type 2 error), type 1 error count, type 2 error count, and distance. |
Deniz Yenigun, Gunes Ertan, Michael Siciliano
D. Yenigun, G. Ertan, M.D. Siciliano (2016). Omission and commission errors in network cognition and estimation using ROC curve. arXiv:1606.03245 [stat.CO] https://arxiv.org/abs/1606.03245
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # We can combine these slices as follows, # which gives an estimate of the complete network rtm(dSampled,sampled)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Suppose you randomly sampled A, D, and E sampled=c(1,4,5) # Then all you have is the following three sampled slices of A, D and E dSampled=d[,,sampled] # We can combine these slices as follows, # which gives an estimate of the complete network rtm(dSampled,sampled)
Visualisation of the ROC based threshold method for estimating networks,
implemented by the rtm
function.
rtmPlot(rtmOutput)
rtmPlot(rtmOutput)
rtmOutput |
Output from the function |
The function rtm
uses the density weighted ROC based threshold method (RTM) of Yenigun et. al. (2016)
for estimating networks from a random sample of CSS slices. The output from rtm
is
visualized by the function rtmPlot
, which displays the ROC curve, as well as the
type 1 and type 2 error counts for each threshold value.
Deniz Yenigun, Gunes Ertan, Michael Siciliano
D. Yenigun, G. Ertan, M.D. Siciliano (2016). Omission and commission errors in network cognition and estimation using ROC curve. arXiv:1606.03245 [stat.CO] https://arxiv.org/abs/1606.03245
# Load the highTechManagers data given in cssTools package data(highTechManagers) # There are 21 CSS slices in the complete data # Suppose we only observed the 10 slices with the following indexes sampled=c(2,4,5,8,9,10,11,14,18,19) # Then the observed data is the following dSampled=highTechManagers[,,sampled] # Apply the ROC based threshold method to estimate the network y=rtm(dSampled,sampled) # Now plot the ROC curve and the error types for various threshold values rtmPlot(y)
# Load the highTechManagers data given in cssTools package data(highTechManagers) # There are 21 CSS slices in the complete data # Suppose we only observed the 10 slices with the following indexes sampled=c(2,4,5,8,9,10,11,14,18,19) # Then the observed data is the following dSampled=highTechManagers[,,sampled] # Apply the ROC based threshold method to estimate the network y=rtm(dSampled,sampled) # Now plot the ROC curve and the error types for various threshold values rtmPlot(y)
Computes the similarity index between two network matrices.
s14(d1, d2)
s14(d1, d2)
d1 |
An |
d2 |
An |
Given two networks of interest, a common measure of similarity is the
index introduced by Gower and Lagendre (1986). The function
s14
computes this similarity
measure for two networks having the same dimensions.
The similarity index.
Deniz Yenigun, Gunes Ertan, Michael Siciliano
Gower, J.C., Legendre, P. (1986). Metric and Euclidean properties of dissimilarity coefficients. Journal of Classification, 3, 5-48. http://dx.doi.org/10.1007/BF01896809
# Consider two matrices representing networks, d1 and d2 d1=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) d2=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) # The similarity index between d1 and d2 s14(d1,d2)
# Consider two matrices representing networks, d1 and d2 d1=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) d2=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) # The similarity index between d1 and d2 s14(d1,d2)
Given a fully observed CSS, this function evaluates the quality of each slice by comparing them with the true network obtained by LAS intersection.
sliceQuality(d)
sliceQuality(d)
d |
A CSS in |
A common way of defining a true network for a given CSS is the LAS intersection
(see, for example, Siciliano et. al. 2012, or Krackhardt, 1987). For a given CSS, the function sliceQuality
first computes
the true network by LAS intersection, and then compares each slice with the true network.
The considered quantities are matching zeros, matching ones, type 1 errors, type 2 errors,
similarity index, error proportion and correlation.
trueNetwork |
The true network obtained by LAS intersection method. |
sliceQuality |
A table summarizing the quality of each CSS slice in rows. Columns indicate
A (matching zeros), B (0 in CSS slice, 1 in true matrix, i.e., type 2 error),
C (1 in CSS slice, 0 in true network, i.e., type 1 error) D (matching ones),
s14 ( |
Deniz Yenigun, Gunes Ertan, Michael Siciliano
Krackhardt, D. (1987). Cognitive social structures. Social Networks 9, 109-134. http://dx.doi.org/10.1016/0378-8733(87)90009-8
M.D. Siciliano, D. Yenigun, G. Ertan (2012). Estimating network structure via random sampling: Cognitive social structures and adaptive threshold method. Social Networks, Vol. 34, No. 4, 585-600. http://dx.doi.org/10.1016/j.socnet.2012.06.004
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Compute the quality of CSS slices sliceQuality(d)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Compute the quality of CSS slices sliceQuality(d)
sna
Format to a CSS in cssTools
FormatConverts a CSS in sna
package format to a CSS in cssTools
package format.
sna2cssTools(d)
sna2cssTools(d)
d |
A CSS in |
In sna
package, a CSS d
is coded in a three dimensional array such that
d[i,,]
is the i-th slice. In cssTools
package, the same object is coded in a
three dimensional array such that d[,,i]
is the i-th slice. The sna2cssTools
function transforms sna
format to cssTools
format.
The same CSS coded in cssTools
format.
Deniz Yenigun, Gunes Ertan, Michael Siciliano
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Here d is coded in cssTools package format # Switching between sna and cssTools formats e=cssTools2sna(d) f=sna2cssTools(e)
# Consider the example in Siciliano et. al. (2012), # a network with five actors A, B, C, D, E sA=matrix(c(0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),5,5) sB=matrix(c(0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0),5,5) sC=matrix(c(0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),5,5) sD=matrix(c(0,0,1,0,1,0,0,1,1,0,1,1,0,0,0,0,1,0,0,1,1,0,0,1,0),5,5) sE=matrix(c(0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,1,0),5,5) d=array(dim=c(5,5,5)) d[,,1]=sA d[,,2]=sB d[,,3]=sC d[,,4]=sD d[,,5]=sE # Here d is coded in cssTools package format # Switching between sna and cssTools formats e=cssTools2sna(d) f=sna2cssTools(e)