j2: MCMC estimates for the j2 model

Description Usage Arguments Value Author(s) References Examples

Description

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

Usage

1
2
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. (in press). Regression of directed graphs on independent effects for density and reciprocity. Journal of Mathematical Sociology.

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
32
33
34
35
# 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: 

j2(Y,sender= ~ S, receiver =  ~ REC, density = ~ D1 + D2, reciprocity= ~ R)

dyads documentation built on April 16, 2021, 5:06 p.m.