BootCoefVar: R6 Bootstrap Resampling for Coefficient of Variation

Description Arguments References Examples

Description

The R6 class BootCoefVar produces the bootstrap resampling for the coefficient of variation (cv) of the given numeric vectors. It uses boot and boot.ci from the package boot.

Arguments

x

An R object. Currently there are methods for numeric vectors

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

alpha

The allowed type I error probability

R

integer indicating the number of bootstrap replicates.

References

Canty, A., & Ripley, B, 2017, boot: Bootstrap R (S-Plus) Functions. R package version 1.3-20.

Davison, AC., & Hinkley, DV., 1997, Bootstrap Methods and Their Applications. Cambridge University Press, Cambridge. ISBN 0-521-57391-2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x <- c(
    0.2, 0.5, 1.1, 1.4, 1.8, 2.3, 2.5, 2.7, 3.5, 4.4,
    4.6, 5.4, 5.4, 5.7, 5.8, 5.9, 6.0, 6.6, 7.1, 7.9
)
cv_x <- BootCoefVar$new(x)
cv_x$boot_cv()
cv_x$boot_cv_corr()
cv_x$boot_basic_ci_cv()
cv_x$boot_norm_ci_cv()
cv_x$boot_perc_ci_cv()
cv_x$boot_bca_ci_cv()
cv_x$boot_basic_ci_cv_corr()
cv_x$boot_norm_ci_cv_corr()
cv_x$boot_perc_ci_cv_corr()
cv_x$boot_bca_ci_cv_corr()
R6::is.R6(cv_x)

Example output

Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union


ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot::boot(data = self$x, statistic = function(x, i) {
    100 * ((sd(self$x[i], na.rm = self$na.rm))/(mean(self$x[i], 
        na.rm = self$na.rm)))
}, R = self$R)


Bootstrap Statistics :
    original     bias    std. error
t1* 57.77352 -0.9641535    9.807628

ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot::boot(data = self$x, statistic = function(x, i) {
    100 * (sd(self$x[i], na.rm = self$na.rm)/mean(self$x[i], 
        na.rm = self$na.rm) * ((1 - (1/(4 * (length(self$x[i]) - 
        1))) + (1/length(self$x)) * (sd(self$x[i], na.rm = self$na.rm)/mean(self$x[i], 
        na.rm = self$na.rm))^2) + (1/(2 * (length(self$x) - 1)^2))))
}, R = R)


Bootstrap Statistics :
    original   bias    std. error
t1* 58.05753 -1.05836    10.28461
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv(), conf = (1 - self$alpha), 
    type = "basic")

Intervals : 
Level      Basic         
95%   (37.77, 77.43 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv(), conf = (1 - self$alpha), 
    type = "norm")

Intervals : 
Level      Normal        
95%   (39.35, 78.00 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv(), conf = (1 - self$alpha), 
    type = "perc")

Intervals : 
Level     Percentile     
95%   (37.83, 77.12 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv(), conf = (1 - self$alpha), 
    type = "bca")

Intervals : 
Level       BCa          
95%   (40.74, 81.41 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv_corr(), conf = (1 - self$alpha), 
    type = "basic")

Intervals : 
Level      Basic         
95%   (37.56, 79.44 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv_corr(), conf = (1 - self$alpha), 
    type = "norm")

Intervals : 
Level      Normal        
95%   (38.02, 78.96 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv_corr(), conf = (1 - self$alpha), 
    type = "perc")

Intervals : 
Level     Percentile     
95%   (38.41, 78.99 )  
Calculations and Intervals on Original Scale
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot::boot.ci(boot.out = self$boot_cv_corr(), conf = (1 - self$alpha), 
    type = "bca")

Intervals : 
Level       BCa          
95%   (40.15, 81.91 )  
Calculations and Intervals on Original Scale
[1] TRUE

cvcqv documentation built on Aug. 6, 2019, 5:10 p.m.