estimateParam: Estimates parameters using the given data and maybe some...

View source: R/estimation.R

estimateParamR Documentation

Estimates parameters using the given data and maybe some parameters

Description

Parameter estimation minimizing the negative log likelihood, using the nlminb function. estimateParam uses data from commercial catches or surveys. estimateMultidata uses both sources

Usage

estimateParam(names = c("Fm", "Winf", "Wfs"),
  data = simulateData3(parameters(), samplesize = 1000), start = rep(0.5,
  length(names)), lower = rep(-Inf, length(names)), upper = rep(Inf,
  length(names)), fixed.names = c(), fixed.vals = numeric(0),
  fixed.transformed = TRUE, plotFit = FALSE, isSurvey = FALSE,
  verbose = getOption("verbose"), useTMB = TRUE, ...)

estimateMultidata(names = c("Fm", "Winf", "Wfs"),
  surdata = simulateData3(parameters(), samplesize = 1000, isSurvey =
  TRUE)$sample, comdata = simulateData3(parameters(), samplesize =
  1000)$sample, start = rep(0.5, length(names)), lower = rep(0.1,
  length(names)), fixed.names = c(), fixed.vals = numeric(0),
  plotFit = FALSE, ...)

Arguments

names

string vector, the parameters to be estimated.

data

numeric vector, or data.frame with columns Weight and Freq, or list with a numeric vector named 'sample' or a data.frame named 'df'. Weight of individual fish (vector) or frequencies per weight class data.frame.

start

numeric vector, initial values of the parameters.

lower

The lower bound for the parameter estimation.

upper

The upper bound for the parameter estimation.

fixed.names

String vector. Names of constants.

fixed.vals

Numeric vector. Transformed values of constants.

fixed.transformed

Logical. If FALSE the constants are not transformed.

plotFit

logical, if TRUE a plot is produced with the fited pdf and the kernel density estimate of the data.

isSurvey

logical, if TRUE the data are assumed to be from a survey.

verbose

logical, if TRUE the estimated confidence intervals are printed.

useTMB

logical, if TRUE TMB is used for parameter estimation

...

Additional named arguments passed to plotFit

surdata

Same as data. Survey data.

comdata

Same as data. Commercial data.

Value

link{Parameters} object, containing the estimated parameters.

Note

If data is a list containing both sample and df, the data.frame df will be used.

Author(s)

alko

Examples


## Simulate some data
sam <- simulateData3(params=parameters("a", 0.5, transformed=FALSE))

## Estimate the a parameter and see the fitted plot
estimateParam(names="a", data=sam$sample, plotFit=TRUE)

alko989/s6model documentation built on Nov. 2, 2023, 10:04 p.m.