Last data update: 2014.03.03

R: Mapping Smoothed Effect Estimates from Individual-Level...
MapGAM-packageR Documentation

Mapping Smoothed Effect Estimates from Individual-Level Spatial Data

Description

Contains functions for mapping odds ratios or other effect estimates using individual-level data such as case-control study data, using generalized additive models (GAMs) for smoothing with a two-dimensional predictor (e.g., geolocation or exposure to chemical mixtures) while adjusting for confounding variables, using methods described by Kelsall and Diggle (1998) and Webster at al. (2006). Includes convenient functions for mapping, efficient control sampling, and permutation tests for the null hypothesis that the two-dimensional predictor is not associated with the outcome variable (adjusting for confounders).

Details

Package: MapGAM
Type: Package
Version: 0.7-5
Date: 2014-05-02
License: GPL-3

Typical spatial applications will start with the predgrid function to create a regular grid of points within the study area, with optional map boundaries (e.g., a country, state, or regional map). Crude or adjusted odds ratios (or linear predictors) are then estimated at each grid point using the modgam function to smooth by geolocation. Finally, the predicted values (and optionally, "clusters"–areas of signficantly increased or decreased values determined via permutation tests) are plotted using the colormap function. The trimdata and sampcont functions can be used to restrict data to those within map boundaries and to conduct simple or spatiotemporal stratified sampling from eligible controls. The optspan function can be used to find an optimal span size for the LOESS smoother used by the modgam function; it is automatically used within the modgam function when the span size is not provided by the user. These functions can also be applied to non-spatial data when two-dimensional smoothing is of interest, such as investigation of the effects of a mixture of two chemicals.

Author(s)

Veronica Vieira, Scott Bartell, and Robin Bliss

Send bug reports to sbartell@uci.edu.

References

Hastie TJ, Tibshirani RJ. Generalized Additive Models. (Chapman & Hall/CRC Monographs on Statistics & Applied Probability, Boca Raton, Florida, 1990).

Kelsall J, Diggle P. Spatial variation in risk of disease: a nonparametric binary regression approach. J Roy Stat Soc C-App 1998, 47:559-573.

Vieira V, Webster T, Weinberg J, Aschengrau A, Ozonoff D. Spatial analysis of lung, colorectal, and breast cancer on Cape Cod: An application of generalized additive models to case-control data. Environmental Health 2005, 4:11.

Webster T, Vieira V, Weinberg J, Aschengrau A. Method for mapping population-based case-control studies using Generalized Additive Models. International Journal of Health Geographics 2006, 5:26.

Young RL, Weinberg J, Vieira V, Ozonoff A, Webster TF. A power comparison of generalized additive models and the spatial scan statistic in a case-control setting. International Journal of Health Geographics 2010, 9:37.

http://www.busrp.org/projects/project-2-analyzing-patterns-in-epidemiologic-and-toxicologic-data

See Also

trimdata, sampcont, predgrid, optspan, modgam, colormap.

Examples

# Load synthetic data and a preformatted base map
data(MAmap)		
data(MAdata)

# Create a grid on the base map (PBSmapping package recommended)	
if(require(PBSmapping)) gamgrid <- predgrid(MAdata, MAmap) else
	 gamgrid <- predgrid(MAdata) 		
# Fit a GAM with a smooth term for spatial location
fit1 <- modgam(MAdata, gamgrid, m="crude", sp=0.5)   
# Display odds ratio estimates on the base map
colormap(fit1, MAmap)								

#### See colormap and modgam help files for more examples 

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MapGAM)
Loading required package: sp
Loading required package: gam
Loading required package: splines
Loading required package: foreach
Loaded gam 1.12

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MapGAM/MapGAM-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: MapGAM-package
> ### Title: Mapping Smoothed Effect Estimates from Individual-Level Spatial
> ###   Data
> ### Aliases: MapGAM-package MapGAM
> ### Keywords: package smooth datasets hplot misc
> 
> ### ** Examples
> 
> # Load synthetic data and a preformatted base map
> data(MAmap)		
> data(MAdata)
> ## No test: 
> # Create a grid on the base map (PBSmapping package recommended)	
> if(require(PBSmapping)) gamgrid <- predgrid(MAdata, MAmap) else
+ 	 gamgrid <- predgrid(MAdata) 		
Loading required package: PBSmapping

-----------------------------------------------------------
PBS Mapping 2.69.76 -- Copyright (C) 2003-2016 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/home/ddbj/local/lib64/R/library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2015-04-23
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
http://code.google.com/p/pbs-software/

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------


> # Fit a GAM with a smooth term for spatial location
> fit1 <- modgam(MAdata, gamgrid, m="crude", sp=0.5)   
The unadjusted model is: 
Case ~ lo(Xcoord, Ycoord, span = 0.5)
Family: binomial Link: logit
> # Display odds ratio estimates on the base map
> colormap(fit1, MAmap)								
> ## End(No test)
> #### See colormap and modgam help files for more examples 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>