GithubHelp home page GithubHelp logo

xiaochi-liu / spatialepi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rudeboybert/spatialepi

0.0 1.0 0.0 25.98 MB

R Package of methods and data for spatial epidemiology

R 57.71% C++ 13.30% GLSL 0.35% HTML 19.49% TeX 9.15%

spatialepi's Introduction

SpatialEpi

Travis-CI Build Status CRAN_Status_Badge CRAN RStudio mirror downloads

Package of data and methods for spatial epidemiology.

Installation

Get the released version from CRAN:

install.packages("SpatialEpi")

Or the development version from GitHub:

# If you haven't installed devtools yet, do so:
# install.packages("devtools")
devtools::install_github("rudeboybert/SpatialEpi")

Example

We load the data and convert the coordinate system from latitude/longitude to a grid-based system.

library(SpatialEpi)
data(NYleukemia)
sp.obj <- NYleukemia$spatial.polygon
centroids <- latlong2grid(NYleukemia$geo[, 2:3])
population <- NYleukemia$data$population
cases <- NYleukemia$data$cases

We plot the incidence of leukemia for each census tract.

plotmap(cases/population, sp.obj, log=TRUE, nclr=5)
points(grid2latlong(centroids), pch=4)

We run the Bayesian Cluster Detection method from Wakefield and Kim (2013)

y <- cases
E <- expected(population, cases, 1)
max.prop <- 0.15
shape <- c(2976.3, 2.31)
rate <- c(2977.3, 1.31)
J <- 7
pi0 <- 0.95
n.sim.lambda <- 10^4
n.sim.prior <- 10^5
n.sim.post <- 10^5

# Compute output
output <- bayes_cluster(y, E, population, sp.obj, centroids, max.prop,
                        shape, rate, J, pi0, n.sim.lambda, n.sim.prior,
                        n.sim.post)
#> [1] "Algorithm started on: Sat Aug 20 11:35:52 2016"
#> [1] "Importance sampling of lambda complete on: Sat Aug 20 11:36:28 2016"
#> [1] "Prior map MCMC complete on: Sat Aug 20 11:42:45 2016"
#> [1] "Posterior estimation complete on: Sat Aug 20 11:53:11 2016"
plotmap(output$post_map$high_area, sp.obj)

spatialepi's People

Contributors

rudeboybert avatar whoishomer 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.