Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ProbSampleReplace

Draw a sample of size 1 given probabilities


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

ProbSampleReplace(prob)

Arguments

prob

Probability vector

Value

Value between 1 and n

Author(s)

Albert Y. Kim

Examples

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

SpatialEpi

Methods and Data for Spatial Epidemiology

v1.2.3
GPL-2
Authors
Cici Chen [ctb], Albert Y. Kim [aut, cre], Michelle Ross [ctb], Jon Wakefield [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.