bootstrap {FSA} | R Documentation |

The `bootCase`

function was added to FSA to maintain backward compatability (because `bootCase`

was removed from car), mostly for users of the Introductory Fisheries Analyses with R book. `bootCase`

is largerly a wrapper to `Boot`

from car with `method="case"`

. It is suggested that `Boot`

from car be used instead. S3 methods are also provided to construct non-parametric bootstrap confidence intervals, predictions with non-parametric confidence intervals, hypothesis tests, and plots of the parameter estimates for `bootCase`

objects.

bootCase(object, f. = stats::coef, B = R, R = 999) ## S3 method for class 'bootCase' confint(object, parm = NULL, level = conf.level, conf.level = 0.95, plot = FALSE, err.col = "black", err.lwd = 2, rows = NULL, cols = NULL, ...) ## S3 method for class 'bootCase' predict(object, FUN, conf.level = 0.95, digits = NULL, ...) ## S3 method for class 'bootCase' htest(object, parm = NULL, bo = 0, alt = c("two.sided", "less", "greater"), plot = FALSE, ...) ## S3 method for class 'bootCase' hist(x, same.ylim = TRUE, ymax = NULL, rows = round(sqrt(ncol(x))), cols = ceiling(sqrt(ncol(x))), ...) ## S3 method for class 'bootCase' plot(x, ...)

`object, x` |
A regression object of type |

`f.` |
A function that will be applied to the updated regression object to compute the statistics of interest. The default is |

`B, R` |
Number of bootstrap samples. |

`parm` |
A number or string that indicates which column of |

`level` |
Same as |

`conf.level` |
A level of confidence as a proportion. |

`plot` |
A logical that indicates whether a plot should be constructed. If |

`err.col` |
A single numeric or character that identifies the color for the error bars on the plot. |

`err.lwd` |
A single numeric that identifies the line width for the error bars on the plot. |

`rows` |
A single numeric that contains the number of rows to use on the graphic. |

`cols` |
A single numeric that contains the number of columns to use on the graphic. |

`...` |
Additional items to send to functions. See details. |

`FUN` |
The function to be applied for the prediction. See the examples. |

`digits` |
A single numeric that indicates the number of digits for the result. |

`bo` |
The null hypothesized parameter value. |

`alt` |
A string that indicates the “direction” of the alternative hypothesis. See details. |

`same.ylim` |
A logical that indicates whether the same limits for the y-axis should be used on each histogram. Defaults to |

`ymax` |
A single value that sets the maximum y-axis limit for each histogram or a vector of length equal to the number of groups that sets the maximum y-axis limit for each histogram separately. |

`col` |
A named color for the histogram bars. |

`confint`

finds the two quantiles that have the (1-`conf.level`

)/2 proportion of bootstrapped parameter estimates below and above. This is an approximate 100`conf.level`

% confidence interval.

`predict`

applies a user-supplied function to each row of `object`

and then finds the median and the two quantiles that have the proportion (1-`conf.level`

)/2 of the bootstrapped predictions below and above. The median is returned as the predicted value and the quantiles are returned as an approximate 100`conf.level`

% confidence interval for that prediction. Values for the independent variable in `FUN`

must be a named argument sent in the ... argument (see examples). Note that if other arguments are needed in `FUN`

besides values for the independent variable, then these are included in the ... argument AFTER the values for the independent variable.

In `htest`

the “direction” of the alternative hypothesis is identified by a string in the `alt=`

argument. The strings may be `"less"`

for a “less than” alternative, `"greater"`

for a “greater than” alternative, or `"two.sided"`

for a “not equals” alternative (the DEFAULT). In the one-tailed alternatives the p-value is the proportion of bootstrapped parameter estimates in `object$coefboot`

that are extreme of the null hypothesized parameter value in `bo`

. In the two-tailed alternative the p-value is twice the smallest of the proportion of bootstrapped parameter estimates above or below the null hypothesized parameter value in `bo`

.

If `object`

is a matrix, then `confint`

returns a matrix with as many rows as columns (i.e., parameter estimates) in `object`

and two columns of the quantiles that correspond to the approximate confidence interval. If `object`

is a vector, then `confint`

returns a vector with the two quantiles that correspond to the approximate confidence interval.

`htest`

returns a two-column matrix with the first column containing the hypothesized value sent to this function and the second column containing the corresponding p-value.

`hist`

constructs histograms of the bootstrapped parameter estimates.

`plot`

constructs scatterplots of all pairs of bootstrapped parameter estimates.

`predict`

returns a matrix with one row and three columns, with the first column holding the predicted value (i.e., the median prediction) and the last two columns holding the approximate confidence interval.

Derek H. Ogle, derek@derekogle.com

S. Weisberg (2005). *Applied Linear Regression*, third edition. New York: Wiley, Chapters 4 and 11.

`bootCase`

in car.

data(Ecoli) fnx <- function(days,B1,B2,B3) { if (length(B1) > 1) { B2 <- B1[2] B3 <- B1[3] B1 <- B1[1] } B1/(1+exp(B2+B3*days)) } nl1 <- nls(cells~fnx(days,B1,B2,B3),data=Ecoli, start=list(B1=6,B2=7.2,B3=-1.45)) nl1.bootc <- bootCase(nl1,B=99) # B=99 too small to be useful confint(nl1.bootc,"B1") confint(nl1.bootc,c(2,3)) confint(nl1.bootc,conf.level=0.90) predict(nl1.bootc,fnx,days=1:3) predict(nl1.bootc,fnx,days=3) htest(nl1.bootc,1,bo=6,alt="less") hist(nl1.bootc) plot(nl1.bootc) cor(nl1.bootc)

[Package *FSA* version 0.8.18 Index]