Package 'twopexp'

Title: The Two Parameter Exponential Distribution
Description: Density, distribution function, quantile function, and random generation function, maximum likelihood estimation (MLE), penalized maximum likelihood estimation (PMLE), the quartiles method estimation (QM), and median rank estimation (MEDRANK) for the two-parameter exponential distribution. MLE and PMLE are based on Mengjie Zheng (2013)<https://scse.d.umn.edu/sites/scse.d.umn.edu/files/mengjie-thesis_masters-1.pdf>. QM is based on Entisar Elgmati and Nadia Gregni (2016)<doi:10.5539/ijsp.v5n5p12>. MEDRANK is based on Matthew Reid (2022)<doi:10.5281/ZENODO.3938000>.
Authors: Atchanut Rattanalertnusorn [aut, cre]
Maintainer: Atchanut Rattanalertnusorn <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-02-16 04:01:06 UTC
Source: https://github.com/cran/twopexp

Help Index


Distribution function plot of the two-parameter exponential distribution

Description

Distribution function plot of the two-parameter exponential distribution with theta and beta

Usage

cdfplot(x, theta, beta)

Arguments

x

vector of quantile.

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0.

Value

a distribution function plot of the two-parameter exponential distribution

Examples

x <- seq(0,20,by=0.01)
theta <- 6
beta <- 2
cdfplot(x,theta,beta)

Median rank method to estimate parameters of the two-parameter exponential dist.

Description

Median rank method to estimate parameters of the two-parameter exponential dist.

Usage

medrank(x, methods = c("B"))

Arguments

x

vector of quantile (or a data set).

methods

there are some of median rank methods as follows; "B" stand for Benard median rank method (default), "BL" stand for Blom method, "MKM" stand for Hazen (Modified Kaplan Meier) method, "OT" stand for The one-third method, and "C" stand for Cunane method

Value

the estimate three values for the two-parameter exponential dist. as follows: theta.hat gives the estimate location parameter, beta.hat gives the estimate scale parameter, and lamda.hat gives the estimate the rate.

Source

Reid, M. (2022). Reliability – a Python library for reliability engineering (Version 0.8.2) [Computer software]. Zenodo. doi:10.5281/ZENODO.3938000.

Examples

x1 <- c(25,43,53,65,76,86,95,115,132,150) # test a data set
medrank(x1,"B")    # Benard method (default) or medrank(x1)

Maximum likelihood estimation for the two-parameter exponential dist.

Description

To estimate the location (or shift) and scale parameters for the two-parameter exponential distribution based on maximum likelihood method. See detail in source

Usage

mle_tpexp(x, theta = 0, beta = 1)

Arguments

x

vector of quantile (or a data set).

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0 and rate=1/βrate=1/\beta.

Value

the estimate three values for the two-parameter exponential dist. as follows: theta.hat gives the estimate location parameter, beta.hat gives the estimate scale parameter, and lamda.hat gives the estimate the rate.

Source

Zheng, M. (2013). Penalized Maximum Likelihood Estimation of Two-Parameter Exponential Distributions [Master’s thesis]. https://scse.d.umn.edu/sites/scse.d.umn.edu/files/mengjie-thesis_masters-1.pdf

Examples

x1 <- c(25,43,53,65,76,86,95,115,132,150) # test a data set
mle_tpexp(x1)
x2 <- c(20,15,10,25,35,30,40,70,50,60,90,100,80,5) # test a data set
mle_tpexp(x2)

Density plot of the two-parameter exponential distribution

Description

Density plot of the two-parameter exponential distribution with theta and beta

Usage

pdfplot(x, theta, beta)

Arguments

x

vector of quantile.

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0.

Value

a density plot of the two-parameter exponential distribution

Examples

x <- seq(0,20,by=0.01)
theta <- 6
beta <- 2
pdfplot(x,theta,beta)

Penalized maximum likelihood estimation for the two-parameter exponential dist.

Description

To estimate the location (or shift) and scale parameters for the two-parameter exponential distribution based on penalized maximum likelihood method. See detail in source

