Package 'distrRmetrics'

Title: Distribution Classes for Distributions from Rmetrics
Description: S4-distribution classes based on package distr for distributions from packages 'fBasics' and 'fGarch'.
Authors: Peter Ruckdeschel [cre, cph, aut]
Maintainer: Peter Ruckdeschel <[email protected]>
License: LGPL-3
Version: 2.8.2
Built: 2024-11-06 02:16:29 UTC
Source: https://github.com/r-forge/distr

Help Index


distrRmetrics – Distribution Classes for Distributions from Rmetrics.

Description

distrRmetrics provides infrastructure / (S4-)classes (based on package distr) for distributions contributed in the Rmetrics packages.

Details

Package: distrRmetrics
Version: 2.8.2
Date: 2024-01-30
Depends: R(>= 3.4), methods, distr(>= 2.4), fBasics(>= 270.73), fGarch(>= 270.73)
Suggests: distrEx(>= 2.4), distrMod(>= 2.4)
Imports: startupmsg
ByteCompile: yes
License: LGPL-3
URL: https://distr.r-forge.r-project.org/
VCS/SVNRevision: 1427

Classes

###################################
Distribution Classes
###################################
[*]: there is a generating function with the same name
"Distribution" (from distr)
|>"AbscontDistribution" (from distr)
|>|>"SNorm" [*]
|>|>"SSTd" [*]

Functions

STd    Functions to generate an "AbscontDistribution" object implementing
       a standardized T distribution

Slot accessors / -replacement functions

All slots are inspected / modified by corresponding accessors / -replacement functions.

Start-up-Banner

You may suppress the start-up banner/message completely by setting options("StartupBanner"="off") somewhere before loading this package by library or require in your R-code / R-session. If option "StartupBanner" is not defined (default) or setting options("StartupBanner"=NULL) or options("StartupBanner"="complete") the complete start-up banner is displayed. For any other value of option "StartupBanner" (i.e., not in c(NULL,"off","complete")) only the version information is displayed. The same can be achieved by wrapping the library or require call into either suppressStartupMessages() or onlytypeStartupMessages(.,atypes="version"). As for general packageStartupMessage's, you may also suppress all the start-up banner by wrapping the library or require call into suppressPackageStartupMessages() from startupmsg-version 0.5 on.

Package versions

Note: The first two numbers of package versions do not necessarily reflect package-individual development, but rather are chosen for the distrXXX family as a whole in order to ease updating "depends" information.

Author(s)

Peter Ruckdeschel [email protected],
Maintainer: Peter Ruckdeschel [email protected]

References

P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): S4 Classes for Distributions, R News, 6(2), 2-6. https://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf A vignette for packages distr, distrSim, distrTEst, distrEx, distrTeach, distrMod, and distrRmetrics is included into the mere documentation package distrDoc and may be called by require("distrDoc");vignette("distr"). A homepage to this package is available under
https://distr.r-forge.r-project.org/.


Generating function for skewed normal class

Description

Generates an object of class "SNorm".

Usage

SNorm(mean = 0, sd = 1, xi = 1.5)

Arguments

mean

real number: location parameter of the SNorm distribution.

sd

positive real number: scale parameter of the SNorm distribution

xi

positive real number: shape parameter of the SSTd distribution.

Value

Object of class "SNorm"

Note

This class is based on the code provided by the package fGarch by Diethelm Wuertz

Author(s)

Peter Ruckdeschel [email protected]

See Also

dsnorm, AbscontDistribution-class

Examples

(SN <- SNorm(mean = 1, sd = 1, xi = 0.5))
plot(SN)

SNorm distribution

Description

The skew normal distribution.

Objects from the Class

Objects can be created by calls of the form new("SNorm", mean, sd,xi). More frequently they are created via the generating function SNorm.

Slots

img

Object of class "Reals".

param

Object of class "SNormParameter".

r

rgpd

d

dgpd

p

pgpd, but vectorized and with special treatment of arguments lower.tail and log.p

q

