Drawing from R Exponential Distribution in Octave

Description

This function wraps a call to the standard Octave function rande, which is redefined by RcppOctave to call the R base function rexp. 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_rexp(n, p = n)

Arguments

n
number of output rows
p
number of output columns (default to n)

Octave Documentation for <em>rande</em>

USAGE: E = rande( n [, k])

Generates standard-exponential random variatesas R function 'rexp' -- using the current RNG from R.

Possible calls:
rande(n, k)   returns n*k matrix with uncorrelated E(0, 1) deviates drawn in columns
rande(n)      returns n*n matrix with uncorrelated E(0, 1) deviates drawn in columns


NOTE:
This function substitutes Octave original function in calls from RcppOctave

[Generated from Octave-3.6.4 on 2014-05-21 11:08:20 ]

Examples


## Don't show: 
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## End Don't show

# Draw random exponential values (in vector form)
set.seed(123)
o_rexp(1)
## [1] 0.8435
o_rexp(1, 10)
##  [1] 0.57661 1.32905 0.03158 0.05621 0.31650 0.31423 0.14527 2.72624
##  [9] 0.02915 1.00483

# Draw random normal values (in matrix form)
set.seed(123)
o_rexp(2)
##        [,1]    [,2]
## [1,] 0.8435 1.32905
## [2,] 0.5766 0.03158
o_rexp(2, 5)
##         [,1]   [,2]    [,3]   [,4]   [,5]
## [1,] 0.05621 0.3142 2.72624 1.0048 0.2810
## [2,] 0.31650 0.1453 0.02915 0.4802 0.3771

See also

rexp Other orandom: o_rgamma, o_rnorm, o_runif