Giter Site home page Giter Site logo

polnet's Introduction

polnet: A Statistical Analysis of Political Networks

Build Status

This R package provides a computationally efficient way of fitting the Latent Space Network Model (LSNM) and bipartite Link Community Model (biLCM) developed by Kim and Kunisky (2018).

Authors

In Song Kim, [Dmitry Kunisky], Jacob Jaffe

Paper

Mapping Political Communities: A Statistical Analysis of Lobbying Networks in Legislative Politics

Installation

There is currently no package available for the LNSM or biLCM models on CRAN. It is possible to download the package through GitHub instead.

First, make sure the devtools package is installed.

if(!require(devtools)) install.packages("devtools")

This only has to be done if devtools is not already installed and only has to be done once.

Then, use the install_github() function from devtools to install the package.

library(devtools)
install_github("insongkim/polnet",dependencies=TRUE)

Example

This example uses randomly generated poisson data:

#Load polnet package
datmat = matrix(rpois(500, 1), ncol = 10)
lnsmR = LSNM(edges = datmat, D = 2)
  • edges is the matrix of connection strength data, a matrix or an object coercible to a matrix by as.matrix()
  • D is the dimensionality of the latent space model, defaults to 2

One can also use the built-in functions random_LSNM_data and random_biLCM_data to generate data based off of known parameters. For example,

# Load polnet package
comData = random_biLCM_data(m = 10, n = 7, k = 4)
biLCMR = biLCM(A = comData[A_mat], m = 10, n = 7, k = 4)
  • m is the number of clients
  • n is the number of politicians
  • k is the number of link communities
  • A is the matrix of connection strength data

Test data, describing the House of Representative voting records of the 115th Congress, is also included in this package. With politicians and bills making up the two different groups, this dataset can be subject to LSNM and biLCM analysis.

polnet's People

Contributors

jacobjaf avatar insongkim avatar hshackle avatar shiyaoliu avatar

Watchers

James Cloos avatar

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.