qgpd, but vectorized and with special treatment of arguments lower.tail and log.p

gaps

(numeric) matrix or NULL

.withArith

logical: used internally to issue warnings as to interpretation of arithmetics

.withSim

logical: used internally to issue warnings as to accuracy

.logExact

logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function

.lowerExact

logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function

Extends

Class "AbscontDistribution", directly.
Class "UnivariateDistribution", by class "AbscontDistribution".
Class "Distribution", by class "AbscontDistribution".

Methods

xi

signature(object = "SNorm"): wrapped access method for slot xi of slot param.

mean

signature(object = "SNorm"): wrapped access method for slot mean of slot param.

nu

signature(object = "SNorm"): wrapped access method for slot nu of slot param.

sd

signature(x = "SNorm"): wrapped access method for slot sd of slot param.

xi<-

signature(object = "SNorm"): wrapped replace method for slot xi of slot param.

mean<-

signature(object = "SNorm"): wrapped replace method for slot mean of slot param.

nu<-

signature(object = "SNorm"): wrapped replace method for slot nu of slot param.

sd<-

signature(x = "SNorm"): wrapped replace method for slot sd of slot param.

Note

This class is based on the code provided by the package fGarch by Diethelm Wuertz

Author(s)

Peter Ruckdeschel [email protected]

See Also

dsnorm, AbscontDistribution-class

Examples

(SN <- SNorm(xi=2)) # SN is a skewed normal distribution with nu = 3.
set.seed(1)
r(SN)(1) # one random number generated from this distribution, e.g. -0.4037723
d(SN)(1) # Density of this distribution is  0.1914826 for x = 1.
p(SN)(1) # Probability that x < 1 is 0.8374454.
q(SN)(.1) # Probability that x < -1.137878 is 0.1.
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
xi(SN) # shape of this distribution is 2.
xi(SN) <- 2.5 # shape of this distribution is now 2.5.
plot(SN)

Parameter of an SNorm distributions

Description

The class of the parameter of an SNorm distribution.

Objects from the Class

Objects can be created by calls of the form new("SNormParameter", ...).

Slots

mean

real number: location parameter of a SNorm distribution.

sd

real number: scale parameter of a SNorm distribution.

name

default name is “parameter of a SNorm distribution”.

xi

real number: shape parameter of a SNorm distribution.

Extends

Class "Parameter", directly.
Class "OptionalParameter", by class "Parameter".

Methods

mean

signature(object = "SNormParameter"): access method for slot mean.

sd

signature(object = "SNormParameter"): access method for slot sd.

xi

signature(object = "SNormParameter"): access method for slot xi.

Author(s)

Peter Ruckdeschel [email protected]

See Also

SNorm-class, Parameter-class

Examples

P <- new("SNormParameter")
mean(P)
sd(P)
xi(P)
P

Generating function for SSTd-class

Description

Generates an object of class "SSTd".

Usage

SSTd(mean = 0, sd = 1, nu = 5, xi = 1.5)

Arguments

mean

real number: location parameter of the SSTd distribution.

sd

positive real number: scale parameter of the SSTd distribution

xi

positive real number: shape parameter of the SSTd distribution.

nu

real number larger than 2: degree of freedom parameter of the SSTd distribution.

Value

Object of class "SSTd"

Note

This class is based on the code provided by the package fGarch by Diethelm Wuertz

Author(s)

Peter Ruckdeschel [email protected]

See Also

dsstd, AbscontDistribution-class

Examples

(ST <- SSTd(mean = 1, sd = 1, xi = 0.5))
plot(ST)

SSTd distribution

Description

The standardized skew Student-t distribution.

Objects from the Class

Objects can be created by calls of the form new("SSTd", mean, sd,xi). More frequently they are created via the generating function SSTd.

Slots

img

Object of class "Reals".

param

Object of class "SSTdParameter".

r

rgpd

d

dgpd

p

pgpd, but vectorized and with special treatment of arguments lower.tail and log.p

q

qgpd, but vectorized and with special treatment of arguments lower.tail and log.p

