| InverseGamma {boodist} | R Documentation |
Inverse Gamma distribution
Description
A R6 class to represent an inverse Gamma distribution.
Details
See Wikipedia.
Active bindings
alphaGet or set the value of
alpha.betaGet or set the value of
beta.
Methods
Public methods
Method new()
New inverse Gamma distribution.
Usage
InverseGamma$new(alpha, beta)
Arguments
alphashape parameter,
>0betascale parameter,
>0
Returns
An inverseGamma object.
Method d()
Density function of the inverse Gamma distribution.
Usage
InverseGamma$d(x, log = FALSE)
Arguments
xvector of positive numbers
logBoolean, whether to return the logarithm of the density
Returns
The density or the log-density evaluated at x.
Method p()
Cumulative distribution function of the inverse Gamma distribution.
Usage
InverseGamma$p(q, lower = TRUE)
Arguments
qnumeric vector of quantiles
lowerBoolean, whether to deal with the lower tail
Returns
The cumulative probabilities corresponding to q.
Method q()
Quantile function of the inverse Gamma distribution.
Usage
InverseGamma$q(p, lower = TRUE)
Arguments
pnumeric vector of probabilities
lowerBoolean, whether to deal with the lower tail
Returns
The quantiles corresponding to p.
Method r()
Sampling from the inverse Gamma distribution.
Usage
InverseGamma$r(n)
Arguments
nnumber of simulations
Returns
A numeric vector of length n.
Method mean()
Mean of the inverse Gamma distribution.
Usage
InverseGamma$mean()
Returns
The mean of the inverse Gamma distribution.
Method median()
Median of the inverse Gamma distribution.
Usage
InverseGamma$median()
Returns
The median of the inverse Gamma distribution.
Method mode()
Mode of the inverse Gamma distribution.
Usage
InverseGamma$mode()
Returns
The mode of the inverse Gamma distribution.
Method sd()
Standard deviation of the inverse Gamma distribution.
Usage
InverseGamma$sd()
Returns
The standard deviation of the inverse Gamma distribution.
Method variance()
Variance of the inverse Gamma distribution.
Usage
InverseGamma$variance()
Returns
The variance of the inverse Gamma distribution.
Method skewness()
Skewness of the inverse Gamma distribution.
Usage
InverseGamma$skewness()
Returns
The skewness of the inverse Gamma distribution.
Method kurtosis()
Kurtosis of the inverse Gamma distribution.
Usage
InverseGamma$kurtosis()
Returns
The kurtosis of the inverse Gamma distribution.
Method kurtosisExcess()
Kurtosis excess of the inverse Gamma distribution.
Usage
InverseGamma$kurtosisExcess()
Returns
The kurtosis excess of the inverse Gamma distribution.
Method clone()
The objects of this class are cloneable with this method.
Usage
InverseGamma$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
if(require("plotly")) {
x_ <- seq(0, 2, length.out = 100L)
alpha_ <- seq(0.5, 2.5, length.out = 100L)
dsty <- vapply(alpha_, function(alpha) {
InverseGamma$new(alpha, beta = 1)$d(x_)
}, numeric(length(x_)))
#
txt <- matrix(NA_character_, nrow = length(x_), ncol = length(alpha_))
for(i in 1L:nrow(txt)) {
for(j in 1L:ncol(txt)) {
txt[i, j] <- paste0(
"x: ", formatC(x_[i]),
"<br> alpha: ", formatC(alpha_[j]),
"<br> density: ", formatC(dsty[i, j])
)
}
}
#
plot_ly(
x = ~alpha_, y = ~x_, z = ~dsty, type = "surface",
text = txt, hoverinfo = "text", showscale = FALSE
) %>% layout(
title = "Inverse Gamma distribution",
margin = list(t = 40, r= 5, b = 5, l = 5),
scene = list(
xaxis = list(
title = "alpha"
),
yaxis = list(
title = "x"
),
zaxis = list(
title = "density"
)
)
)
}