rvboot generates a random vector of the same length as data from the empirical distribution of the data.

rvboot(data)

Arguments

data

A vector of constants

Details

rvboot

References

Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.

See also vignette("rv").

Author

Jouni Kerman jouni@kerman.com

Examples


  y <- rnorm(30) # Some data: 30 draws from standard normal.
  x <- rvboot(y) # A random vector of length 30 (each component has the same distribution)
  print(mean(x)) # Bootstrap estimate of the mean.
#>      mean   sd    1%  2.5%   25%   50%    75% 97.5%  99% sims
#> [1] -0.16 0.14 -0.48 -0.45 -0.26 -0.18 -0.067 0.097 0.11  200
  print(sd.rv(x))   # Bootstrap estimate of the sd.
#>     mean    sd   1% 2.5%  25%  50%  75% 97.5% 99% sims
#> [1] 0.83 0.083 0.66 0.67 0.77 0.84 0.89     1   1  200
  # rvinci(mean(x), 0) # Hypothesis test: mean of x is zero (at 5% level) FALSE => reject.