AbstractDist: AbstractDist

AbstractDistR Documentation

AbstractDist

Description

Base class for OOP statistical distribution

Details

This class is only used to be herited

Public fields

ddist

[function] density function

pdist

[function] distribution function

qdist

[function] quantile function

rdist

[function] random generator function

ks.test

[ks.test] Goodness of fit with ks.test

fit_success

[bool] TRUE only if the fit is a success and is occurred

Active bindings

name

[string] name of the distribution

opt

[stats::optim result] Result of the MLE to find parameters

cov

[matrix] Covariance matrix of parameters, inverse of hessian

coef

[vector] Vector of coefficients

Methods

Public methods


Method new()

Create a new AbstractDist object.

Usage
AbstractDist$new(ddist, pdist, qdist, rdist, name, has_gr_nlll)
Arguments
ddist

[function] Density function, e.g. dnorm

pdist

[function] Distribution function, e.g. pnorm

qdist

[function] Quantile function, e.g. qnorm

rdist

[function] Random generator function, e.g. rnorm

name

[str] name of the distribution

has_gr_nlll

[bool] If the derived class has defined the gradient of the negative log-likelihood

Returns

A new 'AbstractDist' object.


Method rvs()

Generation sample from the histogram

Usage
AbstractDist$rvs(n)
Arguments
n

[integer] Number of samples drawn

Returns

[vector] A vector of samples


Method density()

Density function

Usage
AbstractDist$density(x)
Arguments
x

[vector] Values to compute the density

Returns

[vector] density


Method logdensity()

Log density function

Usage
AbstractDist$logdensity(x)
Arguments
x

[vector] Values to compute the log-density

Returns

[vector] log of density


Method cdf()

Cumulative Distribution Function

Usage
AbstractDist$cdf(q)
Arguments
q

[vector] Quantiles to compute the CDF

Returns

[vector] cdf values


Method sf()

Survival Function

Usage
AbstractDist$sf(q)
Arguments
q

[vector] Quantiles to compute the SF

Returns

[vector] sf values


Method icdf()

Inverse of Cumulative Distribution Function

Usage
AbstractDist$icdf(p)
Arguments
p

[vector] Probabilities to compute the CDF

Returns

[vector] icdf values


Method isf()

Inverse of Survival Function

Usage
AbstractDist$isf(p)
Arguments
p

[vector] Probabilities to compute the SF

Returns

[vector] isf values


Method fit()

Fit method

Usage
AbstractDist$fit(Y, n_max_try = 100)
Arguments
Y

[vector] Dataset to infer the histogram

n_max_try

[integer] Because the optim function can fails, the fit is retry n_try times.

Returns

'self'


Method qgradient()

Gradient of the quantile function

Usage
AbstractDist$qgradient(p, lower.tail = TRUE)
Arguments
p

[vector] Probabilities

lower.tail

[bool] If CDF or SF.

Returns

[vector] gradient


Method qdeltaCI()

Confidence interval of the quantile function

Usage
AbstractDist$qdeltaCI(p, Rt = FALSE, alpha = 0.05)
Arguments
p

[vector] Probabilities

Rt

[bool] if Probabilities or return times

alpha

[double] level of confidence interval

Returns

[list] Quantiles, and confidence interval


Method pdeltaCI()

Confidence interval of the CDF function

Usage
AbstractDist$pdeltaCI(x, Rt = FALSE, alpha = 0.05)
Arguments
x

[vector] Quantiles

Rt

[bool] if Probabilities or return times

alpha

[double] level of confidence interval

Returns

[list] CDF, and confidence interval


Method diagnostic()

Diagnostic of the fitted law

Usage
AbstractDist$diagnostic(Y, alpha = 0.05)
Arguments
Y

[vector] data to check

alpha

[double] level of confidence interval

Returns

[NULL]


Method clone()

The objects of this class are cloneable with this method.

Usage
AbstractDist$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


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

Related to AbstractDist in ROOPSD...