parametric.nlsfit: NLS fit with parametric bootstrap

parametric.nlsfitR Documentation

NLS fit with parametric bootstrap

Description

NLS fit with parametric bootstrap

Usage

parametric.nlsfit(fn, par.guess, boot.R, y, dy, x, dx, lower = rep(x = -Inf,
  times = length(par.guess)), upper = rep(x = +Inf, times =
  length(par.guess)), ..., bootstrap = TRUE)

Arguments

fn

fn(par, x, ...). The (non-linear) function to be fitted to the data. Its first argument must be the fit parameters named par. The second must be x, the explaining variable. Additional parameters might be passed to the function. Currently we pass boot.r which is 0 for the original data and the ID (1, ...) of the bootstrap sample otherwise. As more parameters might be added in the future it is recommended that the fit function accepts ... as the last parameter to be forward compatible.

par.guess

initial guess values for the fit parameters.

boot.R

numeric. Number of bootstrap samples to generate.

y

the data as a one-dimensional numerical vector to be described by the fit function.

dy, dx

Numeric vector. Errors of the dependent and independent variable, respectively. These do not need to be specified as they can be computed from the bootstrap samples. In the case of parametric bootstrap it might would lead to a loss of information if they were computed from the pseudo-bootstrap samples. They must not be specified if a covariance matrix is given.

x

values of the explaining variable in form of a one-dimensional numerical vector.

lower

Numeric vector of length length(par.guess) of lower bounds on the fit parameters. If missing, -Inf will be set for all.

upper

Numeric vector of length length(par.guess) of upper bounds on the fit parameters. If missing, +Inf will be set for all.

...

Additional parameters passed to fn, gr and dfn.

bootstrap

Shall the error calculation be performed using boostrap? If not, the errors are estimated with help of the jacobian (either provided in gr or calculated using the numDeriv-package).

Value

See simple.nlsfit.

See Also

Other NLS fit functions: bootstrap.nlsfit(), parametric.bootstrap.cov(), parametric.bootstrap(), parametric.nlsfit.cov(), plot.bootstrapfit(), predict.bootstrapfit(), print.bootstrapfit(), simple.nlsfit(), summary.bootstrapfit()

Examples

## Declare some data.
value <- c(0.1, 0.2, 0.3)
dvalue <- c(0.01, 0.01, 0.015)
x <- c(1, 2, 3)
dx <- c(0.1, 0.1, 0.1)
boot.R <- 1500

fn <- function (par, x, ...) par[1] + par[2] * x

fit.result <- parametric.nlsfit(fn, c(1, 1), boot.R, value, dvalue, x, dx)
summary(fit.result)

hadron documentation built on Sept. 9, 2022, 5:06 p.m.