# NOT RUN {
data(fauxmadrona)
names(fauxmadrona)
#
# True value:
#
if(require(network)){
a=as.sociomatrix(fauxmadrona.network)
deg <- apply(a,1,sum)
dis <- fauxmadrona.network \%v\% "disease"
deg1 <- apply(a[dis==1,],1,sum)
deg0 <- apply(a[dis==0,],1,sum)
# differential activity
mean(deg1)/ mean(deg0)
p=mean(dis)
N=1000
# True homophily
p*(1-p)*mean(deg0)*mean(deg1)*N/(mean(deg)*sum(a[dis==1,dis==0]))
}
# HT based estimators using the to.group information
data(fauxmadrona)
homophily.estimates(fauxmadrona,outcome.variable="disease",
to.group0.variable="tonondiseased", to.group1.variable="todiseased",
N=1000)
# HT based estimators not using the to.group information
homophily.estimates(fauxmadrona,outcome.variable="disease",
N=1000,weight.type="RDS-II")
# }
Run the code above in your browser using DataLab