rsample: Sample and integer for each row of a gmatrix object.

Description Usage Arguments Details Value Author(s) See Also

View source: R/03dist.R

Description

Sample an integer with the unormalized (log) probabilities specified for each row.

Usage

1

Arguments

P

A matrix conaining unormalizes (log) probabilities in each row.

log

Specifies if the input is on a log scale.

Details

Conceptually, each row is first normalized to sum to one, and then an integer is sampled for each row under the specified probablility.

Value

Returns a gvector with an integer value for each row.

Author(s)

Nathan Morris

See Also

gRowLogSums


gmatrix documentation built on May 29, 2017, 2:20 p.m.