ProbSampleReplace

0th

Percentile

Draw a sample of size 1 given probabilities

This uses the RcppArmadillo implementation of the sample() command to draw a sample of size 1 from 0:(n-1) given probability vector p of length n. This is used for sampling interal to an Rcpp method, and its start index is 0 to match vector indexing in C++.

Keywords
internal
Usage
ProbSampleReplace(prob)
Arguments
prob

Probability vector

Value

Value between 1 and n

Aliases
  • ProbSampleReplace
Examples
# NOT RUN {
p <- rep(0.2, 5)
ProbSampleReplace(p)
# }
Documentation reproduced from package SpatialEpi, version 1.2.3, License: GPL-2

Community examples

Looks like there are no examples yet.