Learn R Programming

realTimeSurv (version 1.0)

aggregator: Aggregate lgcp output to larger geography

Description

Take a lgcpRealPlot object and aggregates the output to a larger geography specified by a spatialPolygons object.

Usage

aggregator(obj, aggpoly, osm = FALSE, verbose = TRUE)

Arguments

obj

An lgcpRealPlot produced by plot or plot_hotspot. NOTE: the call plot or plot_hotspot must have had osm=FALSE set to work with this function.

aggpoly

A spatialPolygons or spatialPolygonsDataFrame object specifying the geography to aggregate to.

osm

A logical value indicating whether to overlay the plot on an OpenStreetMap map

verbose

Logical value indicating whether to show progress bar

Value

An lgcpRealPlot object comprising a list of two ggplot objects.

Details

This function provides a way of producing aggregated model output for larger geographies. The model fitting takes place on a fine regular lattice, this function provides a way to aggregate this to non-regular polygons such as administrative or political boundaries.

Examples

Run this code
# NOT RUN {
data(dat,square,square_pop)
lg1 <- lgcp(data=dat,
            pop.var = c("popdens"),
            boundary=square,
            covariates=square_pop,
            cellwidth=0.1,
            laglength = 7,
            mala.pars=c(200,100,1),
            nchains=2)
p1 <- plot(lg1,square_pop)
aggregator(p1,
           aggpoly=square_pop)
# }

Run the code above in your browser using DataLab