findRes: Choose spatial resolution for analysis

View source: R/ppmlasso/R/ppmlasso_functions.R View source: R/ppmlasso_functions.R

findResR Documentation

Choose spatial resolution for analysis

Description

This function produces a plot to choose the optimal spatial resolution for analysis. A point process model is calculated for each nominated spatial resolution and the log-likelihood of all fitted models are plotted against the spatial resolutions.

Usage

findRes(scales, lambda = 0, coord = c("X", "Y"), sp.xy, env.grid, 
formula, tol = 0.01, ...)

Arguments

scales

A vector of spatial resolutions for which to produce the plot.

lambda

The penalty for each fitted spatial resolution. This should be a single value such that only one point process model is computed for each spatial resolution.

coord

A vector containing the names of the longitude and latitude coordinates, used by getEnvVar.

sp.xy

A matrix of species locations containing at least one column representing longitude and one column representing latitude, as in ppmlasso.

env.grid

The geo-referenced matrix of environmental grids, as in ppmlasso.

formula

The formula of the fitted model, as in ppmlasso.

tol

An optional argument to specify the tolerance level of coordinate error passed to an internal call to the griddify function, set to 0.01 by default.

...

Further arguments passed to ppmlasso.

Details

This function produces a plot which can be used to judge an optimal spatial resolution for analysis. As the spatial resolution gets finer, the log-likelihood tends to stabilise to a constant value. The largest spatial resolution at which the log-likelihood appears to stabilise may be considered optimal for model fitting.

Value

A plot of log-likelihood versus spatial resolution.

Author(s)

Ian W. Renner

References

Renner, I.W. et al (2015). Point process models for presence-only analysis. Methods in Ecology and Evolution 6, 366-379.

Examples

data(BlueMountains)
sub.env = BlueMountains$env[BlueMountains$env$Y > 6270 & BlueMountains$env$X > 300,]
sub.euc = BlueMountains$eucalypt[BlueMountains$eucalypt$Y > 6270 & BlueMountains$eucalypt$X > 300,]
scales = c(0.5, 1, 2, 4, 8, 16)
ppm.form = ~ poly(FC, TMP_MIN, TMP_MAX, RAIN_ANN, degree = 2)
findRes(scales, formula = ppm.form, sp.xy = sub.euc, env.grid = sub.env)

ppmlasso documentation built on May 29, 2024, 7:12 a.m.