negLL.PLB.binned.species: Calculate the negative log-likelihood of 'b' for the PLB...

View source: R/likelihood.R

negLL.PLB.binned.speciesR Documentation

Calculate the negative log-likelihood of b for the PLB model, given species-specific binned data (MLEbins method). DEPRECATED – ⁠use negLL.PLB.bins.species()⁠

Description

Calculate the negative log-likelihood of b for the PLB model, given binned data where the bins can be different for each species. Returns the negative log-likelihood. This was Andy's original likelihood function but we replaced it with Mike's simpler one, so use negLL.PLB.bins.species(). Documented this one first, so keeping. Will be called by nlm() or similar, but xmin and xmax will just be estimated as the min of lowest bin and max of the largest bin (i.e. their MLEs), no need to do numerically.

Usage

negLL.PLB.binned.species(b, dataBinForLike, dataBinForLikeSummary)

Arguments

b

value of b for which to calculate the negative log-likelihood

dataBinForLike

table data frame (tbl_df) where each row is the count in a bin of a species, and columns (and corresponding mathematical notation in MEPS Appendix) are:

  • SpecCode: code for each species, s

  • wmin: lower bound of the bin, ⁠w_\{sj\}⁠ where j is the bin number

  • wmax: upper bound of the bin, ⁠w_\{s,j+1\}⁠

  • Number: count in that bin for that species, ⁠d_\{sj\}⁠ For each species the first and last bins must be non-empty, i.e. ⁠w_\{s1\}, w_\{s,J_s +1\} > 0⁠. Should ideally write code to check that before calling this function (since this gets repeatedly called).

dataBinForLikeSummary

tbl_df with one row for each species, giving the minimum lower bound ⁠w_\{s1\}⁠ and maximum upper bound ⁠w_\{s,J_s +1\}⁠ and the number of counts for that species, where J_s is the number of bins for species s (won't need to explicilty specify). Columns are:

  • SpecCode: code for each species s

  • wminSpecies: minimum lower bound ⁠w_\{s1\}⁠

  • ⁠wmaxSpecies: maximum upper bound ⁠w_{s,J_s +1}'

  • n_s: total number of counts for species s n_s

Value

negative log-likelihood of the parameters given the data

Author(s)

Andrew Edwards


andrew-edwards/sizeSpectra documentation built on June 28, 2023, 7:09 p.m.