auto_BAUs: Automatic BAU generation

Description Usage Arguments Details See Also Examples

View source: R/geometryfns.R

Description

This function calls the generic function auto_BAU (not exported) after a series of checks and is the easiest way to generate a set of Basic Areal Units (BAUs) on the manifold being used; see details.

Usage

1
2
3
auto_BAUs(manifold, type = NULL, cellsize = NULL, isea3h_res = NULL,
  data = NULL, nonconvex_hull = TRUE, convex = -0.05, tunit = NULL,
  xlims = NULL, ylims = NULL, ...)

Arguments

manifold

object of class manifold

type

either “grid” or “hex”, indicating whether gridded or hexagonal BAUs should be used

cellsize

denotes size of gridcell when type = “grid”. Needs to be of length 1 (square-grid case) or a vector of length dimensions(manifold) (rectangular-grid case)

isea3h_res

resolution number of the isea3h DGGRID cells for when type is “hex” and manifold is the surface of a sphere

data

object of class SpatialPointsDataFrame, SpatialPolygonsDataFrame, STIDF, or STFDF. Provision of data implies that the domain is bounded, and is thus necessary when the manifold is a real_line, plane, or STplane, but is not necessary when the manifold is the surface of a sphere

nonconvex_hull

flag indicating whether to use INLA to generate a non-convex hull. Otherwise a convex hull is used

convex

convex parameter used for smoothing an extended boundary when working on a bounded domain (that is, when the object data is supplied); see details

tunit

temporal unit when requiring space-time BAUs. Can be "secs", "mins", "hours", etc.

xlims

limits of the horizontal axis (overrides automatic selection)

ylims

limits of the vertical axis (overrides automatic selection)

...

currently unused

Details

auto_BAUs constructs a set of Basic Areal Units (BAUs) used both for data pre-processing and for prediction. As such, the BAUs need to be of sufficienly fine resolution so that inferences are not affected due to binning.

Two types of BAUs are supported by FRK: “hex” (hexagonal) and “grid” (rectangular). In order to have a “grid” set of BAUs, the user should specify a cellsize of length one, or of length equal to the dimensions of the manifold, that is, of length 1 for real_line and of length 2 for the surface of a sphere and plane. When a “hex” set of BAUs is desired, the first element of cellsize is used to determine the side length by dividing this value by approximately 2. The argument type is ignored with real_line and “hex” is not available for this manifold.

If the object data is provided, then automatic domain selection may be carried out by employing the INLA function inla.nonconvex.hull, which finds a (non-convex) hull surrounding the data points (or centroids of the data polygons). This domain is extended and smoothed using the parameter convex. The parameter convex should be negative, and a larger absolute value for convex results in a larger domain with smoother boundaries (note that INLA was not available on CRAN at the time of writing).

See Also

auto_basis for automatically constructing basis functions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## First a 1D example
library(sp)
set.seed(1)
data <- data.frame(x = runif(10)*10, y = 0, z= runif(10)*10)
coordinates(data) <- ~x+y
Grid1D_df <- auto_BAUs(manifold = real_line(),
                       cellsize = 1,
                       data=data)
## Not run: spplot(Grid1D_df)

## Now a 2D example
data(meuse)
coordinates(meuse) = ~x+y # change into an sp object

## Grid BAUs
GridPols_df <- auto_BAUs(manifold = plane(),
                         cellsize = 200,
                         type = "grid",
                         data = meuse,
                         nonconvex_hull = 0)
## Not run: plot(GridPols_df)

## Hex BAUs
HexPols_df <- auto_BAUs(manifold = plane(),
                        cellsize = 200,
                        type = "hex",
                        data = meuse,
                        nonconvex_hull = 0)
## Not run: plot(HexPols_df)

Example output



FRK documentation built on May 2, 2019, 8:11 a.m.