species_mix.fit is similar to glm.fit and does all the heavy lifting when it comes to estimating species mix models. If you are unfamiliar with how to use glm.fit it is recommended that you use species_mix which is the user friendly wrapper around this function. If you are comfortable with the data strucutres for an species_mix model feel free to use this function for fitting (but realise many of the post processing function - )

species_mix.fit(
  y,
  X,
  W,
  G,
  S,
  spp_weights,
  site_spp_weights,
  offset,
  disty,
  linky,
  size,
  powers,
  control,
  inits = NULL
)

Arguments

y

is a matrix generated from model.response containing the species information. The matrix has the dimensions n_sites * n_species.

X

is a design matrix for the archetype_formula dimension n_sites * n_covariates.

W

is a design matrix for species_formula and will be implemented if species_formula has covariates.

G

is the number of species archetypes that are being estimated.

S

is the number of species to be modelled (this will be calculated internally in species_mix())

spp_weights

These are weights on the species logls and are specifically used in the Bayesian Bootstrap.

site_spp_weights

These are site and species specific weights. For most distributions these will be the same across all species. But this form is required to correctly estiamte the IPPMs. See species_mix for more details.

offset

this is a vector of site specific offsets, this might be something like area sampled at sites.

disty

the error distribution to used in species_mix estimation. Currently, 'bernoulli', 'poisson', 'negative.binomial' and 'guassian' are available - internal conversion of distribution to a integer.

linky

The link function to use alongside the distribution. The link function uses with the distribution (disty)

size

The size of each of binomial sample at each site. Length should be the number of sites.

powers

The power parameters for the Tweedie distribution.

control

this is a list of control parameters that alter the specifics of model fitting.

inits

This will be a vector of starting values for species_mix (i.e you've fitted a model and want to refit it).