Usage

pmle_tpexp(x, theta = 0, beta = 1)

Arguments

x

vector of quantile (or a data set).

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0 and rate=1/βrate=1/\beta.

Value

the estimate three values for the two-parameter exponential dist. as follows: ptheta.hat gives the estimate location parameter, pbeta.hat gives the estimate scale parameter, and plamda.hat gives the estimate the rate.

Source

Zheng, M. (2013). Penalized Maximum Likelihood Estimation of Two-Parameter Exponential Distributions [Master’s thesis]. https://scse.d.umn.edu/sites/scse.d.umn.edu/files/mengjie-thesis_masters-1.pdf

Examples

x1 <- c(25,43,53,65,76,86,95,115,132,150) # test a data set
pmle_tpexp(x1)
x2 <- c(20,15,10,25,35,30,40,70,50,60,90,100,80,5) # test a data set
pmle_tpexp(x2)

Quartile method estimation of the two-parameter exponential distribution

Description

To estimate the location (or shift) and scale parameters for the two-parameter exponential distribution based on quartile method. See detail in source

Usage

qm_tpexp(x, methods = c("Q13"))

Arguments

x

vector of quantile (or a data set).

methods

there are two quartile methods as follows; "Q13" stand for the first and the third quartile method (default), and "Q12" stand for the first and the second quartile (median) method.

Value

the estimate three values for the two-parameter exponential dist. as follows: qmtheta.hat gives the estimate location parameter, qmbeta.hat gives the estimate scale parameter, and qmlamda.hat gives the estimate the rate.

Source

Elgmati, E., Gregni, N. (2016). Quartile Method Estimation of Two-Parameter Exponential Distribution Data with Outliers. International Journal of Statistics and Probability, 5(5), 12-15. doi:10.5539/ijsp.v5n5p12

Examples

x1 <- c(25,43,53,65,76,86,95,115,132,150) # test a data set
qm_tpexp(x1,"Q13")  # or qm_tpexp(x1)
qm_tpexp(x1,"Q12")

Survival function plot of the two-parameter exponential distribution

Description

Survival function plot of the two-parameter exponential distribution with theta and beta

Usage

surplot(x, theta, beta)

Arguments

x

vector of quantile.

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0.

Value

a survival function plot of the two-parameter exponential distribution

Examples

x <- seq(0,20,by=0.01)
theta <- 8
beta <- 1
surplot(x,theta,beta)

The two-parameter exponential distribution(tpexp)

Description

Density, distribution function, quantile function, and random generation function for the two-parameter exponential distribution with theta and beta

Usage

dtpexp(x, theta = 0, beta = 1, log = FALSE)

ptpexp(q, theta = 0, beta = 1, lower.tail = TRUE, log.p = FALSE)

qtpexp(p, theta = 0, beta = 1, lower.tail = TRUE, log.p = FALSE)

rtpexp(n, theta = 0, beta = 1)

Arguments

x, q

vector of quantile.

theta

location parameter, where θ>0\theta > 0.

beta

scale parameter, where β>0\beta > 0 and rate=1/βrate=1/\beta.

log, log.p

logical; (default = FALSE), if TRUE, then probabilities are given as log(p).

lower.tail

logical; if TRUE (default), probabilities are P[Xx]P[X \le x], otherwise, P[X>x]P[X > x].

p

vector of probabilities

n

number of observations. If length(n) > 1, the length is taken to be the number required.

Value

dtpexp gives the density, ptpexp gives the distribution function, qtpexp gives the quantile function, and rtpexp generates random samples.

Examples

x <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
dtpexp(x,theta=0,beta=1)
dtpexp(x,theta=0,beta=1,log=TRUE)

q <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
ptpexp(q,theta = 0, beta = 1)
ptpexp(q,theta=0, beta = 1, lower.tail = FALSE)

q <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
p<- ptpexp(q,theta = 0, beta = 1); p
qtpexp(p,theta=0, beta = 1)

rtpexp(5, theta=0, beta=1)
rtpexp(10, theta=1, beta=1.5)