Convert netify object to amen structured input
prep_for_amen.Rd
Convert netify object to amen structured input
Examples
# load icews data
data(icews)
# filter to a year for cross-sec example
icews_10 <- icews[icews$year == 2010,]
# netify object
icews_matlConf <- netify(
dyad_data = icews_10,
actor1 = 'i', actor2 = 'j',
symmetric = FALSE, weight = 'matlConf',
nodal_vars = c('i_polity2', 'i_log_gdp', 'i_log_pop'),
dyad_vars = c('matlCoop', 'verbCoop', 'verbConf'),
dyad_vars_symmetric = c(FALSE, FALSE, FALSE) )
# convert to amen input
for_amen <- prep_for_amen(icews_matlConf)
# for_amen$Y is the matrix of dyadic weights
dim(for_amen$Y)
#> [1] 152 152
# for_amen$Xdyad is the array of dyadic attributes
dim(for_amen$Xdyad)
#> [1] 152 152 3
# for_amen$Xrow is the matrix of nodal attributes for rows
dim(for_amen$Xrow)
#> [1] 152 3
# for_amen$Xcol is the matrix of nodal attributes for columns
dim(for_amen$Xcol)
#> [1] 152 3
# generate a longitudional, directed and weighted network
# where the weights are matlConf and results are organized
# in an array and we have both dyadic and nodal attributes
icews_matlConf_longit <- netify(
dyad_data=icews,
actor1='i', actor2='j', time='year',
symmetric=FALSE, weight='matlConf',
nodal_vars=c('i_polity2', 'i_log_gdp', 'i_log_pop'),
dyad_vars=c('matlCoop', 'verbCoop', 'verbConf'),
dyad_vars_symmetric=c(FALSE, FALSE, FALSE) )
# convert to amen input
for_amen_longit <- prep_for_amen(icews_matlConf_longit)
# for_amen_longit$Y is the array of dyadic weights
dim(for_amen_longit$Y)
#> [1] 152 152 13
# for_amen_longit$Xdyad is the array of dyadic attributes
dim(for_amen_longit$Xdyad)
#> [1] 152 152 3 13
# for_amen_longit$Xrow is the array of nodal attributes for rows
dim(for_amen_longit$Xrow)
#> [1] 152 3 13
# for_amen_longit$Xcol is the array of nodal attributes for columns
dim(for_amen_longit$Xcol)
#> [1] 152 3 13