Learn R Programming

MapGAM (version 0.6-2)

optspan: Determine the Optimal Span Size for modgam

Description

Determines the optimal span size for modgam, a spatial logistic generalized additive model (GAM) with a LOESS smooth for location, by minimizing the AIC. Currently evaulates span sizes from 5% to 95% in increments of 5%.

Usage

optspan(rdata, m = "adjusted")

Arguments

rdata
Data set (required). The data must be structured so that the outcome is in the 1st column and X and Y location values are in the 2nd and 3rd columns. The outcome column should be coded as 0s and 1s. Any additional columns will be entered as covariates
m
Model type. Options are "crude" or "adjusted" (default). If "crude", only the spatial smooth term for location is included in the model. If "adjusted", all covariates in the data set (columns >= 4) are included in the model.

Value

  • The optimal span size, determined by minimizing the AIC

See Also

predgrid, modgam, colormap.

Examples

Run this code
data(MAdata)
optspan(MAdata, m="crude")

Run the code above in your browser using DataLab