package ocaml-r

  1. Overview
  2. Docs

Access to the R math library.

Utilities

val pow : float -> float -> float

pow x y is the exponentiation of base x and power y.

val pow_di : float -> int -> float

pow x n is the exponentiation of base x and integer power n.

Random number generators

val norm_rand : unit -> float

Random variates from the standard normal distribution.

val unif_rand : unit -> float

Random variates from the uniform distribution, using * Marsaglia MultiCarry methodology for random number generation.

val exp_rand : unit -> float

Random variates from the standard exponential distribution.

Normal distribution

val dnorm : ?mean:float -> ?sd:float -> ?log:bool -> float -> float

dnorm ~mean:mu ~sd:sigma ~log:give_log x computes the density of the normal distribution.

  • parameter mean

    Mean of the normal distribution.

  • parameter sd

    Standard deviation of the normal distribution.

  • parameter log

    If true, returns the logarithm of the density.

val pnorm : ?mean:float -> ?sd:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qnorm : ?mean:float -> ?sd:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val rnorm : ?mean:float -> ?sd:float -> unit -> float

Uniform distribution

val dunif : ?min:float -> ?max:float -> ?log:bool -> float -> float
val punif : ?min:float -> ?max:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qunif : ?min:float -> ?max:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val runif : ?min:float -> ?max:float -> unit -> float

Gamma distribution

val dgamma : ?scale:float -> ?log:bool -> shape:float -> float -> float
val pgamma : ?scale:float -> ?lower_tail:bool -> ?logp:bool -> shape:float -> float -> float
val qgamma : ?scale:float -> ?lower_tail:bool -> ?logp:bool -> shape:float -> float -> float
val rgamma : ?scale:float -> float -> float
val logspace_add : float -> float -> float
val logspace_sub : float -> float -> float

Beta distribution

val dbeta : ?ncp:float -> ?log:bool -> a:float -> b:float -> float -> float
val pbeta : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> a:float -> b:float -> float -> float
val qbeta : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> a:float -> b:float -> float -> float
val rbeta : a:float -> b:float -> float

Lognormal distribution

val dlnorm : ?meanlog:float -> ?sdlog:float -> ?log:bool -> float -> float
val plnorm : ?meanlog:float -> ?sdlog:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qlnorm : ?meanlog:float -> ?sdlog:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val rlnorm : ?meanlog:float -> ?sdlog:float -> unit -> float

Chi-squared distribution

val dchisq : ?ncp:float -> ?log:bool -> df:float -> float -> float
val pchisq : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df:float -> float -> float
val qchisq : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df:float -> float -> float
val rchisq : ?ncp:float -> float -> float

F distribution

val df : ?ncp:float -> ?log:bool -> df1:float -> df2:float -> float -> float
val pf : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df1:float -> df2:float -> float -> float
val qf : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df1:float -> df2:float -> float -> float
val rf : df1:float -> df2:float -> float

Student t distribution

val dt : ?ncp:float -> ?log:bool -> df:float -> float -> float
val pt : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df:float -> float -> float
val qt : ?ncp:float -> ?lower_tail:bool -> ?logp:bool -> df:float -> float -> float
val rt : float -> float

Binomial distribution

val dbinom : ?log:bool -> size:float -> prob:float -> float -> float
val pbinom : ?lower_tail:bool -> ?logp:bool -> size:float -> prob:float -> float -> float
val qbinom : ?lower_tail:bool -> ?logp:bool -> size:float -> prob:float -> float -> float
val rbinom : size:float -> prob:float -> float

Cauchy distribution

val dcauchy : ?location:float -> ?scale:float -> ?log:bool -> float -> float
val pcauchy : ?location:float -> ?scale:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qcauchy : ?location:float -> ?scale:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val rcauchy : ?location:float -> ?scale:float -> unit -> float

Exponential distribution

val dexp : ?rate:float -> ?log:bool -> float -> float
val pexp : ?rate:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qexp : ?rate:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val rexp : ?rate:float -> unit -> float

