j2 {dyads}R Documentation

MCMC estimates for the j2 model

Description

Estimates j2 model parameters as described in Zijlstra (2017) <doi:10.1080/0022250X.2017.1387858>.

Usage

j2(net, sender = NULL, receiver = NULL , density = NULL, reciprocity = NULL, 
burnin = NULL, sample = NULL, adapt= NULL, center = NULL, seed = NULL) 

Arguments

net

Directed dichotomous n*n network (digraph).

sender

Optional sender covariates of lenght n.

receiver

Optinal receiver covariates of length n.

density

Optional density covariates of dimensions n*n.

reciprocity

Optional symmetric reciprocity covariates of dimensions n*n.

burnin

Optional specification of number of burn-in iterations (default is 10000).

sample

Optional specification of number of MCMC samples (default is 40000).

adapt

Optional number of adaptive sequenses (default is 100).

center

Optional boolean argument for centering predictors (default is TRUE).

seed

Optonal specification of random seed (delfault is 1).

Value

Returns a matrix with MCMC means, standard deviations, quantiles and effective sample sizes for j2 parameters.

Author(s)

Bonne J.H. Zijlstra b.j.h.zijlstra@uva.nl

References

Zijlstra, B.J.H. (2017). Regression of directed graphs on independent effects for density and reciprocity. The Journal of Mathematical Sociology 41 (4).

Examples


# create a very small network with covariates for illustrative purposes
S <- c(1,0,1,0,1,1,0,1,0,1)
REC <- c(0,0,1,1,0,0,1,1,0,0)
D1 <- matrix(c(0,1,0,1,0,1,0,1,0,0,
               0,0,1,1,0,1,0,1,0,1,
               1,1,0,0,1,0,0,0,0,0,
               1,1,1,0,1,0,0,0,0,1,
               1,0,1,0,0,1,1,0,1,1,
               0,0,0,0,0,0,1,1,1,1,
               0,0,0,0,0,1,0,1,0,1,
               1,0,0,0,0,1,1,0,1,1,
               0,1,0,1,0,1,0,1,0,0,
               0,0,1,1,1,0,0,0,0,0), ncol=10)
D2 <- abs(matrix(rep(S,10), byrow = FALSE, ncol= 10) -
            matrix(rep(REC,10), byrow = TRUE, ncol= 10))
R <- D1*t(D1)
Y <- matrix(c(0,0,1,1,1,1,0,0,1,1,
              0,0,0,1,1,1,0,0,1,0,
              1,1,0,1,1,1,0,0,1,1,
              0,1,1,0,1,1,0,1,1,0,
              1,1,1,1,0,1,1,0,1,1,
              0,1,1,1,1,0,1,1,1,0,
              1,0,1,0,1,1,0,1,0,1,
              0,1,1,1,0,1,1,0,1,1,
              1,0,1,0,1,0,1,1,0,1,
              1,1,1,0,0,1,1,1,1,0), ncol=10) 

# estimate j2 model
j2(Y,sender= ~ S, receiver =  ~ REC, density = ~ D1 + D2, reciprocity= ~ R,
   burnin = 100, sample = 400, adapt = 10)
# notice: burn-in, sample size and number of adaptive sequenses are 
# much smaller than recommended to keep computation time low.
# recommended code: 
## Not run: 
j2(Y,sender= ~ S, receiver =  ~ REC, density = ~ D1 + D2, reciprocity= ~ R)

## End(Not run)

[Package dyads version 1.2.1 Index]