Prepare data for model fitting

Share:

Description

This function prepares the data for model fitting. In particular, it determines observation weights and sets up the design matrix required for fitting a regularisation path.

Usage

1
2
3
4
ppmdat(sp.xy, sp.scale, back.xy, coord = c("X", "Y"), 
sp.dat = env.var(sp.xy = sp.xy, env.scale = sp.scale, 
env.grid = back.xy, coord = coord, file.name = "SpEnvData"),
sp.file = NA, quad.file = NA, file.name = NA)

Arguments

sp.xy

A matrix of species locations containing at least one column representing longitude and one column representing latitude.

sp.scale

The spatial resolution at which to sample quadrature points.

back.xy

The geo-referenced matrix of environmental grids.

coord

A vector containing the names of the longitude and latitude coordinates, as in sample.quad.

sp.dat

A matrix of species presence locations and the corresponding environmental data, as generated by env.var.

sp.file

The name of a saved file containing a matrix of species presence locations and the corresponding environmental data, as generated by env.var.

quad.file

The name of a fie containing the quadrature points created from the sample.quad function.

file.name

An optional argument containing the name of the saved file.

Details

This function will call the sample.quad and env.var functions to generate a quadrature scheme and interpolate environmental data to presence locations. Alternatively, the quadrature scheme may be directly supplied to the quad.file argument, and the matrix of presence locations and associated environmental data may be directly supplied to either the sp.dat function (as an object in the workspace) or to the sp.file argument (as the name of a saved file containing this matrix).

Value

A matrix dat.ppm with columns representing the latitude and longitude of presence locations and quadrature points along with the associated environmental data, as well as a column Pres indicating whether either point corresponds to a presence location or a quadrature point, and a column wt of observation weights.

Author(s)

Ian W. Renner

See Also

sample.quad for generating a regular grid of quadrature points.

env.var for interpolating environmental data to species presence locations.

Examples

1
2
3
data(BlueMountains)
species.ppm = ppmdat(sp.xy = BlueMountains$eucalypt, back.xy = BlueMountains$env, 
sp.scale = 1, file.name = "Sp PPM Data")