PBoot: Parametric bootstrap

View source: R/estimation.R

PBootR Documentation

Parametric bootstrap

Description

Applies parametric bootstrap to an estimated distribution

Usage

PBoot(
  d,
  n,
  nsim = 1000,
  trim = c(-Inf, Inf),
  doTrunc = FALSE,
  par.low = rep(-Inf, nPar(d)),
  par.high = rep(Inf, nPar(d)),
  method = "Nelder-Mead",
  control = list(fnscale = -1, maxit = 10000)
)

Arguments

d

distributions3 object, estimated distribution. Typically, the output of estim_ML.

n

Integer, size of each resampled dataset. Typically length(y), where y are calibration data.

nsim

Integer, number of resampled datasets.

trim

Numeric vector of size 2, trimming bounds.

doTrunc

Logical, do truncation? default FALSE, i.e. rectification is used.

par.low

Numeric vector of size nPar(d), lower bounds for parameters.

par.high

Numeric vector of size nPar(d), higher bounds for parameters.

method

Character string, optimization method, see ?optim.

control

List, controls for optimization algorithm, see ?optim.

Value

a matrix of size nsim * nPar(d) containing the estimated parameters

Examples

# EXAMPLE 1
# Define Normal distribution
norm <- Normal(mu=1,sigma=2)
# generate data and reset all negative values to zero
y <- random(norm,200); y[y<0] <- 0
# Estimate rectified Gaussian distribution.
fit <- estim_ML(d=norm,y=y,trim=c(0,Inf),par.low=c(-Inf,0))
# Do parametric bootstrap.
boot <- PBoot(fit,length(y),trim=c(0,Inf),par.low=c(-Inf,0),nsim=100)
plot(boot)

# EXAMPLE 2
# Define Normal distribution
norm <- Normal(mu=0.75,sigma=0.25)
# generate data and remove all values outside [0;1]
z <- random(norm,200); y <- z[z>0 & z<1]
# Estimate truncated Gaussian distribution.
fit <- estim_ML(d=norm,y=y,trim=c(0,1),doTrunc=TRUE,par.low=c(-Inf,0))
# Do parametric bootstrap.
boot <- PBoot(fit,length(y),trim=c(0,1),doTrunc=TRUE,par.low=c(-Inf,0),nsim=100)
plot(boot)

benRenard/disTRIMbution documentation built on July 1, 2023, 4:24 a.m.