discriminate_nests: Find set/s of parameter values to discriminate nests

View source: R/explo_funs.R

discriminate_nestsR Documentation

Find set/s of parameter values to discriminate nests

Description

discriminate_nests uses CART to find sets of parameter values that best distinguish nests from non-nests among revisited locations.

Usage

discriminate_nests(explodata, train_frac)

Arguments

explodata

data.frame of nests and non-nests as output by get_explodata

train_frac

Numeric. The fraction of data to use for training

Details

Given a dataset of revisited locations flagged as either nests or non-nests, discriminate_nests uses Classification and Regression Trees (CART) to find the set (or sets) of revisitation parameters that best distinguishes between nests and non-nests.

The function fits a CART model on the training fraction of the data, prunes the tree, and performs cross-validation using the testing fraction of the data.

The user can specify how much of the data is used for training versus testing the algorithm. If all the data is used for training (train_frac = 1), cross-validation is not possible and error rates are not estimated.

The CART uses the following model formula:

nest ~ consec_days + perc_days_vis + perc_top_vis

The original tree is automatically pruned based on minimum error criterion: the tree is pruned back to the point where the cross-validated relative error (X-rel error) is at its minimum. If multiple trees compete at the minimum X-rel error, the smallest tree is picked.

Value

A list with the Type I and II estimated error rates (where applicable) and a plot of the CART output.


picardis/nestR documentation built on July 2, 2024, 6:35 p.m.