Description Usage Details Source Examples
krack: Two lists each with 21 21 by 21 adjacency matrices.
BACKGROUND David Krackhardt collected cognitive social structure data from 21 management personnel in a high-tech, machine manufacturing firm to assess the effects of a recent management intervention program. The relation queried was “Who does X go to for advice and help with work?" (krackad) and “Who is a friend of X?" (krackfr). Each person indicated not only his or her own advice and friendship relationships, but also the relations he or she perceived among all other managers, generating a full 21 by 21 matrix of adjacency ratings from each person in the group.
1 |
krackad: 21 network objects.
krackfr: 21 network objects.
Krackhardt D. (1987). Cognitive social structures. Social Networks, 9, 104-134.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | data(krack)
####Requires sna package
#consensus method (MLE version)
library(sna)
kfr.conc<-consensus(krack$krackad,method="romney.batchelder")
##Plot
gplot(kfr.conc,displaylabels=TRUE,boxed.lab=FALSE)
##For more on consensus
?consensus
kfr<-as.sociomatrix.sna(krack$krackfr)
###Baysian network inference
# Let's start by defining some priors for the Bayesian network inference
# model. We'll use an uninformative network prior, together with weakly
# informative (but diffuse and symmetric) priors on the error rates. Read
# the man page ("?bbnam") to get more information about how the routine works.
np<-matrix(0.5,21,21) # 21 x 21 matrix of Bernoulli parameters (since n=21)
emp<-sapply(c(3,11),rep,21) # Beta(3,11) priors for false negatives
epp<-sapply(c(3,11),rep,21) # Beta(3,11) priors for false positives
hist(rbeta(100000,3,11)) # This gives you a sense of what the priors look like!
# Now, let's take some posterior draws for the friendship network, using
# various models (warning: slow)
kfr.post.fixed<-bbnam.fixed(kfr,nprior=np,em=3/(3+11),ep=3/(3+11))
kfr.post.pooled<-bbnam.pooled(kfr,nprior=np,em=emp[1,],ep=epp[1,])
kfr.post.actor<-bbnam.actor(kfr,nprior=np,em=emp,ep=epp)
####Network plot
gplot(apply(kfr.post.fixed$net,c(2,3),median),displaylabels=TRUE,boxed.lab=FALSE)
gplot(apply(kfr.post.pooled$net,c(2,3),median),displaylabels=TRUE,boxed.lab=FALSE)
gplot(apply(kfr.post.actor$net,c(2,3),median),displaylabels=TRUE,boxed.lab=FALSE)
# Examine the results - note the difference that heterogeneity makes!
summary(kfr.post.fixed)
summary(kfr.post.pooled)
summary(kfr.post.actor)
plot(kfr.post.fixed)
plot(kfr.post.pooled)
plot(kfr.post.actor)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.