Environmental fit for a single dataset

Description

all_environmental_fit calculates the best expressions for colonization and extinction rates given their dependency on environmental variables.
greedy_environmental_fit calculates expressions for colonization and extinction rates given their dependency on environmental variables using a greedy algorithm.
custom_environmental_fit calculates the m.l.e. of the parameters describing the relationship between colonization and extinction rates and environmental variables.

Usage

1
2
3
4
5
all_environmental_fit(dataset, vector, env, c, e, aic)

custom_environmental_fit(dataset, vector, params, exp1, exp2)

greedy_environmental_fit(dataset, vector, env, c, e, aic)

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.

params

A vector with priors of the parameters in exp1 and exp2.

exp1

Expression for colonization.

exp2

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.

Note

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

See Also

rates_calculator

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
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)

## End(Not run)
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]))