Learn R Programming

ssdtools (version 0.3.7)

ssd_fit_dists: Fit Distributions

Description

Fits one or more distributions to species sensitivity data.

Usage

ssd_fit_dists(
  data,
  left = "Conc",
  right = left,
  weight = NULL,
  dists = c("llogis", "gamma", "lnorm"),
  computable = FALSE,
  silent = FALSE
)

Arguments

data

A data frame.

left

A string of the column in data with the concentrations.

right

A string of the column in data with the right concentration values.

weight

A string of the column in data with the weightings (or NULL)

dists

A character vector of the distribution names.

computable

A flag specifying whether to only return fits with numerically computable standard errors.

silent

A flag indicating whether fits should fail silently.

Value

An object of class fitdists (a list of fitdistrplus::fitdist() objects).

Details

By default the 'llogis', 'gamma' and 'lnorm' distributions are fitted to the data. The ssd_fit_dists function has also been tested with the 'gompertz', 'lgumbel' and 'weibull' distributions.

If weight specifies a column in the data frame with positive integers, weighted estimation occurs. However, currently only the resultant parameter estimates are available (via coef).

If the right argument is different to the left argument then the data are considered to be censored.

The fits are performed using fitdistrplus::fitdist() (and fitdistrplus::fitdistcens() in the case of censored data). The method used is "mle" (maximum likelihood estimation) which means that numerical optimization is carried out in fitdistrplus::mledist() using stats::optim() unless finite bounds are supplied in the (lower and upper) in which it is carried out using stats::constrOptim(). In both cases the "Nelder-Mead" method is used.

Examples

Run this code
# NOT RUN {
ssd_fit_dists(boron_data)
data(fluazinam, package = "fitdistrplus")
ssd_fit_dists(fluazinam, left = "left", right = "right")
# }

Run the code above in your browser using DataLab