Statnet and latentnet
From InterSciWiki
The R software package latentnet: software to fit and evaluate latent position and cluster models for statistical networks.
The R software package statnet: software tools for the representation, visualization, analysis and simulation of social network data.
- Online Users Guide: Manuals - all to appear in -- http://www.jstatsoft.org/v23 (forthcoming v24)
- network: A package for managing relational data in R - Butts CT (2008).
- ergm: A package to fit, simulate and diagnose exponential family models for networks
- Using ergm : Specification of exponential-family random graph models and computational tips
- latentnet: a package for fitting latent cluster models for networks
- sna: A package for social network analysis
- Degreenet
- dynamicnetwork and rSoNIA: Prototype packages for managing and animating longitudinal network data
- A tutorial on statnet
- install.packages("statnet")
- After installation you will see
Type help(package="statnet") to get started. Based on "statnet" project software (http://statnetproject.org). For license and citation information see http://statnetproject.org/attribution or type citation("statnet"). Warning messages: (Not a problen if 2.6.1 or later) 1: package 'statnet' was built under R version 2.6.2 2: package 'network' was built under R version 2.6.2 3: package 'ergm' was built under R version 2.6.2
help(package="statnet") install.statnet update.statnet library(network)
Contents |
[edit] ergm
For "A simple model for complex networks with arbitrary degree distribution and clustering", Mark S. Handcock and Martina Morris, see ergm in User's Guide for "ergm: A Package to Fit, Simulate and Diagnose Exponential-Family Models for Networks" David R. Hunter, Mark S. Handcock, Carter T. Butts
You may install erge directly (from the ergm article 2008)
install.packages("ergm")
library(ergm)
For sample datasets see
help(samplike) #Sampson Monastery data ? faux.mesa.high #students in grades 7-12
You can experiment with
data(sampson) ?samplike # ?sampson also works here summary(samplike)
[edit] Examples of ERGMs
[edit] Bernoulli and Erd˝os-R´enyi models
model1 <- ergm(samplike ~ edges) model1$coef #equal logit (88/306) = −.9072.
- the ergm command requires the formula format in R, much like other regression-like functions such as lm for linear regression or glm for generalized linear models.
- network object ~ <model term 1> + <model term 2> + · · · ,
[edit] P1 Model
model2 <- ergm(samplike ~ edges + sender + receiver + mutual, control=control.ergm(check.degeneracy=FALSE), verbose=TRUE) summary(model2)
[edit] exogeneous covariates and dyadic independence
this model contains terms for the overall number of edges, a differential homophily effect for grade, and a main effect for sex. We may fit this model using the faux.mesa.high dataset as follows:
data(faux.mesa.high)
model3 <- ergm(faux.mesa.high ~ edges + nodematch("Grade", diff=T) + nodefactor("Sex"))
summary(model3)
[edit] Dyadic dependence models
degenerate - see refs
[edit] Curved exponential-family models
model4 <- ergm(faux.mesa.high ~ edges + nodematch("Grade") + gwesp(0.5, fixed=TRUE), verbose=TRUE, control=control.ergm(check.degeneracy=FALSE))
summary(model4)
[edit] Statistical inference for ERGMs
[edit] Approximating an MLE
Through simulation - see
