Learn R Programming

spacejamr: Simulate Spatial Bernoulli Networks

The goal of spacejamr is to enable social network analysis where conventional collection of social network data would be impossible. It does this by providing tools to prepare shapefiles, simulate spatial point processes, generate networks from those point processes using a spatial interaction function. It also contains plot methods that return 'ggplot2' objects that can be further refined.

Installation

You can install the released version of spacejamr from CRAN with:

install.packages("spacejamr")

Simulate a point process or sequence

library(spacejamr)

# Load Rhode Island dataset
data(RI)

# Spatial Poisson point process
ri_points <- PointProcess(points = 5000, window = RI, seed = 88)

# Halton sequence
ri_seq <- haltonSeq(points = 5000, window = RI, seed = 9)

Generate networks from spatial interaction functions

# Standard power law SIF
rinet_standard <- NetSim(point_process = ri_points, base_prob = 0.95, 
                         scale = 100, threshold = 0.5, power = -2.3)

# Attenuated power law SIF
rinet_apl <- NetSim(point_process = ri_points, type = attenuated,
                    base_prob = 0.93, scale = 100, threshold = 0.5, 
                    power = -1.9)

# Arctangent probability law SIF
rinet_arctan <- NetSim(point_process = ri_points, type = arctan,
                       base_prob = 0.93, scale = 100, threshold = 0.5, 
                       power = -1.9)
                    
# Exponential decay law SIF
rinet_arctan <- NetSim(point_process = ri_points, type = decay,
                       base_prob = 0.93, scale = 100, threshold = 0.5, 
                       power = -1.9)
                    
# Logistic probability law SIF
rinet_arctan <- NetSim(point_process = ri_points, type = logistic,
                       base_prob = 0.93, scale = 100, threshold = 0.5, 
                       power = -1.9)

Plot methods

# Boundaries
plot(RI)

# Point process or sequence realization
plot(ri_points)
plot(ri_seq)

# Network generated from SIF
plot(rinet_standard)
plot(rinet_apl)

Compare two simulated networks

compare_networks(rinet_standard, rinet_apl)

About

Creator: Darren Colby
Creater ORCID: 0000-0001-8468-2755
Maintainer: Darren Colby
Maintainer email: dscolby17@gmail.com
Current version: 0.2
License: MIT

Copy Link

Version

Install

install.packages('spacejamr')

Monthly Downloads

96

Version

0.2.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Darren Colby

Last Published

April 1st, 2022

Functions in spacejamr (0.2.1)

spacejamr

spacejamr: A package for simulating spatial Bernoulli networks
summary.spacejamr

Print summary information of a spacejamr instance
summary.PointSim

Display summary information from a PointSim instance
NetSim

Simulate a network from a point process or sequence
print.PointSim

Print information from a PointSim class
print.spacejamr

Print information from a spacejamr instance
summary.NetSim

Summary of NetSim graphs
plot.spacejamr

Plot the spatial extent of a spacejamr object
print.NetSim

Print information from a NetSim object
PointSim

Simulate a spatial point process or sequence
RI

Geographical boundary of Rhode Island.
as.spacejamr

Initialize a new spacejamr object
compare_networks

Compare statistics from two simulated networks
%>%

Pipe operator
plot.NetSim

Plot a simulated network from a NetSim object
plot.PointSim

Plot simulated points from a PointSim object