rv_mixture: rv_mixture

rv_mixtureR Documentation

rv_mixture

Description

rv_mixture distribution in OOP way.

Details

No fit allowed.

Active bindings

l_dist

[list] List of distributions.

n_dist

[integer] Numbers of distribution.

weights

[vector] Weights of the distributions.

Methods

Public methods


Method new()

Create a new rv_mixture object.

Usage
rv_mixture$new(l_dist, weights = NULL)
Arguments
l_dist

[list] List of ROOPSD distributions.

weights

[vector] Weights of the distributions. If NULL, 1 / length(l_dist) is used.

Returns

A new 'rv_mixture' object.


Method rvs()

Generation sample from the histogram

Usage
rv_mixture$rvs(n)
Arguments
n

[integer] Number of samples drawn

Returns

A vector of samples


Method density()

Density function

Usage
rv_mixture$density(x)
Arguments
x

[vector] Values to compute the density

Returns

density


Method logdensity()

Log density function

Usage
rv_mixture$logdensity(x)
Arguments
x

[vector] Values to compute the log-density

Returns

the log density


Method cdf()

Cumulative Distribution Function

Usage
rv_mixture$cdf(q)
Arguments
q

[vector] Quantiles to compute the CDF

Returns

cdf values


Method icdf()

Inverse of Cumulative Distribution Function

Usage
rv_mixture$icdf(p)
Arguments
p

[vector] Probabilities to compute the CDF

Returns

icdf values


Method sf()

Survival Function

Usage
rv_mixture$sf(q)
Arguments
q

[vector] Quantiles to compute the SF

Returns

sf values


Method isf()

Inverse of Survival Function

Usage
rv_mixture$isf(p)
Arguments
p

[vector] Probabilities to compute the SF

Returns

isf values


Method clone()

The objects of this class are cloneable with this method.

Usage
rv_mixture$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Define the mixture
l_dist  = list( Exponential$new() , Normal$new( mean = 5 , sd = 1 ) )
weights = base::c( 0.2 , 0.8 )
rvX = rv_mixture$new( l_dist , weights )

## Draw samples
X   = rvX$rvs( 1000 )


ROOPSD documentation built on Sept. 11, 2023, 9:06 a.m.

Related to rv_mixture in ROOPSD...