plot.rcage: Generate Plots Summarizing Main Results

View source: R/plot.rcage.R

plot.rcageR Documentation

Generate Plots Summarizing Main Results

Description

Function generates plots showing the finest resolution, the support-level predictions, the support-level root prediction error, and the support-level CAGE/DCAGE.

Usage

## S3 method for class 'rcage'
plot(x, ..., dB, dataScale = NULL, palette = "plasma")

Arguments

x

An rcage object. The value returned by optRegion() or region().

...

ignored.

dB

A SpatialPolygons object or SpatialPoints object. The areal units of the finest resolution.

dataScale

A function or NULL. If not NULL, the function to be applied to the outcome interest to adjust the scaling in plots.

palette

A character. The palette preference for plotting. The palette is assumed to be viridis palette with possible values 'viridis', 'magma', 'plasma', 'inferno', 'cividis'

Value

No value object returned; called to generate plots.

Examples


# create 5x5 square 

poly <- raster::rasterToPolygons(raster::raster(nrows = 5, ncols = 5,
                                                xmn = -1.25, xmx = 1.25,
                                                ymn = -1.25, ymx = 1.25,
                                                res = 0.5,
                                                crs = "+proj=longlat +datum=WGS84"))

df <- data.frame("x" = stats::rnorm(n = 25))

dt <- sp::SpatialPolygonsDataFrame(poly, df)

knots <- cbind(c(-0.75, 0.0, 0.75, -0.75, 0.0, 0.75, -0.75, 0.0, 0.75),
               c(-0.75,-0.75, -0.75, 0.0, 0.0, 0.0, 0.75, 0.75, 0.75))

res <- optRegion(spatialData = dt,
                 response = "x",
                 sigmavar = rep(1, 25),
                 gL = 5,
                 gU = 7,
                 nGibbs = 50L,
                 nBurn = 10L,
                 nThin = 1L,
                 nw = 2000L,
                 knots = knots)

 plot(x = res, dB = dt)

rcage documentation built on June 7, 2022, 1:07 a.m.

Related to plot.rcage in rcage...