Description Functions References Examples
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.
estnet
Estimate the network parameters using regularized logistic regression using glmnet
.
simnet
Simulate data from a network using probabilistic sequential node updating.
create_matrix
An internal function to create the predictor matrix and data vector for maximum pseudolikelihood estimation.
print.estnet
Print the results of the analysis.
plot.estnet
Plot the results of the analysis using qgraph
.
crossval
A crossvalidation function to assess the network's predictive capabilities on the global and node levels.
estnet_bayes
Bayesian estimation of the network parameters using rjags
.
print.estnet_bayes
Prints the results of the Bayesian estimation.
plot.estnet_bayes
Plot the results of the analysis using qgraph
.
R_hat
Prints the Gelman-Rubin-Statistic for the Markov chains via gelman.diag
.
auto
Prints autocorrelation of the chains via autocorr.diag
.
diag_plot
Visualizes the chains and convergence diagnostics via mcmcplot
.
DIC
Assesses the deviance information criterion (DIC) via dic.samples
.
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.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.