bootstrap: Partial Bootstrap Analysis

Description Usage Arguments Value Methods (by class) Author(s) References See Also Examples

Description

Checks analysis with partial bootstrap resampling.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
bootstrap(object, ...)

## S4 method for signature 'numeric'
bootstrap(object, do, n, ...)

## S4 method for signature 'integer'
bootstrap(object, do, n, ...)

## S4 method for signature 'BootstrapVector'
summary(
  object,
  level = 0.95,
  type = c("student", "normal"),
  probs = c(0.25, 0.75),
  na.rm = FALSE,
  ...
)

## S4 method for signature 'CA'
bootstrap(object, n = 30)

## S4 method for signature 'PCA'
bootstrap(object, n = 30)

Arguments

object

A numeric or an integer vector or a CA or PCA object (see below).

...

Currently not used.

do

A function that takes object as an argument and returns a single numeric value.

n

A non-negative integer giving the number of bootstrap replications.

level

A length-one numeric vector giving the confidence level. Must be a single number between 0 and 1. If NULL, no confidence interval are computed.

type

A character string giving the type of confidence interval to be returned. It must be one "student" (default) or "normal". Any unambiguous substring can be given. Only used if level is not NULL.“

probs

A numeric vector of probabilities with values in [0,1] (see stats::quantile()). If NULL, quantiles are not computed.

na.rm

A logical scalar: should missing values be removed from object before the sample statistics are computed?

Value

If object is a numeric or an integer vector, bootstrap() returns a BootstrapVector object (i.e. a numeric vector of the n bootstrap values of do).

If object is a CA or a PCA object, bootstrap() returns a BootstrapCA or a BootstrapPCA object.

summary() returns a numeric vector with the following elements:

min

Minimum value.

mean

Mean value.

max

Maximum value.

lower

Lower bound of the confidence interval.

upper

Upper bound of the confidence interval.

Q*

Sample quantile to * probability.

Methods (by class)

Author(s)

N. Frerebeau

References

Greenacre, Michael J. Theory and Applications of Correspondence Analysis. London: Academic Press, 1984.

Lebart, L., Piron, M. and Morineau, A. Statistique exploratoire multidimensionnelle: visualisation et inférence en fouille de données. Paris: Dunod, 2006.

See Also

Other resampling methods: jackknife()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
library(ggrepel)

## Random samples from x with replacement
x <- rnorm(20) # numeric
boot <- bootstrap(x, do = mean, n = 100) # Sample mean
summary(boot)

## Sample observations from a multinomial distribution
x <- sample(1:100, 100, TRUE) # integer
boot <- bootstrap(x, do = median, n = 100)
summary(boot)

## Partial bootstrap on CA
## Data from Lebart et al. 2006, p. 170-172
color <- data.frame(
  brun = c(68, 15, 5, 20),
  chatain = c(119, 54, 29, 84),
  roux = c(26, 14, 14, 17),
  blond = c(7, 10, 16, 94),
  row.names = c("marron", "noisette", "vert", "bleu")
)

## Compute correspondence analysis
X <- ca(color)

## Plot results
plot(X) +
  ggrepel::geom_label_repel()

## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)


## Get replicated coordinates
get_replications(Y, margin = 1)
get_replications(Y, margin = 2)


## Plot with ellipses
plot_rows(Y) +
  ggplot2::stat_ellipse()

plot_columns(Y) +
  ggplot2::stat_ellipse()

## Partial bootstrap on PCA
## Compute principal components analysis
data(iris)
X <- pca(iris)

## Plot results
plot_columns(X) +
  ggrepel::geom_label_repel()

## Bootstrap (30 replicates)
Y <- bootstrap(X, n = 30)

## Plot with ellipses
plot_columns(Y) +
  ggplot2::stat_ellipse()

dimensio documentation built on Sept. 18, 2021, 5:06 p.m.