myresamplefn {cabootcrs}R Documentation

Example of a user-generated resampling routine.


myresamplefn in this case assumes that each pair of cells represents 50 people answering yes or no to a question, with undecideds not recorded





a data matrix, to be resampled from


This is only intended as an example of a user-generated resampling routine, users should replace it with their own function of this name

In this example we assume that rows groups of 50 people have each been asked columns/2 questions, with possible answers yes/no/undecided. It uses binomial bootstrapping for pairs of columns, assuming that successive columns are "yes" and "no" answers, with others undecided, with sums of pairs of columns having a maximum, in this case 50.


a resampled version of the input data matrix

See Also

cabootcrs-package, cabootcrs


# Five groups of people answer two yes/no/undecided questions
# Note: this is just an example, and does not intend to claim that this
# is the correct analysis for such a data set

x <- as.matrix( rbind( c(22,25,18,22), c(12,23,21,27),
                       c(31,12,28,22), c(29,14,35,11), c(7,31,12,21)))
xresampled <- myresamplefn(x)
bmr <- cabootcrs(x,"myresample",nboots=199)

[Package cabootcrs version 2.1.0 Index]