make_hsc: Continuous Habitat Suitability Function Generator

Description Usage Arguments Details Value Examples

View source: R/rrevaluate.r

Description

Generate a continuous habitat suitability function given parameter values and scores.

Usage

1
2
make_hsc(value, score, scoreleft = 0, scoreright = 0,
  spline.expand = 1L, ...)

Arguments

value

Vector of parameter values, or a dataframe containing parameters values in the first column and scores in the second column. value must be in ascending order.

score

Vector of scores assigned to parameter values specified in values.

scoreleft

the value to be returned when input values are less than min(value).

scoreright

the value to be returned when input values are greater than max(value).

spline.expand

Add curvature to the habitat suitability curve by expanding the resolution of (value, score) and fitting a spline using spline(). If spline.expand = 1, the habitat suitability curve is generated as a linear interpolation between (value, score) pairs. For integer values of spline.expand > 1, the lengths of value and score are increased to spline.expand*length(value).

...

Additional arguments passed to spline().

Details

When spline.expand > 1, an interpolating spline is first fit to the data. In order to ensure that no scores exceed the maximum score included in score, two separate splines are fit to data below and above the maximum value of score. The interpolated data are then approximated again using a linear interpolation to enforce the extrapolation rules specified by scoreleft and scoreright.

Value

A function representing the habitat suitability curve

Examples

1
2
3
4
5
make_hsc(c(5, 10, 15, 20, 25), c(0, 0.7, 1, 0.75, 0), spline.expand = 1)
make_hsc(c(5, 10, 15, 20, 25), c(0, 0.7, 1, 0.75, 0), spline.expand = 100)

make_hsc(c(5, 10, 15), c(0, 0.7, 1), scoreright = 1, spline.expand = 1)
make_hsc(c(5, 10, 15), c(0, 0.7, 1), scoreright = 1, spline.expand = 100)

mkoohafkan/rremat documentation built on July 3, 2021, 12:06 p.m.