all_environmental_fit: Environmental fit for a single dataset

View source: R/EnvironmentalFit.R

all_environmental_fitR Documentation

Environmental fit for a single dataset

Description

all_environmental_fit estimates the best expressions for colonization and extinction rates given their dependency on environmental variables.
greedy_environmental_fit estimates expressions for colonization and extinction rates given their dependency on environmental variables using a greedy algorithm.
custom_environmental_fit estimates the m.l.e. of the parameters describing the relationship between colonization and extinction rates and environmental variables.
NLL_env returns the Negative Log-Likelihood of a pair of colonization and extinction rates for a given dataset with an specific relationship with environmental variables.

Usage

all_environmental_fit(dataset, vector, env, c, e, aic, verbose = FALSE)

custom_environmental_fit(dataset, vector, params, c_expression, e_expression)

NLL_env(dataset, vector, params, c_expression, e_expression)

greedy_environmental_fit(dataset, vector, env, c, e, aic, verbose = FALSE)

Arguments

dataset

A single dataset.

vector

A vector indicating the columns with presence-absence data.

env

The names of the environmental variables to be considered.

c

Tentative colonization rate.

e

Tentative extinction rate.

aic

Tentative AIC to be improved by the optimizer.

verbose

Logical. Do you want to get the intermediate steps looking for the best model?

params

A vector with priors of the parameters in c_expression and e_expression.

c_expression

Expression for colonization.

e_expression

Expression for extinction.

Details

all_environmental_fit calculates all the combinations of parameters, that increase exponentially with the number of parameters. We advise to keep low the number of parameters.
greedy_environmental_fit adds sequentially environmental variables to the expressions of colonization and extinction rates and fix one at a time until termination, when only adding one variable does not improve the AIC of the last accepted model.

Value

A list with three components: a expression for colonization, a expression for extinction and the output of the optimization function, or the output of the optimization function in the custom environmental fit.
In the case of NLL_env, returns the NLL of an specific set or parameters describing the relationship of environmental covariates with colonizaiton and extinction.

Note

AIC is recommended to be higher than the AIC of the most simple model (i.e. not including environmental variables).

See Also

rates_calculator

Examples


all_environmental_fit(idaho[[1]],3:23,c("idaho[[2]]$TOTAL.ppt",
"idaho[[2]]$ANNUAL.temp"),0.13,0.19,100000)
greedy_environmental_fit(idaho[[1]],3:23,c("idaho[[2]]$TOTAL.ppt",
"idaho[[2]]$ANNUAL.temp"),0.13,0.19,100000)

custom_environmental_fit(idaho[[1]], 3:23, c(-0.00497925, -0.01729602,
0.19006501, 0.93486956), expression(params[1] * idaho[[2]]$TOTAL.ppt[i] +
params[3]), expression(params[2] * idaho[[2]]$ANNUAL.temp[i] + params[4]))
NLL_env(idaho[[1]], 3:23, c(-0.00497925, -0.01729602,
0.19006501, 0.93486956), expression(params[1] * idaho[[2]]$TOTAL.ppt[i] +
params[3]), expression(params[2] * idaho[[2]]$ANNUAL.temp[i] + params[4]))


island documentation built on Jan. 23, 2023, 5:30 p.m.