Skip to contents

This fuction performs a specified number of bootstrapping iterations using CReSS/SALSA for fitting the count model. See below for details.

Usage

do.bootstrap.cress.robust(
  model.obj,
  predictionGrid,
  splineParams = NULL,
  g2k = NULL,
  B,
  robust = T,
  name = NULL,
  seed = 12345,
  nCores = 1,
  cat.message = TRUE
)

Arguments

model.obj

The best fitting CReSS model for the original count data. Should be geeglm or a Poisson/Binomial GLM (not quasi).

predictionGrid

The prediction grid data

splineParams

The object describing the parameters for fitting the one and two dimensional splines

g2k

(N x k) matrix of distances between all prediction points (N) and all knot points (k)

B

Number of bootstrap iterations

name

Analysis name. Required to avoid overwriting previous bootstrap results. This name is added at the beginning of "predictionboot.RData" when saving bootstrap predictions.

seed

Set the seed for the bootstrap sampling process.

nCores

Set the number of computer cores for the bootstrap process to use (default = 1). The more cores the faster the proces but be wary of over using the cores on your computer. If nCores > (number of computer cores - 2), the function defaults to nCores = (number of computer cores - 2). Note: On a Mac computer the parallel code does not compute so use nCores=1.

rename

A vector of column names for which a new column needs to be created for the bootstrapped data. This defaults to segment.id for line transects (which is required for create.bootcount.data), others might be added. A new column with new ids will automatically be created for the column listed in resample. In case of nearshore data, this argument is ignored.

Value

The function returns a matrix of bootstrap predictions. The number of rows is equal to the number of rows in predictionGrid. The number of columns is equal to B. The matrix may be very large and so is stored directly into the working directory as a workspace object: '"name"predictionboot.RObj'. The object inside is called bootPreds.

Details

The following steps are performed for each iteration:

  • coefficients are resampled from a multivariate normal distribution defined by MLE and COV from the best fitting count model

  • predictions are made to the prediction data using the resampled coefficients