Coder Social home page Coder Social logo

amen's Introduction

amen

Additive and multiplicative effects network models

Package website

About

Additive and multiplicative effects network models (AMEN models) provide a statistical modeling framework for dyadic network and relational data, built upon familiar data analysis tools such as linear regression, random effects models and matrix decompositions. The amen package provides Bayesian model fitting algorithms for AMEN models, and accommodates a variety of types of network relations, including continuous, binary and ordinal dyadic variables.

The basic AMEN model is of the form yi, j ∼ βxi, j + uivj + ai + bj + ϵi, j where

  • yi, j is the observed dyadic variable being modeled and xi, j is an observed vector of regressors;

  • ai + bj + ϵi, j is an additive random effects term that describes sender and receiver variance (such as outdegree and indegree heterogeneity) and dyadic correlation;

  • uivj is a multiplicative random effects term that describes third-order dependence patterns (such as transitivity and clustering) and can be estimated and analyzed to uncover low-dimensional structure in the network.

Installation

# Current version on GitHub
devtools::install_github("pdhoff/amen") 

# CRAN-approved version on CRAN
install.packages("amen")

Documentation and citation

A tutorial article and many data analysis examples are available via the tutorial. Please cite this as

Hoff, P.D. (2015) “Dyadic data analysis with amen”. arXiv:1506.08237.

A review article that provides some mathematical details and derivations is available on arXiv. Please cite this

Hoff, P.D. (2018) “Additive and multiplicative effects network models”. arXiv:1807.08038.

The first version of the AMEN model appeared in

Hoff, P.D. (2005) “Bilinear mixed-effects models for dyadic data”. JASA 100(469) 286-295.

That version restricted the multiplicative sender and receiver effects to be equal (ui = vi). The AMEN model in its current form does not have this restriction. The current AMEN model first appeared in

Hoff, P.D., Fosdick, B.K., Volfovsky, A. and Stovel, K. (2013) “Likelihoods for fixed rank nomination networks”. Network Science, 1(3):253–277.

Some examples

amen's People

Contributors

pdhoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

amen's Issues

missing data

Hi Professor Hoff,

I have a question about dealing with missing data using the function ame_rep. I got the warning message ("WARNING: replacing NAs in design matrix with zeros") when I was using the amen package to analyze my data with NAs. In the tutorial, the demonstrated case with missing data using the function "ame" does not have a warning message like what I got here. Could you please help me address this issue?

Thank you for your help in advance!
Yue

ame() segfaults before sampling with large network

I am trying to run ame() on a large weighted network, but the model always segfaults before burn-in begins. This has happened across 5 different tries, but I've only gotten an informative error once that seems to suggest it has something to do with the singular value decomposition in the multiplicative effects portion of the model.

The network has 44,007 nodes, resulting in an adjacency matrix that takes up ~16 GB in memory. Edges are weighted are are positive real values. I believe this is a function of the size of the model because the same model will begin sampling on a subgraph of 8000 nodes. The process that does not appear to be running out of memory - if I provide it with 1 TB of RAM, it never uses more than around 400 GB.

The ame() call that segfaults:

test <- ame(Y = model_adj, Xrow = rai, R=1, family='nrm', symmetric = TRUE, 
            burn = 1000, nscan=10000, odens=50, seed=1017, print=T, plot=F)

The error:

 *** caught segfault ***
address 0x7fa77e20aee8, cause 'memory not mapped'

Traceback:
 1: La.svd(x, nu, nv)
 2: svd(E)
 3: ame(Y = model_adj, Xrow = rai, R = 1, family = "nrm", symmetric = TRUE,     burn = 1000, nscan = 10000, odens = 50, seed = 1017, print = T,     plot = F)
An irrecoverable exception occurred. R is aborting now ...
/var/spool/slurmd/job20933418/slurm_script: line 30: 19909 Segmentation fault      Rscript amen_model.R

And the output from sessionInfo() - the CPU architecture is not the same on every node, so libopenblas may be compiled against a different architecture on different runs:

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.8 (Maipo)

Matrix products: default
BLAS/LAPACK: /nas/longleaf/apps/r/4.0.3/lib/libopenblas_haswellp-r0.3.5.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] amen_1.4.4      igraph_1.2.6    forcats_0.5.0   stringr_1.4.0   dplyr_1.0.6     purrr_0.3.4     readr_1.4.0     tidyr_1.1.2     tibble_3.1.2    ggplot2_3.3.3   tidyverse_1.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        cellranger_1.1.0  pillar_1.6.1      compiler_4.0.3    dbplyr_2.0.0      tools_4.0.3       lattice_0.20-41   jsonlite_1.7.2    lubridate_1.7.9.2 lifecycle_1.0.0  
[11] gtable_0.3.0      pkgconfig_2.0.3   rlang_0.4.11      Matrix_1.2-18     reprex_0.3.0      cli_2.5.0         rstudioapi_0.13   DBI_1.1.0         haven_2.3.1       withr_2.4.2      
[21] xml2_1.3.2        httr_1.4.2        fs_1.5.0          generics_0.1.0    vctrs_0.3.8       hms_0.5.3         grid_4.0.3        tidyselect_1.1.1  glue_1.4.2        R6_2.5.0         
[31] fansi_0.5.0       readxl_1.3.1      modelr_0.1.8      magrittr_2.0.1    backports_1.2.1   scales_1.1.1      ellipsis_0.3.2    rvest_0.3.6       assertthat_0.2.1  colorspace_2.0-1 
[41] utf8_1.2.1        stringi_1.5.3     munsell_0.5.0     broom_0.7.5       crayon_1.4.1 

Error while replicating example

Hi, when replicating the example for ame_rep, I encountered this error
Error in ame_rep(YX_bin_long$Y, YX_bin_long$X, burn = 5, nscan = 5, odens = 1, :
unused argument (family = "bin")

I tried re-installing amen, but didn't work.

Data type check suggestion

Hi,

I encountered a dimension issue inside the design_array function. I figured out that the data type must be matrix not data.frame because amen was using length to calculate the # of elements in Xrow (or Xcol) array. I would like to suggest adding data-type check step inside the routine so that users can be redirected to the right course.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.