Geometric distribution

val dgeom : ?log:bool -> prob:float -> float -> float
val pgeom : ?lower_tail:bool -> ?logp:bool -> prob:float -> float -> float
val qgeom : ?lower_tail:bool -> ?logp:bool -> prob:float -> float -> float
val rgeom : float -> float

Hypergeometric distribution

val dhyper : ?log:bool -> m:float -> n:float -> k:float -> float -> float
val phyper : ?lower_tail:bool -> ?logp:bool -> m:float -> n:float -> k:float -> float -> float
val qhyper : ?lower_tail:bool -> ?logp:bool -> m:float -> n:float -> k:float -> float -> float
val rhyper : m:float -> n:float -> k:float -> float

Negative binomial distribution

val dnbinom : ?log:bool -> size:float -> prob:float -> float -> float
val pnbinom : ?lower_tail:bool -> ?logp:bool -> size:float -> prob:float -> float -> float
val qnbinom : ?lower_tail:bool -> ?logp:bool -> size:float -> prob:float -> float -> float
val rnbinom : size:float -> prob:float -> float

Poisson distribution

val dpois : ?log:bool -> lambda:float -> float -> float
val ppois : ?lower_tail:bool -> ?logp:bool -> lambda:float -> float -> float
val qpois : ?lower_tail:bool -> ?logp:bool -> lambda:float -> float -> float
val rpois : float -> float

Weibull distribution

val dweibull : ?scale:float -> ?log:bool -> shape:float -> float -> float
val pweibull : ?scale:float -> ?lower_tail:bool -> ?logp:bool -> shape:float -> float -> float
val qweibull : ?scale:float -> ?lower_tail:bool -> ?logp:bool -> shape:float -> float -> float
val rweibull : ?scale:float -> float -> float

Logistic distribution

val dlogis : ?location:float -> ?scale:float -> ?log:bool -> float -> float
val plogis : ?location:float -> ?scale:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val qlogis : ?location:float -> ?scale:float -> ?lower_tail:bool -> ?logp:bool -> float -> float
val rlogis : ?location:float -> ?scale:float -> unit -> float

Studentized Range distribution

val ptukey : ?nranges:float -> ?lower_tail:bool -> ?logp:bool -> nmeans:float -> df:float -> float -> float
val qtukey : ?nranges:float -> ?lower_tail:bool -> ?logp:bool -> nmeans:float -> df:float -> float -> float

Wilcoxon Rank Sum distribution

val dwilcox : ?log:bool -> m:float -> n:float -> float -> float
val pwilcox : ?lower_tail:bool -> ?logp:bool -> m:float -> n:float -> float -> float
val qwilcox : ?lower_tail:bool -> ?logp:bool -> m:float -> n:float -> float -> float
val rwilcox : m:float -> n:float -> float

Wilcoxon Sign Rank distribution

val dsignrank : ?log:bool -> n:float -> float -> float
val psignrank : ?lower_tail:bool -> ?logp:bool -> n:float -> float -> float
val qsignrank : ?lower_tail:bool -> ?logp:bool -> n:float -> float -> float
val rsignrank : float -> float
val gammafn : float -> float
val lgammafn : float -> float
val psigamma : ?deriv:float -> float -> float
val digamma : float -> float
val trigamma : float -> float
val beta : a:float -> b:float -> float
val lbeta : a:float -> b:float -> float
val choose : n:float -> k:float -> float
val lchoose : n:float -> k:float -> float

Bessel functions

val bessel_i : ?expon_scaled:bool -> nu:float -> float -> float
val bessel_k : ?expon_scaled:bool -> nu:float -> float -> float
val bessel_j : x:float -> nu:float -> float
val bessel_y : x:float -> nu:float -> float

General support functions

val sign : float -> float
val ftrunc : float -> float
val fround : ?digits:int -> float -> float
val fsign : ?digits:int -> float -> float
val log1pmx : float -> float
val lgamma1p : float -> float
OCaml

Innovation. Community. Security.