fit_all_dsm: Fit all possible model with the covariates given.

View source: R/fit_all_dsm.R

fit_all_dsmR Documentation

Fit all possible model with the covariates given.

Description

Fit all possible model with the covariates given.

Usage

fit_all_dsm(
  distFit = NULL,
  segdata_obs,
  obsdata,
  response = "ind",
  predictors,
  likelihood = "negbin",
  esw = NULL,
  max_cor = 0.5,
  nb_max_pred = 3,
  complexity = 4,
  smooth_xy = TRUE,
  k = 5,
  splines_by = NULL,
  weighted = FALSE,
  random = NULL,
  soap = list(xt = NULL, knots = NULL),
  use_loo = FALSE
)

Arguments

distFit

distfit object. One of plot_detection output or directly an output of ds

segdata_obs

segdata data.frame with observation added with ajout_obs.

obsdata

Observation data.frame prepared with prepare_data_obs.

response

Response variable to choose between "ind" number of indiviudals or "obs" number of observation.

predictors

vector containing all covariates as character string.

likelihood

Likelihood must be one of "negbin", "poisson" or "tweedie". Default is "negbin".

esw

Value of effective-strip width.

max_cor

Maximum correlation threshold between two covariates tolerated.

nb_max_pred

Maximum number of covariates in a model.

complexity

k argument in smoothers.

smooth_xy

Controls the intercept to include or not a bivariate smooth on x and y : for prediction inside the prospected polygon, should be set to TRUE to obtain stable estimates for prediction outside, MUST be set to FALSE to keep extrapolation under control.

k

Number of models to return for inference.

splines_by

Interaction with splines given by one variable of segdata.

weighted

Either to compute weights or no.

random

variable of segdata_obs to include random effect.

soap

list to pass in order to use a soap-film smooth: must be prepared outside this function.

use_loo

Model selection with leave-one-out cross validation if TRUE, if FALSE it uses AIC to select models.

Value

This function return a list containing:

  1. all_fits_binded : data.frame Containing all fitting infos on models.

  2. best_models : list k best models with standardized value.

  3. best_models4plotting : list k best models with raw values (for plotting).

Note

By default, use cubic B-splines with shrinkage (bs = 'cs').


MathieuGenu/geffaeR documentation built on March 23, 2022, 7:50 p.m.