Learn R Programming

RcppOctave (version 0.18.1)

o_rpois: Drawing from R Poisson Distribution in Octave

Description

This function wraps a call to the standard Octave function randp, which is redefined by RcppOctave to call the R base function rpois. This enables to exactly reproduce stochastic computations in R and Octave, without changing the original Octave/Matlab code. See o_runif for more details.

Usage

o_rpois(n, p = n, lambda)

Arguments

n
number of output rows
p
number of output columns (default to n)
lambda
Mean of the Poisson distribution

Octave Documentation for <em>randp</em>

[results=rd,stage=render]{if( .Platform$OS.type != 'windows' || .Platform$r_arch != 'x64' ) RcppOctave::o_help(randp, format='rd')}

[Generated from Octave-RcppOctave::o_version() on Sys.time()]

# roxygen generated flag options(R_CHECK_RUNNING_EXAMPLES_=TRUE)

# Draw random poisson values (in vector form) set.seed(123) o_rpois(1, lambda = 4) o_rpois(1, 10, 4)

# Draw random poisson values (in matrix form) set.seed(123) o_rpois(2, lambda = 4) o_rpois(2, 5, lambda = 4)

rpois

Other orandom: o_rexp; o_rgamma; o_rnorm; o_runif

Details

This function calls the Octave function randp as provided by RcppOctave, which returns the draws as double. The result is converted into integer to match the behaviour of rpois