ludwig: : Simulating and Estimating Undirected Binary Networks

Description Functions References Examples

Description

The purpose of this package is to provide some tools for methodological researchers interested in exploring undirected binary networks. The parameter estimation method is inspired by an article by Strauss (1992). In this article, Strauss describes with reference to Besag (1975), how lattice models could be fit using the pseudolikelihood method. As a consequence, binary network models could be fit with standard statistical functions capable of multivariate logistic regression, such as glmnet or glm. This package provides an experimental infastructure for exploring this idea with possible extensions in mind. However, it has to be noted that the sampling properties of the maximum pseudolikelhood estimator (MPE) seem to be unexplored (see Strauss, 1992). Similar to the package IsingFit by van Borkulo, Epskamp and Robitzsch (2014), this package uses regularized logistic regression (package glmnet) by default. In addition, the use of the standard package glm is available.

Note that Bayesian estimation is only available when JAGS http://mcmc-jags.sourceforge.net. is installed.

Functions

References

Besag, J. (1975). Statistical analysis of non-lattice data. The Statistician, 24(3), 179–195.

Strauss, D. (1992). The many faces of logistic regression. American Statistician, 46(4), 321–327.

van Borkulo, C., Epskamp, S., & Robitzsch (2014). IsingFit: Fitting Ising models using the eLasso method. R package version 0.3.0.

Examples

 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
# Create the coefficients that define a
# network with four nodes
coef1 <- c(-0.5,-0.5,-0.5,-0.5,1,-1,1,1,-1,1)

# Simulate 1000 observations from the network.
# Use a burnin period of 5000 iterations and
# random updating.
dat1 <- simnet(4,coef1,5000,1000)

# Try to recover the parameters
# using the default settings of estnet()
net1 <- estnet(dat1)
  
# Print the results
print(net1)

# Try the same with glm()
net2 <- estnet(dat1, method="glm")

# Print the results
print(net2)

# Plot the networks
plot(net1, labels = c("A", "B", "C", "D"), 
     maximum = 1.5)
plot(net2, labels = c("A", "B", "C", "D"),
     maximum = 1.5) 
     
# Print estimated vs true coefficients
plot(coef(net1), coef1, xlab = "Estimated", ylab="True")
plot(coef(net2), coef1, xlab = "Estimated", ylab="True")

ghosoya/ludwig documentation built on Sept. 20, 2020, 3:48 p.m.