ProbSampleReplace: Draw a sample of size 1 given probabilities

Description Usage Arguments Value Author(s) Examples

View source: R/RcppExports.R

Description

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++.

Usage

1

Arguments

prob

Probability vector

Value

Value between 1 and n

Author(s)

Albert Y. Kim

Examples

1
2
p <- rep(0.2, 5)
ProbSampleReplace(p)

SpatialEpi documentation built on May 30, 2017, 5:23 a.m.