Title: | Parameter Estimation |
Version: | 0.8.5 |
Description: | Implements estimation methods for parameters of common distribution families. The common d, p, q, r function family for each distribution is enriched with the ll, e, and v counterparts, computing the log-likelihood, performing estimation, and calculating the asymptotic variance - covariance matrix, respectively. Parameter estimation is performed analytically whenever possible. |
License: | GPL (≥ 3) |
URL: | https://thechibo.github.io/estimators/ |
BugReports: | https://github.com/thechibo/estimators/issues |
Depends: | R (≥ 4.0.0) |
Imports: | extraDistr, ggh4x, ggplot2, grDevices, Matrix, methods, progress, stats, utils |
Suggests: | covr, knitr, rmarkdown, testthat (≥ 3.0.0) |
VignetteBuilder: | knitr |
Config/testthat/edition: | 3 |
Encoding: | UTF-8 |
Language: | en-US |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Packaged: | 2024-05-08 13:59:18 UTC; Chibo |
Author: | Ioannis Oikonomidis
|
Maintainer: | Ioannis Oikonomidis <goikon@math.uoa.gr> |
Repository: | CRAN |
Date/Publication: | 2024-05-16 15:00:10 UTC |
estimators: Parameter Estimation
Description
Implements estimation methods for parameters of common distribution families. The common d, p, q, r function family for each distribution is enriched with the ll, e, and v counterparts, computing the log-likelihood, performing estimation, and calculating the asymptotic variance - covariance matrix, respectively. Parameter estimation is performed analytically whenever possible.
Author(s)
Maintainer: Ioannis Oikonomidis goikon@math.uoa.gr (ORCID)
Authors:
Samis Trevezas strevezas@math.uoa.gr (ORCID) [thesis advisor]
See Also
Useful links:
Bernoulli Distribution
Description
Bernoulli Distribution
Usage
Bern(prob = 0.5)
## S4 method for signature 'Bern'
d(x)
## S4 method for signature 'Bern'
p(x)
## S4 method for signature 'Bern'
qn(x)
## S4 method for signature 'Bern'
r(x)
## S4 method for signature 'Bern'
mean(x)
## S4 method for signature 'Bern'
median(x)
## S4 method for signature 'Bern'
mode(x)
## S4 method for signature 'Bern'
var(x)
## S4 method for signature 'Bern'
sd(x)
## S4 method for signature 'Bern'
skew(x)
## S4 method for signature 'Bern'
kurt(x)
## S4 method for signature 'Bern'
entro(x)
## S4 method for signature 'Bern'
finf(x)
## S4 method for signature 'numeric,numeric,Bern'
ll(x, prm, distr)
## S4 method for signature 'numeric,Bern'
mle(x, distr)
## S4 method for signature 'numeric,Bern'
me(x, distr)
## S4 method for signature 'Bern'
avar_mle(distr)
## S4 method for signature 'Bern'
avar_me(distr)
Arguments
x |
an object of class |
prm , prob |
numeric. The distribution parameter. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
See Also
Beta Distribution
Description
Beta Distribution
Usage
Beta(shape1 = 1, shape2 = 1, ncp = 0)
## S4 method for signature 'Beta'
d(x)
## S4 method for signature 'Beta'
p(x)
## S4 method for signature 'Beta'
qn(x)
## S4 method for signature 'Beta'
r(x)
## S4 method for signature 'Beta'
mean(x)
## S4 method for signature 'Beta'
median(x)
## S4 method for signature 'Beta'
mode(x)
## S4 method for signature 'Beta'
var(x)
## S4 method for signature 'Beta'
sd(x)
## S4 method for signature 'Beta'
skew(x)
## S4 method for signature 'Beta'
kurt(x)
## S4 method for signature 'Beta'
entro(x)
## S4 method for signature 'Beta'
finf(x)
llbeta(x, shape1, shape2)
## S4 method for signature 'numeric,numeric,Beta'
ll(x, prm, distr)
## S4 method for signature 'numeric,Beta'
mle(x, distr, par0 = "same", method = "L-BFGS-B", lower = 1e-05, upper = Inf)
## S4 method for signature 'numeric,Beta'
me(x, distr)
## S4 method for signature 'numeric,Beta'
same(x, distr)
vbeta(shape1, shape2, type = "mle")
## S4 method for signature 'Beta'
avar_mle(distr)
## S4 method for signature 'Beta'
avar_me(distr)
## S4 method for signature 'Beta'
avar_same(distr)
Arguments
shape1 , shape2 , ncp |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
par0 , method , lower , upper |
arguments passed to optim. |
type |
character, case ignored. The estimator type (mle, me, or same). |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Binomial Distribution
Description
Binomial Distribution
Usage
Binom(size = 1, prob = 0.5)
## S4 method for signature 'Binom'
d(x)
## S4 method for signature 'Binom'
p(x)
## S4 method for signature 'Binom'
qn(x)
## S4 method for signature 'Binom'
r(x)
## S4 method for signature 'Binom'
mean(x)
## S4 method for signature 'Binom'
var(x)
## S4 method for signature 'Binom'
sd(x)
## S4 method for signature 'Binom'
skew(x)
## S4 method for signature 'Binom'
kurt(x)
## S4 method for signature 'Binom'
finf(x)
## S4 method for signature 'numeric,numeric,Binom'
ll(x, prm, distr)
## S4 method for signature 'numeric,Binom'
mle(x, distr)
## S4 method for signature 'numeric,Binom'
me(x, distr)
## S4 method for signature 'Binom'
avar_mle(distr)
## S4 method for signature 'Binom'
avar_me(distr)
Arguments
size , prob |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Categorical Distribution
Description
Categorical Distribution
Usage
Cat(prob = c(0.5, 0.5))
## S4 method for signature 'Cat'
d(x)
## S4 method for signature 'Cat'
r(x)
## S4 method for signature 'Cat'
mean(x)
## S4 method for signature 'Cat'
var(x)
## S4 method for signature 'Cat'
finf(x)
## S4 method for signature 'numeric,numeric,Cat'
ll(x, prm, distr)
## S4 method for signature 'numeric,Cat'
mle(x, distr)
## S4 method for signature 'numeric,Cat'
me(x, distr)
## S4 method for signature 'Cat'
avar_mle(distr)
## S4 method for signature 'Cat'
avar_me(distr)
Arguments
prob |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Cauchy Distribution
Description
Cauchy Distribution
Usage
Cauchy(location = 1, scale = 1)
## S4 method for signature 'Cauchy'
d(x)
## S4 method for signature 'Cauchy'
p(x)
## S4 method for signature 'Cauchy'
qn(x)
## S4 method for signature 'Cauchy'
r(x)
## S4 method for signature 'Cauchy'
median(x)
## S4 method for signature 'Cauchy'
mode(x)
## S4 method for signature 'Cauchy'
entro(x)
## S4 method for signature 'Cauchy'
finf(x)
## S4 method for signature 'numeric,numeric,Cauchy'
ll(x, prm, distr)
Arguments
location , scale |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Chi-Square Distribution
Description
Chi-Square Distribution
Usage
Chisq(df = 1, ncp = 0)
## S4 method for signature 'Chisq'
d(x)
## S4 method for signature 'Chisq'
p(x)
## S4 method for signature 'Chisq'
qn(x)
## S4 method for signature 'Chisq'
r(x)
## S4 method for signature 'Chisq'
mean(x)
## S4 method for signature 'Chisq'
var(x)
## S4 method for signature 'Chisq'
sd(x)
## S4 method for signature 'Chisq'
skew(x)
## S4 method for signature 'Chisq'
kurt(x)
Arguments
df , ncp |
numeric. The distribution parameters. |
x |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Dirichlet Distribution
Description
Dirichlet Distribution
Usage
Dir(alpha = c(1, 1))
## S4 method for signature 'Dir'
d(x)
## S4 method for signature 'Dir'
r(x)
## S4 method for signature 'Dir'
mean(x)
## S4 method for signature 'Dir'
mode(x)
## S4 method for signature 'Dir'
var(x)
## S4 method for signature 'Dir'
entro(x)
## S4 method for signature 'Dir'
finf(x)
## S4 method for signature 'matrix,numeric,Dir'
ll(x, prm, distr)
## S4 method for signature 'matrix,Dir'
mle(x, distr, par0 = "same", method = "L-BFGS-B", lower = 1e-05, upper = Inf)
## S4 method for signature 'matrix,Dir'
me(x, distr)
## S4 method for signature 'matrix,Dir'
same(x, distr)
## S4 method for signature 'Dir'
avar_mle(distr)
## S4 method for signature 'Dir'
avar_me(distr)
## S4 method for signature 'Dir'
avar_same(distr)
Arguments
alpha |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
par0 , method , lower , upper |
arguments passed to optim. |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Distribution S4 Classes
Description
A collection of classes that provide a flexible and structured way to work with probability distributions.
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Exponential Distribution
Description
Exponential Distribution
Usage
Exp(rate = 1)
## S4 method for signature 'Exp'
d(x)
## S4 method for signature 'Exp'
p(x)
## S4 method for signature 'Exp'
qn(x)
## S4 method for signature 'Exp'
r(x)
## S4 method for signature 'Exp'
mean(x)
## S4 method for signature 'Exp'
median(x)
## S4 method for signature 'Exp'
mode(x)
## S4 method for signature 'Exp'
var(x)
## S4 method for signature 'Exp'
sd(x)
## S4 method for signature 'Exp'
skew(x)
## S4 method for signature 'Exp'
kurt(x)
## S4 method for signature 'Exp'
entro(x)
## S4 method for signature 'Exp'
finf(x)
## S4 method for signature 'numeric,numeric,Exp'
ll(x, prm, distr)
## S4 method for signature 'numeric,Exp'
mle(x, distr)
## S4 method for signature 'numeric,Exp'
me(x, distr)
## S4 method for signature 'Exp'
avar_mle(distr)
## S4 method for signature 'Exp'
avar_me(distr)
Arguments
rate |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Fisher Distribution
Description
Fisher Distribution
Usage
Fisher(df1 = 1, df2 = 1, ncp = 0)
## S4 method for signature 'Fisher'
d(x)
## S4 method for signature 'Fisher'
p(x)
## S4 method for signature 'Fisher'
qn(x)
## S4 method for signature 'Fisher'
r(x)
## S4 method for signature 'Fisher'
mean(x)
## S4 method for signature 'Fisher'
mode(x)
## S4 method for signature 'Fisher'
var(x)
## S4 method for signature 'Fisher'
sd(x)
## S4 method for signature 'Fisher'
skew(x)
Arguments
df1 , df2 , ncp |
numeric. The distribution parameters. |
x |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Gamma Distribution
Description
Gamma Distribution
Usage
Gam(shape = 1, scale = 1)
## S4 method for signature 'Gam'
d(x)
## S4 method for signature 'Gam'
p(x)
## S4 method for signature 'Gam'
qn(x)
## S4 method for signature 'Gam'
r(x)
## S4 method for signature 'Gam'
mean(x)
## S4 method for signature 'Gam'
var(x)
## S4 method for signature 'Gam'
sd(x)
## S4 method for signature 'Gam'
skew(x)
## S4 method for signature 'Gam'
kurt(x)
## S4 method for signature 'Gam'
entro(x)
## S4 method for signature 'Gam'
finf(x)
## S4 method for signature 'numeric,numeric,Gam'
ll(x, prm, distr)
## S4 method for signature 'numeric,Gam'
mle(x, distr, par0 = "same", method = "L-BFGS-B", lower = 1e-05, upper = Inf)
## S4 method for signature 'numeric,Gam'
me(x, distr)
## S4 method for signature 'numeric,Gam'
same(x, distr)
## S4 method for signature 'Gam'
avar_mle(distr)
## S4 method for signature 'Gam'
avar_me(distr)
## S4 method for signature 'Gam'
avar_same(distr)
Arguments
shape , scale |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
par0 , method , lower , upper |
arguments passed to optim. |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Geometric Distribution
Description
Geometric Distribution
Usage
Geom(prob = 0.5)
## S4 method for signature 'Geom'
d(x)
## S4 method for signature 'Geom'
p(x)
## S4 method for signature 'Geom'
qn(x)
## S4 method for signature 'Geom'
r(x)
## S4 method for signature 'Geom'
mean(x)
## S4 method for signature 'Geom'
mode(x)
## S4 method for signature 'Geom'
var(x)
## S4 method for signature 'Geom'
sd(x)
## S4 method for signature 'Geom'
skew(x)
## S4 method for signature 'Geom'
kurt(x)
## S4 method for signature 'Geom'
entro(x)
## S4 method for signature 'Geom'
finf(x)
## S4 method for signature 'numeric,numeric,Geom'
ll(x, prm, distr)
## S4 method for signature 'numeric,Geom'
mle(x, distr)
## S4 method for signature 'numeric,Geom'
me(x, distr)
## S4 method for signature 'Geom'
avar_mle(distr)
## S4 method for signature 'Geom'
avar_me(distr)
Arguments
prob |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Laplace Distribution
Description
Laplace Distribution
Usage
Laplace(mu = 0, sigma = 1)
## S4 method for signature 'Laplace'
d(x)
## S4 method for signature 'Laplace'
p(x)
## S4 method for signature 'Laplace'
qn(x)
## S4 method for signature 'Laplace'
r(x)
## S4 method for signature 'Laplace'
mean(x)
## S4 method for signature 'Laplace'
median(x)
## S4 method for signature 'Laplace'
mode(x)
## S4 method for signature 'Laplace'
var(x)
## S4 method for signature 'Laplace'
sd(x)
## S4 method for signature 'Laplace'
skew(x)
## S4 method for signature 'Laplace'
kurt(x)
## S4 method for signature 'Laplace'
entro(x)
## S4 method for signature 'Laplace'
finf(x)
## S4 method for signature 'numeric,numeric,Laplace'
ll(x, prm, distr)
## S4 method for signature 'numeric,Laplace'
mle(x, distr)
## S4 method for signature 'numeric,Laplace'
me(x, distr)
## S4 method for signature 'Laplace'
avar_mle(distr)
## S4 method for signature 'Laplace'
avar_me(distr)
Arguments
mu , sigma |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Lnorm Distribution
Description
Lnorm Distribution
Usage
Lnorm(meanlog = 0, sdlog = 1)
## S4 method for signature 'Lnorm'
d(x)
## S4 method for signature 'Lnorm'
p(x)
## S4 method for signature 'Lnorm'
qn(x)
## S4 method for signature 'Lnorm'
r(x)
## S4 method for signature 'Lnorm'
mean(x)
## S4 method for signature 'Lnorm'
median(x)
## S4 method for signature 'Lnorm'
mode(x)
## S4 method for signature 'Lnorm'
var(x)
## S4 method for signature 'Lnorm'
sd(x)
## S4 method for signature 'Lnorm'
skew(x)
## S4 method for signature 'Lnorm'
kurt(x)
## S4 method for signature 'Lnorm'
entro(x)
## S4 method for signature 'Lnorm'
finf(x)
## S4 method for signature 'numeric,numeric,Lnorm'
ll(x, prm, distr)
## S4 method for signature 'numeric,Lnorm'
mle(x, distr)
## S4 method for signature 'numeric,Lnorm'
me(x, distr)
## S4 method for signature 'Lnorm'
avar_mle(distr)
## S4 method for signature 'Lnorm'
avar_me(distr)
Arguments
meanlog , sdlog |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Multinomial Distribution
Description
Multinomial Distribution
Usage
Multinom(size = 1, prob = c(0.5, 0.5))
## S4 method for signature 'Multinom'
d(x)
## S4 method for signature 'Multinom'
r(x)
## S4 method for signature 'Multinom'
mean(x)
## S4 method for signature 'Multinom'
var(x)
## S4 method for signature 'Multinom'
finf(x)
## S4 method for signature 'matrix,numeric,Multinom'
ll(x, prm, distr)
## S4 method for signature 'matrix,Multinom'
mle(x, distr)
## S4 method for signature 'matrix,Multinom'
me(x, distr)
## S4 method for signature 'Multinom'
avar_mle(distr)
## S4 method for signature 'Multinom'
avar_me(distr)
Arguments
size , prob |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Negative Binomial Distribution
Description
Negative Binomial Distribution
Usage
Nbinom(size = 1, prob = 0.5)
## S4 method for signature 'Nbinom'
d(x)
## S4 method for signature 'Nbinom'
p(x)
## S4 method for signature 'Nbinom'
qn(x)
## S4 method for signature 'Nbinom'
r(x)
## S4 method for signature 'Nbinom'
mean(x)
## S4 method for signature 'Nbinom'
mode(x)
## S4 method for signature 'Nbinom'
var(x)
## S4 method for signature 'Nbinom'
sd(x)
## S4 method for signature 'Nbinom'
skew(x)
## S4 method for signature 'Nbinom'
kurt(x)
## S4 method for signature 'Nbinom'
finf(x)
## S4 method for signature 'numeric,numeric,Nbinom'
ll(x, prm, distr)
## S4 method for signature 'numeric,Nbinom'
mle(x, distr)
## S4 method for signature 'numeric,Nbinom'
me(x, distr)
## S4 method for signature 'Nbinom'
avar_mle(distr)
## S4 method for signature 'Nbinom'
avar_me(distr)
Arguments
size , prob |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Normal Distribution
Description
Normal Distribution
Usage
Norm(mean = 0, sd = 1)
## S4 method for signature 'Norm'
d(x)
## S4 method for signature 'Norm'
p(x)
## S4 method for signature 'Norm'
qn(x)
## S4 method for signature 'Norm'
r(x)
## S4 method for signature 'Norm'
mean(x)
## S4 method for signature 'Norm'
median(x)
## S4 method for signature 'Norm'
mode(x)
## S4 method for signature 'Norm'
var(x)
## S4 method for signature 'Norm'
sd(x)
## S4 method for signature 'Norm'
skew(x)
## S4 method for signature 'Norm'
kurt(x)
## S4 method for signature 'Norm'
entro(x)
## S4 method for signature 'Norm'
finf(x)
## S4 method for signature 'numeric,numeric,Norm'
ll(x, prm, distr)
## S4 method for signature 'numeric,Norm'
mle(x, distr)
## S4 method for signature 'numeric,Norm'
me(x, distr)
## S4 method for signature 'Norm'
avar_mle(distr)
## S4 method for signature 'Norm'
avar_me(distr)
Arguments
mean , sd |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Poisson Distribution
Description
Poisson Distribution
Usage
Pois(lambda = 1)
## S4 method for signature 'Pois'
d(x)
## S4 method for signature 'Pois'
p(x)
## S4 method for signature 'Pois'
qn(x)
## S4 method for signature 'Pois'
r(x)
## S4 method for signature 'Pois'
mean(x)
## S4 method for signature 'Pois'
var(x)
## S4 method for signature 'Pois'
sd(x)
## S4 method for signature 'Pois'
skew(x)
## S4 method for signature 'Pois'
kurt(x)
## S4 method for signature 'Pois'
finf(x)
## S4 method for signature 'numeric,numeric,Pois'
ll(x, prm, distr)
## S4 method for signature 'numeric,Pois'
mle(x, distr)
## S4 method for signature 'numeric,Pois'
me(x, distr)
## S4 method for signature 'Pois'
avar_mle(distr)
## S4 method for signature 'Pois'
avar_me(distr)
Arguments
lambda |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Student Distribution
Description
Student Distribution
Usage
Stud(df = 1, ncp = 0)
## S4 method for signature 'Stud'
d(x)
## S4 method for signature 'Stud'
p(x)
## S4 method for signature 'Stud'
qn(x)
## S4 method for signature 'Stud'
r(x)
## S4 method for signature 'Stud'
mean(x)
## S4 method for signature 'Stud'
median(x)
## S4 method for signature 'Stud'
mode(x)
## S4 method for signature 'Stud'
var(x)
## S4 method for signature 'Stud'
sd(x)
## S4 method for signature 'Stud'
skew(x)
## S4 method for signature 'Stud'
kurt(x)
Arguments
df , ncp |
numeric. The distribution parameters. |
x |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Uniform Distribution
Description
Uniform Distribution
Usage
Unif(min = 0, max = 1)
## S4 method for signature 'Unif'
d(x)
## S4 method for signature 'Unif'
p(x)
## S4 method for signature 'Unif'
qn(x)
## S4 method for signature 'Unif'
r(x)
## S4 method for signature 'Unif'
mean(x)
## S4 method for signature 'Unif'
var(x)
## S4 method for signature 'Unif'
sd(x)
## S4 method for signature 'Unif'
skew(x)
## S4 method for signature 'Unif'
kurt(x)
## S4 method for signature 'Unif'
entro(x)
## S4 method for signature 'numeric,numeric,Unif'
ll(x, prm, distr)
## S4 method for signature 'numeric,Unif'
mle(x, distr)
## S4 method for signature 'numeric,Unif'
me(x, distr)
Arguments
min , max |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Weibull Distribution
Description
Weibull Distribution
Usage
Weib(shape = 1, scale = 1)
## S4 method for signature 'Weib'
d(x)
## S4 method for signature 'Weib'
p(x)
## S4 method for signature 'Weib'
qn(x)
## S4 method for signature 'Weib'
r(x)
## S4 method for signature 'Weib'
mean(x)
## S4 method for signature 'Weib'
median(x)
## S4 method for signature 'Weib'
mode(x)
## S4 method for signature 'Weib'
var(x)
## S4 method for signature 'Weib'
sd(x)
## S4 method for signature 'Weib'
skew(x)
## S4 method for signature 'Weib'
kurt(x)
## S4 method for signature 'Weib'
entro(x)
## S4 method for signature 'numeric,numeric,Weib'
ll(x, prm, distr)
## S4 method for signature 'numeric,Weib'
mle(x, distr, par0 = "same", method = "L-BFGS-B", lower = 1e-05, upper = Inf)
## S4 method for signature 'numeric,Weib'
me(x, distr)
## S4 method for signature 'Weib'
avar_mle(distr)
## S4 method for signature 'Weib'
avar_me(distr)
Arguments
shape , scale |
numeric. The distribution parameters. |
x |
an object of class |
prm |
numeric. A vector including the distribution parameters. |
distr |
an object of class |
par0 , method , lower , upper |
arguments passed to optim. |
Value
The dpqr family of functions return the evaluated density, cumulative probability, quantile, and random sample, respectively. The moments family of functions return the appropriate theoretical moment, as calculated by the distribution true parameters. The ll function returns the evaluated log-likelihood, given a sample and the theoretical parameters. The estim family of functions return the estimated parameters of the distribution, given a sample. The avar family of functions return the asymptotic variance or variance - covariance matrix (if there are two or more parameters) of the corresponding estimation method. Calculus performed on Distribution objects returns a Distribution object of the appropriate class and with the appropriate parameters.
Asymptotic Variance
Description
Calculates the asymptotic variance (or variance - covariance matrix in the multidimensional case) of an estimator, given a specified family of distributions and the true parameter values.
Usage
avar(distr, type, ...)
vbern(prob, type = "mle")
vbinom(size, prob, type = "mle")
vcat(prob, type = "mle")
vdirichlet(alpha, type = "mle")
vexp(rate, type = "mle")
vgamma(shape, scale, type = "mle")
vgeom(prob, type = "mle")
vlaplace(mu, sigma, type = "mle")
vmultinom(size, prob, type = "mle")
vnbinom(size, prob, type = "mle")
vnorm(mean, sd, type = "mle")
vpois(lambda, type = "mle")
vweib(shape, scale, type = "mle")
Arguments
distr |
A subclass of |
type |
character, case ignored. The estimator type (mle, me, or same). |
... |
extra arguments. |
alpha , mu , sigma , size , prob , shape , rate , scale , mean , sd , lambda |
numeric. Distribution parameters. |
Value
A named matrix. The asymptotic covariance matrix of the estimator.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
ME Asymptotic Variance
Description
Calculates the asymptotic variance (or variance - covariance matrix in the multidimensional case) of the ME, given a specified family of distributions and the true parameter values.
Usage
avar_me(distr, ...)
Arguments
distr |
A subclass of |
... |
extra arguments. |
Value
A named matrix. The asymptotic covariance matrix of the estimator.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
MLE Asymptotic Variance
Description
Calculates the asymptotic variance (or variance - covariance matrix in the multidimensional case) of the MLE, given a specified family of distributions and the true parameter values.
Usage
avar_mle(distr, ...)
Arguments
distr |
A subclass of |
... |
extra arguments. |
Value
A named matrix. The asymptotic covariance matrix of the estimator.
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
SAME Asymptotic Variance
Description
Calculates the asymptotic variance (or variance - covariance matrix in the multidimensional case) of the SAME, given a specified family of distributions and the true parameter values.
Usage
avar_same(distr, ...)
Arguments
distr |
A subclass of |
... |
extra arguments. |
Value
A named matrix. The asymptotic covariance matrix of the estimator.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
Distribution Calculus
Description
Distribution Calculus
Usage
## S4 method for signature 'Norm,Norm'
e1 + e2
## S4 method for signature 'numeric,Norm'
e1 + e2
## S4 method for signature 'Norm,numeric'
e1 + e2
## S4 method for signature 'Norm,Norm'
e1 - e2
## S4 method for signature 'numeric,Norm'
e1 - e2
## S4 method for signature 'Norm,numeric'
e1 - e2
## S4 method for signature 'numeric,Norm'
e1 * e2
## S4 method for signature 'Norm,numeric'
e1 * e2
## S4 method for signature 'Norm,numeric'
e1 / e2
## S4 method for signature 'Norm,logical'
sum(x, ..., na.rm = FALSE)
## S4 method for signature 'Norm'
exp(x)
Arguments
x , e1 , e2 |
objects of subclass |
... |
extra arguments. |
na.rm |
logical. Should missing values be removed? |
Value
All calculations return Distribution objects (specifically, objects
of a class that is a subclass of Distribution
), accordingly to the property
at hand.
Examples
# -----------------------------------------------------
# Distribution Calculus Example
# -----------------------------------------------------
library(estimators)
# Normal location - scale transformation
x <- Norm(mean = 2, sd = 3)
y <- 3 * x + 1 # Norm(mean = 7, sd = 9)
# Addition of two independent Normal random variables
x1 <- Norm(mean = 1, sd = 3)
x2 <- Norm(mean = 2, sd = 4)
x3 <- x1 + x2 # Norm(mean = 3, sd = 5)
The d p q r Functions
Description
Four generic functions that take a distribution object (e.g. Bern
) and
return the density, cumulative probability, quantile, and random generator
functions, respectively.
Usage
d(x, ...)
p(x, ...)
qn(x, ...)
r(x, ...)
Arguments
x |
an object of subclass |
... |
extra arguments. |
Value
The d p q r functions return the density, cumulative probability, quantile, and random generator functions, respectively.
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
library(estimators)
# Create the distribution
x <- Beta(3, 5)
# Density function
df <- d(x)
df(c(0.3, 0.8, 0.5))
# Probability function
pf <- p(x)
pf(c(0.3, 0.8, 0.5))
# Density function
qf <- qn(x)
qf(c(0.3, 0.8, 0.5))
# Random Generator function
rf <- r(x)
rf(5)
Parameter Estimation
Description
Estimates the parameters of a random sample according to a specified family of distributions.
Usage
estim(x, distr, type = "mle", ...)
ebern(x, type = "mle", ...)
ebeta(x, type = "mle", ...)
ebinom(x, type = "mle", ...)
ecat(x, type = "mle", ...)
edirichlet(x, type = "mle", ...)
eexp(x, type = "mle", ...)
egamma(x, type = "mle", ...)
egeom(x, type = "mle", ...)
elaplace(x, type = "mle", ...)
elnorm(x, type = "mle", ...)
emultinom(x, type = "mle", ...)
enbinom(x, type = "mle", ...)
enorm(x, type = "mle", ...)
epois(x, type = "mle", ...)
eunif(x, type = "mle", ...)
eweib(x, type = "mle", ...)
Arguments
x |
numeric. A sample under estimation. |
distr |
A subclass of |
type |
character, case ignored. The estimator type (mle, me, or same). |
... |
extra arguments. |
Value
numeric. The estimator produced by the sample.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
Polygamma Functions
Description
This set of functions revolve around the polygamma functions.
Usage
idigamma(x)
Ddigamma(x, y)
Dtrigamma(x, y)
gammap(x, p, log = FALSE)
Arguments
x , y |
numeric. The points to evaluate the function. |
p |
integer. The p-variate Gamma function. |
log |
logical. Should the logarithm of the result be returned? |
Value
numeric. The evaluated function.
Functions
-
idigamma()
: inverse digamma function. -
Ddigamma()
: digamma difference function. -
Dtrigamma()
: trigamma difference function. -
gammap()
: p-variate gamma function
Examples
idigamma(2)
Ddigamma(2, 3)
Dtrigamma(2, 3)
gammap(1:3, 3)
Large Sample Metrics
Description
This function performs Monte Carlo simulations to estimate the asymptotic variance - covariance matrix, characterizing the large sample behavior of an estimator. The function evaluates the metrics as a function of a single parameter, keeping the other ones constant. See Details.
Usage
large_metrics(D, prm, est = c("same", "me", "mle"), ...)
Arguments
D |
A subclass of |
prm |
A list containing three elements (name, pos, val). See Details. |
est |
character. The estimator of interest. Can be a vector. |
... |
extra arguments. |
Details
The distribution D
is used to specify an initial distribution. The list
prm
contains details concerning a single parameter that is allowed to
change values. The quantity of interest is evaluated as a function of this
parameter.
Specifically, prm
includes three elements named "name", "pos", and "val".
The first two elements determine the exact parameter that changes, while the
third one is a numeric vector holding the values it takes. For example,
in the case of the Multivariate Gamma distribution,
D <- MGamma(shape = c(1, 2), scale = 3)
and
prm <- list(name = "shape", pos = 2, val = seq(1, 1.5, by = 0.1))
means that the evaluation will be performed for the MGamma distributions with
shape parameters (1, 1)
, (1, 1.1)
, ..., (1, 1.5)
and scale 3
. Notice
that the initial shape parameter 2
in D
is not utilized in the function.
Value
A data.frame with columns "Row", "Col", "Parameter", "Estimator", and "Value".
See Also
small_metrics, plot_small_metrics, plot_large_metrics
Examples
D <- Beta(shape1 = 1, shape2 = 2)
prm <- list(name = "shape1",
pos = NULL,
val = seq(0.5, 2, by = 0.5))
x <- large_metrics(D, prm,
est = c("mle", "me", "same"))
plot_large_metrics(x)
Log-Likelihood
Description
These functions calculate the log-likelihood of an IID sample for specific values of the distribution parameters. See Details.
Usage
ll(x, prm, distr, ...)
## S4 method for signature 'ANY,ANY,character'
ll(x, prm, distr, ...)
llbern(x, prob)
llbinom(x, size, prob)
llcat(x, prob)
llcauchy(x, location, scale)
lldirichlet(x, alpha)
llexp(x, rate)
llgamma(x, shape, scale)
llgeom(x, prob)
lllaplace(x, mu, sigma)
lllnorm(x, meanlog, sdlog)
llMultinom(x, size, prob)
llnbinom(x, size, prob)
llnorm(x, mean, sd)
llpois(x, lambda)
llunif(x, min, max)
llweib(x, shape, scale)
Arguments
x |
numeric. A sample under estimation. |
prm |
numeric. A vector of the distribution parameters. |
distr |
A subclass of |
... |
extra arguments. |
location , alpha , mu , sigma , meanlog , sdlog , min , max , size , prob , shape , rate , scale , mean , sd , lambda |
numeric. Distribution parameters. |
Details
The log-likelihood functions are provided in two forms: the ll<name>
distribution-specific version that follows the base R conventions, and the
S4 generic ll
.
Value
Numeric. The value of the log-likelihood function.
Moment Estimation
Description
Calculates the ME under the assumption the sample observations are independent and identically distributed (iid) according to a specified family of distributions.
Usage
me(x, distr, ...)
## S4 method for signature 'ANY,character'
me(x, distr, ...)
Arguments
x |
numeric. A sample under estimation. |
distr |
A subclass of |
... |
extra arguments. |
Value
numeric. The estimator produced by the sample.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
Maximum Likelihood Estimation
Description
Calculates the MLE under the assumption the sample observations are independent and identically distributed (iid) according to a specified family of distributions.
Usage
mle(x, distr, ...)
## S4 method for signature 'ANY,character'
mle(x, distr, ...)
Arguments
x |
numeric. A sample under estimation. |
distr |
A subclass of |
... |
extra arguments. |
Value
numeric. The estimator produced by the sample.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
Moments - Parametric Quantities of Interest
Description
A set of functions that calculate the theoretical moments (expectation, variance, skewness, excess kurtosis) and other important parametric functions (median, mode, entropy, Fisher information) of a distribution.
Usage
moments(x)
mean(x, ...)
median(x, na.rm = FALSE, ...)
mode(x)
var(x, y = NULL, na.rm = FALSE, use)
sd(x, na.rm = FALSE)
skew(x, ...)
kurt(x, ...)
entro(x, ...)
finf(x, ...)
Arguments
x |
an object of a |
... |
extra arguments. |
y , use , na.rm |
arguments in |
Details
The moments()
function automatically finds the available methods for a
given distribution and results all of the results in a list.
Not all functions are available for distributions; for example, the sd()
is available only for univariate distributions.
Value
Numeric, either vector or matrix depending on the moment and the
distribution. Function moments()
returns a list of all available methods.
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
library(estimators)
# Create the distribution
x <- Beta(3, 5)
# List of all available moments
mom <- moments(x)
# Expectation
mean(x)
mom$mean
# Variance and Standard Deviation
var(x)
sd(x)
# Skewness and Excess Kurtosis
skew(x)
kurt(x)
# Entropy
entro(x)
# Fisher Information Matrix
finf(x)
Plot Large Sample Metrics
Description
This function provides an easy way to illustrate the output of
large_metrics()
, using the ggplot2
package. A grid of line charts is
created for each element of the asymptotic variance - covariance matrix.
Each estimator is plotted with a different color and linetype. The plot can
be saved in pdf format.
Usage
plot_large_metrics(
x,
colors = NULL,
title = NULL,
save = FALSE,
path = NULL,
name = "myplot.pdf",
width = 15,
height = 8
)
Arguments
x |
A data.frame. The result of |
colors |
character. The colors to be used in the plot. |
title |
character. The plot title. |
save |
logical. Should the plot be saved? |
path |
A path to the directory in which the plot will be saved. |
name |
character. The name of the output pdf file. |
width |
numeric. The plot width in inches. |
height |
numeric. The plot height in inches. |
Value
The plot is returned invisibly in the form of a ggplot
object.
See Also
small_metrics, large_metrics, plot_small_metrics
Examples
D <- Beta(shape1 = 1, shape2 = 2)
prm <- list(name = "shape1",
pos = NULL,
val = seq(0.5, 2, by = 0.5))
x <- small_metrics(D, prm,
est = c("mle", "me", "same"),
obs = c(20, 50),
sam = 1e2,
seed = 1)
plot_small_metrics(x)
Plot Small Sample Metrics
Description
This function provides an easy way to illustrate the output of
small_metrics()
, using the ggplot2
package. A grid of line charts is
created for each metric and sample size. Each estimator is plotted with a
different color and linetype. The plot can be saved in pdf format.
Usage
plot_small_metrics(
x,
colors = NULL,
title = NULL,
save = FALSE,
path = NULL,
name = "myplot.pdf",
width = 15,
height = 8
)
Arguments
x |
A data.frame. The result of |
colors |
character. The colors to be used in the plot. |
title |
character. The plot title. |
save |
logical. Should the plot be saved? |
path |
A path to the directory in which the plot will be saved. |
name |
character. The name of the output pdf file. |
width |
numeric. The plot width in inches. |
height |
numeric. The plot height in inches. |
Value
The plot is returned invisibly in the form of a ggplot
object.
See Also
small_metrics, large_metrics, plot_large_metrics
Examples
D <- Beta(shape1 = 1, shape2 = 2)
prm <- list(name = "shape1",
pos = NULL,
val = seq(0.5, 2, by = 0.5))
x <- small_metrics(D, prm,
est = c("mle", "me", "same"),
obs = c(20, 50),
sam = 1e2,
seed = 1)
plot_small_metrics(x)
Score - Adjusted Moment Estimation
Description
Calculates the SAME under the assumption the sample observations are independent and identically distributed (iid) according to a specified family of distributions.
Usage
same(x, distr, ...)
## S4 method for signature 'ANY,character'
same(x, distr, ...)
Arguments
x |
numeric. A sample under estimation. |
distr |
A subclass of |
... |
extra arguments. |
Value
numeric. The estimator produced by the sample.
References
Ye, Z.-S. & Chen, N. (2017), Closed-form estimators for the gamma distribution derived from likelihood equations, The American Statistician 71(2), 177–181.
Van der Vaart, A. W. (2000), Asymptotic statistics, Vol. 3, Cambridge university press.
Tamae, H., Irie, K. & Kubokawa, T. (2020), A score-adjusted approach to closed-form estimators for the gamma and beta distributions, Japanese Journal of Statistics and Data Science 3, 543–561.
Mathal, A. & Moschopoulos, P. (1992), A form of multivariate gamma distribution, Annals of the Institute of Statistical Mathematics 44, 97–106.
Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025
See Also
Examples
# -----------------------------------------------------
# Beta Distribution Example
# -----------------------------------------------------
# Simulation
set.seed(1)
shape1 <- 1
shape2 <- 2
D <- Beta(shape1, shape2)
x <- r(D)(100)
# Likelihood - The ll Functions
llbeta(x, shape1, shape2)
ll(x, c(shape1, shape2), D)
ll(x, c(shape1, shape2), "beta")
# Point Estimation - The e Functions
ebeta(x, type = "mle")
ebeta(x, type = "me")
ebeta(x, type = "same")
mle(x, D)
me(x, D)
same(x, D)
estim(x, D, type = "mle")
# Asymptotic Variance - The v Functions
vbeta(shape1, shape2, type = "mle")
vbeta(shape1, shape2, type = "me")
vbeta(shape1, shape2, type = "same")
avar_mle(D)
avar_me(D)
avar_same(D)
avar(D, type = "mle")
Small Sample Metrics
Description
This function performs Monte Carlo simulations to estimate the main metrics (bias, variance, and RMSE) characterizing the small sample behavior of an estimator. The function evaluates the metrics as a function of a single parameter, keeping the other ones constant. See Details.
Usage
small_metrics(
D,
prm,
est = c("same", "me", "mle"),
obs = c(20, 50, 100),
sam = 10000,
seed = 1,
...
)
Arguments
D |
A subclass of |
prm |
A list containing three elements (name, pos, val). See Details. |
est |
character. The estimator of interest. Can be a vector. |
obs |
numeric. The size of each sample. Can be a vector. |
sam |
numeric. The number of Monte Carlo samples used to estimate the metrics. |
seed |
numeric. Passed to |
... |
extra arguments. |
Details
The distribution D
is used to specify an initial distribution. The list
prm
contains details concerning a single parameter that is allowed to
change values. The quantity of interest is evaluated as a function of this
parameter.
Specifically, prm
includes three elements named "name", "pos", and "val".
The first two elements determine the exact parameter that changes, while the
third one is a numeric vector holding the values it takes. For example,
in the case of the Multivariate Gamma distribution,
D <- MGamma(shape = c(1, 2), scale = 3)
and
prm <- list(name = "shape", pos = 2, val = seq(1, 1.5, by = 0.1))
means that the evaluation will be performed for the MGamma distributions with
shape parameters (1, 1)
, (1, 1.1)
, ..., (1, 1.5)
and scale 3
. Notice
that the initial shape parameter 2
in D
is not utilized in the function.
Value
For the small sample, a data.frame with columns named "Parameter", "Observations", "Estimator", "Metric", and "Value". For the large sample, a data.frame with columns "Row", "Col", "Parameter", "Estimator", and "Value".
See Also
plot_small_metrics large_metrics, plot_large_metrics
Examples
D <- Beta(shape1 = 1, shape2 = 2)
prm <- list(name = "shape1",
pos = NULL,
val = seq(0.5, 2, by = 0.5))
x <- small_metrics(D, prm,
est = c("mle", "me", "same"),
obs = c(20, 50),
sam = 1e2,
seed = 1)
plot_small_metrics(x)