Learn R Programming

ROOPSD (version 0.3.9)

rv_histogram: rv_histogram

Description

rv_histogram distribution in OOP way.

Arguments

Public fields

min

[double] min value for the estimation

max

[double] max value for the estimation

tol

[double] numerical tolerance

Methods


Method new()

Create a new rv_histogram object.

Usage

rv_histogram$new(...)

Arguments

...

If a param `Y` is given, the fit method is called with `...`.

Returns

A new `rv_histogram` object.


Method rvs()

Generation sample from the histogram

Usage

rv_histogram$rvs(n)

Arguments

n

[integer] Number of samples drawn

Returns

A vector of samples


Method density()

Density function

Usage

rv_histogram$density(x)

Arguments

x

[vector] Values to compute the density

Returns

density


Method logdensity()

Log density function

Usage

rv_histogram$logdensity(x)

Arguments

x

[vector] Values to compute the log-density

Returns

the log density


Method cdf()

Cumulative Distribution Function

Usage

rv_histogram$cdf(q)

Arguments

q

[vector] Quantiles to compute the CDF

Returns

cdf values


Method icdf()

Inverse of Cumulative Distribution Function

Usage

rv_histogram$icdf(p)

Arguments

p

[vector] Probabilities to compute the CDF

Returns

icdf values


Method sf()

Survival Function

Usage

rv_histogram$sf(q)

Arguments

q

[vector] Quantiles to compute the SF

Returns

sf values


Method isf()

Inverse of Survival Function

Usage

rv_histogram$isf(p)

Arguments

p

[vector] Probabilities to compute the SF

Returns

isf values


Method fit()

Fit method for the histograms

Usage

rv_histogram$fit(Y, bins = as.integer(1000))

Arguments

Y

[vector] Dataset to infer the histogram

bins

[vector or integer] bins values

Returns

`self`


Method clone()

The objects of this class are cloneable with this method.

Usage

rv_histogram$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

Use quantile to fit the histogram

Examples

Run this code
## Generate sample
X = numeric(10000)
X[1:5000] = stats::rnorm( n = 5000 , mean = 2 , sd = 1 )
X[5000:10000] = stats::rexp( n = 5000 , rate = 1 )

## And fit it
rvX = rv_histogram$new()
rvX$fit(X)

Run the code above in your browser using DataLab