weightPB: Computes weights for presence and background records

Description Usage Arguments Value Author(s) Examples

View source: R/weightPB.R

Description

Presence and background samples are highly unbalanced, generally by more than one order of magnitude. Many functions such as gam or ranger have an argument named weights or similar that helps to work around the sample unbalance. Such an argument requires a numeric vector as input, with one position per record in the data used to fit the model. Each value in the weights vector represents the relative weight of a single case, and all the values in the weights vector get to sum 1. For example, if a presence column is 1, 0, 0, its relative weights would be 0.5, 0.25, 0.25. The function takes as input an ordered numeric vector of ones and zeroes representing the presence and background data of an input dataset to fit SDMs.

Usage

1

Arguments

x

Ordered numeric vector with ones and zeroes respectively representing presence and background records. This will generally be the "presence" column of a data frame to be used to fit a species distribution model.

Value

A numeric vector with the weights of the ones and zeroes available in the input vector.

Author(s)

Blas Benito <blasbenito@gmail.com>

Examples

1
2
3

BlasBenito/SDMworkshop documentation built on March 4, 2020, 4:16 a.m.