Learn R Programming

simcausal (version 0.5.7)

rcategor.int: Random Sample from Base 1 (rcat.b1) or Base 0 (rcat.b0) Categorical (Integer) Distribution

Description

Same as , but returning a vector of sampled integers with range 1, 2, ..., ncol(probs)+1 for rcat.b1 or range 0, 1, ..., ncol(probs) for rcat.b0. For sampling categorical factors see rcat.factor.

Usage

rcategor.int(n, probs)

rcat.b1(n, probs)

rcat.b0(n, probs)

Value

An integer vector of length n with range either in 0,...,ncol(probs) or in 1,...,ncol(probs)+1.

Arguments

n

Sample size.

probs

Either a vector or a matrix of success probabilities. When probs is a vector, n identically distributed random categorical variables are generated. When probs is a matrix, the categorical probabilities of the kth sample are determined by the kth row of probs matrix, i.e., probs[k,].

Functions

  • rcategor.int(): (Deperecated) Random Sample from Base 1 Categorical (Integer) Distribution

  • rcat.b1(): Random Sample from Base 1 Categorical (Integer) Distribution

  • rcat.b0(): Random Sample from Base 0 Categorical (Integer) Distribution

See Also

rcat.factor