negLL.PLB.counts: Calculate negative log-likelihood for the bounded power-law...

View source: R/likelihood.R

negLL.PLB.countsR Documentation

Calculate negative log-likelihood for the bounded power-law distribution given count data

Description

Calculate the negative log-likelihood of the parameters b, xmin and xmax given count data for the PLB model. Returns the negative log-likelihood. Will be called by nlm() or similar, but xmin and xmax will then be estimated as the min of lowest bin and max of the largest, not numerically using likelihood.

Usage

negLL.PLB.counts(
  b,
  x,
  c,
  K = length(c),
  xmin = min(x),
  xmax = max(x),
  sumclogx = sum(c * log(x))
)

Arguments

b

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

x

vector of length K corresponding to data values x_k, with a corresponding count c being the number of times that x_k is repeated

c

vector of length K giving the counts c_k for each ⁠k=1, 2, 3, ..., K⁠. Must have c[1]>0 and c[K]>0, i.e. non-zero counts for first and last x_k. Note that the c_k do not have to be integer-valued.

K

number of c_k values (length of c).

xmin

minimum value of x_k, as an input to avoid repeatedly calculating.

xmax

maximum value of x_k, as an input to avoid repeatedly calculating.

sumclogx

sum( c * log(x) ), to avoid repeatedly calculating.

Details

For testing the MLEmid methods (using midpoints of bins), then give xmin and xmax explicitly as the lowest and highest bin breaks because the x values correspond to bins. But if x just represents counts of discrete values then no need to specify xmin and xmax, they will be automatically determined as min(x) and max(x), respectively, although it can be good to specify them to avoid repeated calculation.

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.