Title: | Truncated Positive Normal Model and Extensions |
---|---|
Description: | Provide data generation and estimation tools for the truncated positive normal (tpn) model discussed in Gomez, Olmos, Varela and Bolfarine (2018) <doi:10.1007/s11766-018-3354-x>, the slash tpn distribution discussed in Gomez, Gallardo and Santoro (2021) <doi:10.3390/sym13112164>, the bimodal tpn distribution discussed in Gomez et al. (2022) <doi:10.3390/sym14040665> and the flexible tpn model. |
Authors: | Diego Gallardo [aut, cre], Hector J. Gomez [aut], Yolanda M. Gomez [aut] |
Maintainer: | Diego Gallardo <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.9 |
Built: | 2024-12-25 07:13:00 UTC |
Source: | CRAN |
Density, distribution function and random generation for the bimodal truncated positive normal (btpn) discussed in Gomez et al. (2022).
dbtpn(x, sigma, lambda, eta, log = FALSE) pbtpn(x, sigma, lambda, eta, lower.tail=TRUE, log=FALSE) rbtpn(n, sigma, lambda, eta)
dbtpn(x, sigma, lambda, eta, log = FALSE) pbtpn(x, sigma, lambda, eta, lower.tail=TRUE, log=FALSE) rbtpn(n, sigma, lambda, eta)
x |
vector of quantiles |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
eta |
shape parameter for the distribution |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the stochastic representation of the model, i.e., the product between a tpn
(see Gomez et al. 2018) and a dichotomous variable assuming values and
with probabilities
and
, respectively.
dbtpn gives the density, pbtpn gives the distribution function and rbtpn generates random deviates.
The length of the result is determined by n for rbtpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable have btpn distribution with parameters R and
R if its probability density
function can be written as
and
where and
and
denote the probability density function and the cumulative distribution
function for the standard normal distribution, respectively.
Gallardo, D.I., Gomez, H.J. and Gomez, Y.M.
Gomez, H.J., Caimanque, W., Gomez, Y.M., Magalhaes, T.M., Concha, M., Gallardo, D.I. (2022) Bimodal Truncation Positive Normal Distribution. Symmetry, 14, 665.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
dbtpn(c(1,2), sigma=1, lambda=-1, eta=2) pbtpn(c(1,2), sigma=1, lambda=-1, eta=2) rbtpn(n=10, sigma=1, lambda=-1, eta=2)
dbtpn(c(1,2), sigma=1, lambda=-1, eta=2) pbtpn(c(1,2), sigma=1, lambda=-1, eta=2) rbtpn(n=10, sigma=1, lambda=-1, eta=2)
Provide model selection for a given data set in the flexible truncated positive class of models
choose.fts(y, criteria = "AIC")
choose.fts(y, criteria = "AIC")
y |
positive vector of responses |
criteria |
model criteria for the selection: AIC (default) or BIC. |
The function fits the truncated positive normal, truncated positive laplace, truncated positive Cauchy and truncated positive logistic models and select the model which provides the lower criteria (AIC or BIC).
A list with the following components
AIC |
a vector with the AIC for the different truncated positive fitted models: normal, laplace, cauchy and logistic. |
selected |
the selected model |
estimate |
the estimated for sigma and lambda and the respective standard errors (s.e.) |
conv |
the code related to the convergence for the optim function. 0 if the convergence was attached. |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
Gallardo, D.I., Gomez, H.J. and Gomez, Y.M.
Gomez, H.J., Gomez, H.W., Santoro, K.I., Venegas, O., Gallardo, D.I. (2022). A Family of Truncation Positive Distributions. Submitted.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
set.seed(2021) y=rfts(n=100,sigma=10,lambda=1,dist="logis") choose.fts(y)
set.seed(2021) y=rfts(n=100,sigma=10,lambda=1,dist="logis") choose.fts(y)
Perform the parameter estimation for the bimodal truncated positive normal (btpn) discussed in Gomez et al. (2022). Estimated errors are computed based on the hessian matrix.
est.btpn(y)
est.btpn(y)
y |
the response vector. All the values must be positive. |
A variable have btpn distribution with parameters R and
R if its probability density
function can be written as
and
where and
and
denote the probability density function and the cumulative distribution
function for the standard normal distribution, respectively.
A list with the following components
estimate |
A matrix with the estimates and standard errors |
iter |
Iterations in which the convergence were attached. |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I., Gomez, H.J. and Gomez, Y.M.
Gomez, H.J., Caimanque, W., Gomez, Y.M., Magalhaes, T.M., Concha, M., Gallardo, D.I. (2022) Bimodal Truncation Positive Normal Distribution. Symmetry, 14, 665.
set.seed(2021) y=rbtpn(n=100,sigma=10,lambda=1,eta=1.5) est.btpn(y)
set.seed(2021) y=rbtpn(n=100,sigma=10,lambda=1,eta=1.5) est.btpn(y)
Perform the parameter estimation for the Flexible truncated positive (fts) class discussed in Gomez et al. (2022) based on maximum likelihood estimation. Estimated errors are computed based on the hessian matrix.
est.fts(y, dist="norm")
est.fts(y, dist="norm")
y |
the response vector. All the values must be positive. |
dist |
standard symmetrical distribution. Avaliable options: norm (default), logis, cauchy and laplace. |
A variable has fts distribution with parameters and
R if its probability density
function can be written as
where and
denote the pdf and cdf for the specified distribution.
The case where
and
are from the standard normal model is known as the truncated positive normal model discussed
in Gomez et al. (2018).
A list with the following components
estimate |
A matrix with the estimates and standard errors |
dist |
distribution specified |
conv |
the code related to the convergence for the optim function. 0 if the convergence was attached. |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I. and Gomez, H.J.
Gomez, H.J., Gomez, H.W., Santoro, K.I., Venegas, O., Gallardo, D.I. (2022). A Family of Truncation Positive Distributions. Submitted.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
set.seed(2021) y=rfts(n=100,sigma=10,lambda=1,dist="logis") est.fts(y,dist="logis")
set.seed(2021) y=rfts(n=100,sigma=10,lambda=1,dist="logis") est.fts(y,dist="logis")
Perform the parameter estimation for the slash truncated positive normal (stpn) discussed in Gomez, Gallardo and Santoro (2021) based on the EM algorithm. Estimated errors are computed based on the Louis method to approximate the hessian matrix.
est.stpn(y, sigma0=NULL, lambda0=NULL, q0=NULL, prec = 0.001, max.iter = 1000)
est.stpn(y, sigma0=NULL, lambda0=NULL, q0=NULL, prec = 0.001, max.iter = 1000)
y |
the response vector. All the values must be positive. |
sigma0 , lambda0 , q0
|
initial values for the EM algorithm for sigma, lambda and q. If they are omitted, by default sigma0 is defined as the root of the mean of the y^2, lambda as 0 and q as 3. |
prec |
the precision defined for each parameter. By default is 0.001. |
max.iter |
the maximum iterations for the EM algorithm. By default is 1000. |
A variable has stpn distribution with parameters R and
if its probability density
function can be written as
where denotes the density function for the standard normal distribution.
A list with the following components
estimate |
A matrix with the estimates and standard errors |
iter |
Iterations in which the convergence were attached. |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I. and Gomez, H.J.
Gomez, H., Gallardo, D.I., Santoro, K. (2021) Slash Truncation Positive Normal Distribution: with application using the EM algorithm. Symmetry, 13, 2164.
set.seed(2021) y=rstpn(n=100,sigma=10,lambda=1,q=2) est.stpn(y)
set.seed(2021) y=rstpn(n=100,sigma=10,lambda=1,q=2) est.stpn(y)
Perform the parameter estimation for the truncated positive normal (tpn) discussed in Gomez et al. (2018) based on maximum likelihood estimation. Estimated errors are computed based on the hessian matrix.
est.tpn(y)
est.tpn(y)
y |
the response vector. All the values must be positive. |
A variable have tpn distribution with parameters and
R if its probability density
function can be written as
where and
denote the density and cumultative distribution functions for the standard normal distribution.
A list with the following components
estimate |
A matrix with the estimates and standard errors |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I. and Gomez, H.J.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
set.seed(2021) y=rtpn(n=100,sigma=10,lambda=1) est.tpn(y)
set.seed(2021) y=rtpn(n=100,sigma=10,lambda=1) est.tpn(y)
Perform the parameter estimation for the truncated positive t (tpt) distribution based on maximum likelihood estimation. Estimated errors are computed based on the hessian matrix.
est.tpt(y)
est.tpt(y)
y |
the response vector. All the values must be positive. |
A variable have tpt distribution with parameters ,
R and
if its probability density
function can be written as
where and
denote the density and cumulative distribution functions for the standard t distribution with
degrees of freedom.
A list with the following components
estimate |
A matrix with the estimates and standard errors |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I. and Gomez, H.J.
set.seed(2021) y=rtpt(n=100,sigma=10,lambda=1, nu=5) est.tpt(y)
set.seed(2021) y=rtpt(n=100,sigma=10,lambda=1, nu=5) est.tpt(y)
Perform the parameter estimation for the unit truncated positive normal (utpn) type 1, 2, 3 or 4, parameterized in terms of the quantile based on maximum likelihood estimation. Estimated errors are computed based on the hessian matrix.
est.utpn(y, x=NULL, type=1, link="logit", q=0.5)
est.utpn(y, x=NULL, type=1, link="logit", q=0.5)
y |
the response vector. All the values must be positive. |
x |
the covariates vector. |
type |
to distinguish the type of the utpn model: 1 (default), 2, 3 or 4. |
link |
link function to be used for the covariates: logit (default). |
q |
quantile of the distribution to be modelled. |
A list with the following components
estimate |
A matrix with the estimates and standard errors |
logLik |
log-likelihood function evaluated in the estimated parameters. |
AIC |
Akaike's criterion. |
BIC |
Schwartz's criterion. |
A warning is presented if the estimated hessian matrix is not invertible.
Gallardo, D.I.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
set.seed(2021) y=rutpn(n=100,sigma=10,lambda=1) est.utpn(y)
set.seed(2021) y=rutpn(n=100,sigma=10,lambda=1) est.utpn(y)
Density, distribution function and random generation for the flexible truncated positive (ftp) class discussed in Gomez et al. (2022).
dfts(x, sigma, lambda, dist="norm", log = FALSE) pfts(x, sigma, lambda, dist="norm", lower.tail=TRUE, log.p=FALSE) qfts(p, sigma, lambda, dist="norm") rfts(n, sigma, lambda, dist="norm")
dfts(x, sigma, lambda, dist="norm", log = FALSE) pfts(x, sigma, lambda, dist="norm", lower.tail=TRUE, log.p=FALSE) qfts(p, sigma, lambda, dist="norm") rfts(n, sigma, lambda, dist="norm")
x |
vector of quantiles |
p |
vector of probabilities |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
dist |
standard symmetrical distribution. Avaliable options: norm (default), logis, cauchy and laplace. |
log , log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the inverse transformation method.
dfts gives the density, pfts gives the distribution function, qfts gives the quantile function and rfts generates random deviates.
The length of the result is determined by n for rbtpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable have fts distribution with parameters and
R if its probability density
function can be written as
where and
denote the pdf and cdf for the specified distribution.
The case where
and
are from the standard normal model is known as the truncated positive normal model discussed
in Gomez et al. (2018).
Gallardo, D.I., Gomez, H.J. and Gomez, Y.M.
Gomez, H.J., Gomez, H.W., Santoro, K.I., Venegas, O., Gallardo, D.I. (2022). A Family of Truncation Positive Distributions. Submitted.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
dfts(c(1,2), sigma=1, lambda=1, dist="logis") pfts(c(1,2), sigma=1, lambda=1, dist="logis") rfts(n=10, sigma=1, lambda=1, dist="logis")
dfts(c(1,2), sigma=1, lambda=1, dist="logis") pfts(c(1,2), sigma=1, lambda=1, dist="logis") rfts(n=10, sigma=1, lambda=1, dist="logis")
Density, distribution function and random generation for the slash truncated positive normal (stpn) discussed in Gomez, Gallardo and Santoro (2021).
dstpn(x, sigma, lambda, q, log = FALSE) pstpn(x, sigma, lambda, q, lower.tail=TRUE, log=FALSE) rstpn(n, sigma, lambda, q)
dstpn(x, sigma, lambda, q, log = FALSE) pstpn(x, sigma, lambda, q, lower.tail=TRUE, log=FALSE) rstpn(n, sigma, lambda, q)
x |
vector of quantiles |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
q |
shape parameter for the distribution |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the stochastic representation of the model, i.e., the quotient between a tpn (see Gomez et al. 2018) and a beta random variable.
dstpn gives the density, pstpn gives the distribution function and rstpn generates random deviates.
The length of the result is determined by n for rstpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable has stpn distribution with parameters R and
if its probability density
function can be written as
where denotes the density function for the standard normal distribution.
Gallardo, D.I. and Gomez, H.J.
Gomez, H., Gallardo, D.I., Santoro, K. (2021) Slash Truncation Positive Normal Distribution: with application using the EM algorithm. Symmetry, 13, 2164.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
dstpn(c(1,2), sigma=1, lambda=-1, q=2) pstpn(c(1,2), sigma=1, lambda=-1, q=2) rstpn(n=10, sigma=1, lambda=-1, q=2)
dstpn(c(1,2), sigma=1, lambda=-1, q=2) pstpn(c(1,2), sigma=1, lambda=-1, q=2) rstpn(n=10, sigma=1, lambda=-1, q=2)
Density, distribution function and random generation for the truncated positive normal (tpn) discussed in Gomez, et al. (2018).
dtpn(x, sigma, lambda, log = FALSE) ptpn(x, sigma, lambda, lower.tail=TRUE, log=FALSE) rtpn(n, sigma, lambda)
dtpn(x, sigma, lambda, log = FALSE) ptpn(x, sigma, lambda, lower.tail=TRUE, log=FALSE) rtpn(n, sigma, lambda)
x |
vector of quantiles |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the inverse transformation method.
dtpn gives the density, ptpn gives the distribution function and rtpn generates random deviates.
The length of the result is determined by n for rtpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable have tpn distribution with parameters and
R if its probability density
function can be written as
where and
denote the density and cumultative distribution functions for the standard normal distribution.
Gallardo, D.I. and Gomez, H.J.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
dtpn(c(1,2), sigma=1, lambda=-1) ptpn(c(1,2), sigma=1, lambda=-1) rtpn(n=10, sigma=1, lambda=-1)
dtpn(c(1,2), sigma=1, lambda=-1) ptpn(c(1,2), sigma=1, lambda=-1) rtpn(n=10, sigma=1, lambda=-1)
Density, distribution function and random generation for the slash truncated positive student-t (tpt) distribution.
dtpt(x, sigma, lambda, nu, log = FALSE) ptpt(x, sigma, lambda, nu, lower.tail=TRUE, log=FALSE) rtpt(n, sigma, lambda, nu)
dtpt(x, sigma, lambda, nu, log = FALSE) ptpt(x, sigma, lambda, nu, lower.tail=TRUE, log=FALSE) rtpt(n, sigma, lambda, nu)
x |
vector of quantiles |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
nu |
nu parameter for the distribution |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the inverse transformation method.
dtpt gives the density, ptpt gives the distribution function and rtpt generates random deviates.
The length of the result is determined by n for rtpt, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable have tpt distribution with parameters ,
R and
if its probability density
function can be written as
where and
denote the density and cumultative distribution functions for the standard t distribution with
degrees of freedom.
Gallardo, D.I. and Gomez, H.J.
dtpt(c(1,2), sigma=1, lambda=-1, nu=5) ptpt(c(1,2), sigma=1, lambda=-1, nu=5) rtpt(n=10, sigma=1, lambda=-1, nu=5)
dtpt(c(1,2), sigma=1, lambda=-1, nu=5) ptpt(c(1,2), sigma=1, lambda=-1, nu=5) rtpt(n=10, sigma=1, lambda=-1, nu=5)
Density, distribution function and random generation for the unit truncated positive normal (utpn) type 1 or 2 discussed in Gomez, Gallardo and Santoro (2021).
dutpn(x, sigma = 1, lambda = 0, type = 1, log = FALSE) putpn(x, sigma = 1, lambda = 0, type = 1, lower.tail = TRUE, log = FALSE) qutpn(p, sigma = 1, lambda = 0, type = 1) rutpn(n, sigma = 1, lambda = 0, type = 1)
dutpn(x, sigma = 1, lambda = 0, type = 1, log = FALSE) putpn(x, sigma = 1, lambda = 0, type = 1, lower.tail = TRUE, log = FALSE) qutpn(p, sigma = 1, lambda = 0, type = 1) rutpn(n, sigma = 1, lambda = 0, type = 1)
x |
vector of quantiles |
n |
number of observations |
p |
vector of probabilities |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
type |
to distinguish the type of the utpn model: 1 (default) or 2. |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Random generation is based on the inverse transformation method.
dutpn gives the density, putpn gives the distribution function, qutpn provides the quantile function and rutpn generates random deviates.
The length of the result is determined by n for rtpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable has utpn distribution with scale parameter and shape parameter
R if its probability density
function can be written as
where and
denote the density and cumulative distribution functions for the standard normal distribution.
Gallardo, D.I.
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
dutpn(c(0.1,0.2), sigma=1, lambda=-1) putpn(c(0.1,0.2), sigma=1, lambda=-1) rutpn(n=10, sigma=1, lambda=-1)
dutpn(c(0.1,0.2), sigma=1, lambda=-1) putpn(c(0.1,0.2), sigma=1, lambda=-1) rutpn(n=10, sigma=1, lambda=-1)