gaps

(numeric) matrix or NULL

.withArith

logical: used internally to issue warnings as to interpretation of arithmetics

.withSim

logical: used internally to issue warnings as to accuracy

.logExact

logical: used internally to flag the case where there are explicit formulae for the log version of density, cdf, and quantile function

.lowerExact

logical: used internally to flag the case where there are explicit formulae for the lower tail version of cdf and quantile function

Extends

Class "AbscontDistribution", directly.
Class "UnivariateDistribution", by class "AbscontDistribution".
Class "Distribution", by class "AbscontDistribution".

Methods

xi

signature(object = "SSTd"): wrapped access method for slot xi of slot param.

mean

signature(object = "SSTd"): wrapped access method for slot mean of slot param.

nu

signature(object = "SSTd"): wrapped access method for slot nu of slot param.

sd

signature(x = "SSTd"): wrapped access method for slot sd of slot param.

xi<-

signature(object = "SSTd"): wrapped replace method for slot xi of slot param.

mean<-

signature(object = "SSTd"): wrapped replace method for slot mean of slot param.

nu<-

signature(object = "SSTd"): wrapped replace method for slot nu of slot param.

sd<-

signature(x = "SSTd"): wrapped replace method for slot sd of slot param.

Note

This class is based on the code provided by the package fGarch by Diethelm Wuertz

Author(s)

Peter Ruckdeschel [email protected]

See Also

dsstd, AbscontDistribution-class

Examples

(ST <- SSTd(xi=2, nu = 3)) # ST is a skewed t distribution with xi = 2 and nu = 3.
set.seed(1)
r(ST)(1) # one random number generated from this distribution, e.g. -0.4432824
d(ST)(1) # Density of this distribution is 0.1204624 for x = 1.
p(ST)(1) # Probability that x < 1 is 0.9035449.
q(ST)(.1) # Probability that x < -0.4432824 is 0.1.
## in RStudio or Jupyter IRKernel, use q.l(.)(.) instead of q(.)(.)
nu(ST) # df of this distribution is 3.
nu(ST) <- 4 # df of this distribution is now 4.
plot(ST)

Parameter of an SSTd distributions

Description

The class of the parameter of an SSTd distribution.

Objects from the Class

Objects can be created by calls of the form new("SSTdParameter", ...).

Slots

mean

real number: location parameter of a SSTd distribution.

sd

real number: scale parameter of a SSTd distribution.

xi

real number: shape parameter of a SSTd distribution.

nu

positive number: the degree of freedom parameter of a SSTd distribution.

name

default name is “parameter of a SSTd distribution”.

Extends

Class "Parameter", directly.
Class "OptionalParameter", by class "Parameter".

Methods

mean

signature(object = "SSTdParameter"): access method for slot mean.

sd

signature(object = "SSTdParameter"): access method for slot sd.

xi

signature(object = "SSTdParameter"): access method for slot xi.

nu

signature(object = "SSTdParameter"): access method for slot nu.

Author(s)

Peter Ruckdeschel [email protected]

See Also

SSTd-class, Parameter-class

Examples

P <- new("SSTdParameter")
mean(P)
sd(P)
xi(P)
nu(P)
P

Generating function for standardized T distribution class

Description

Generates a scaled object of class "Td"; the scale (sd) is chosen such that STd(nu=3, sd=1) has variance 1 independently from the degrees of freedom nu. This object is of class "AffLinAbscontDistribution".

Usage

STd(mean = 0, sd = 1, nu = 5)

Arguments

mean

real number: location parameter of the STd distribution.

sd

positive real number: scale parameter of the STd distribution

nu

real number larger than 2: degree of freedom parameter of the STd distribution.

Value

Object of class "STd"

Note

This class is based on the code provided by the package fGarch by Diethelm Wuertz

Author(s)

Peter Ruckdeschel [email protected]

See Also

dstd, AbscontDistribution-class

Examples

(ST <- STd(mean = 1, sd = 1, nu = 3))
plot(ST)