Package 'GEC'

Title: Generalized Exponentiated Composite Distributions
Description: The framework of the estimation, sampling, and hypotheses testing for two special distributions (Exponentiated Exponential-Pareto and Exponentiated Inverse Gamma-Pareto) within the family of Generalized Exponentiated Composite distributions.
Authors: Bowen Liu [aut, cre], Malwane M.A. Ananda [aut]
Maintainer: Bowen Liu <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2025-02-19 04:59:05 UTC
Source: https://github.com/liuaber/gec

Help Index


Asymptotic Wald's test for testing the exponent in a EEP model.

Description

This function computes the test statistic and the p-value of Wald's test for the exponent parameter in EEP model.

Usage

asymptotic_eep(data, eta0, theta1, eta1)

Arguments

data

n by 1 vector with all positive entries.

eta0

To test if the exponent equals 1, the default for eta0 is et to be 1.

theta1

The unrestricted MLE of theta.

eta1

The unrestricted MLE of eta.

Details

asymptotic_eep

Value

This function returns the test statistic and the p-value of the Wald's test.

Examples

sample1 = eep_sampling(1000,eta = 1.1,theta = 3)
theta1 = mle_search_eep(data = sample1)$theta
eta1 = mle_search_eep(data = sample1)$eta
asymptotic_eep(sample1,eta0 = 1,theta1,eta1)

Asymptotic Wald's test for testing the exponent in a EIGP model.

Description

This function computes the test statistic and the p-value of Wald's test for the exponent parameter in EIGP model.

Usage

asymptotic_eigp(data, eta0 = 1, theta1, eta1)

Arguments

data

n by 1 vector with all positive entries.

eta0

To test if the exponent equals 1, the default for eta0 is et to be 1.

theta1

The unrestricted MLE of theta.

eta1

The unrestricted MLE of eta.

Details

asymptotic_eigp

Value

This function returns the test statistic and the p-value of the Wald's test.

Examples

sample1 = eigp_sampling(1000,eta = 1.1,theta = 3)
theta1 = mle_search_eigp(data = sample1)$theta
eta1 = mle_search_eigp(data = sample1)$eta
asymptotic_eigp(sample1,eta0 = 1,theta1,eta1)

The cumulative distribution function of EEP.

Description

cdf_eep

Usage

cdf_eep(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the cumulative probability of EEP at the specific location.

Examples

cdf_eep(1,2,5)

The cumulative distribution function of EIGP.

Description

cdf_eigp

Usage

cdf_eigp(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the cumulative probability of EIGP at the specific location.

Examples

cdf_eigp(1,2,5)

The EEP negative log-likelihood function.

Description

This function serves as the objective function for the Maximum Likelihood Estimation procedure for EEP.

Usage

eep_nll(x, m, data)

Arguments

x

A 2 by 1 vector.

m

m is the number of data items less than the density change point

data

n by 1 vector with all positive entries

Details

eep_nll

x is a 2 by 1 vector; m denotes the number of data items less than the density change point; data is a n by 1 vector, where n denotes the sample size of the data.

Examples

eep_nll(c(2,2),50,seq(1:100))

The wrapper function that returns the final estimates from Maximum Likelihood Estimation.

Description

This function serves as a wrapper that returns the final estimates of theta, eta, and the corresponding density change point

Usage

eep_optim(data, init = c(1, 1), lower_bound = c(0.01, 0.01))

Arguments

data

a n by 1 vector with all positive entries.

init

a 2 by 1 vector serves as the initial values of the model parameters. The default is c(1,1).

lower_bound

a 2 by 1 vector serves as the lower bound of the parameters. The default is c(0.01,0.01).

Details

eigp_optim

Value

a data frame with 1 row and 3 columns that contains the MLE of theta, eta, and the predicted density change point.

Examples

eep_optim(seq(1:100))

Sampling from EEP distribution.

Description

Create a EEP random sample of size n, with parameters theta and eta.

Usage

eep_sampling(n, theta, eta)

Arguments

n

A positive integer to specify the sample size

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

eep_sampling

Input an the sample size as n, parameters theta and eta, returns a numerical vector of size n.

Value

returns a numerical vector of size n.

Examples

eep_sampling(100,1,1)

The EIGP negative log-likelihood function.

Description

This function serves as the objective function for the Maximum Likelihood Estimation procedure for EIGP.

Usage

eigp_nll(x, m, data)

Arguments

x

A 2 by 1 vector.

m

m is the number of data items less than the density change point.

data

n by 1 vector with all positive entries.

Details

eigp_nll

x is a 2 by 1 vector; m denotes the number of data items less than the density change point; data is a n by 1 vector, where n denotes the sample size of the data.

Examples

eigp_nll(c(2,2),50,seq(1:100))

The wrapper function that returns the final estimates from Maximum Likelihood Estimation.

Description

This function serves as a wrapper that returns the final estimates of theta, eta, and the corresponding density change point

Usage

eigp_optim(data, init = c(1, 1), lower_bound = c(0.01, 0.01))

Arguments

data

a n by 1 vector with all positive entries.

init

a 2 by 1 vector serves as the initial values of the model parameters. The default is c(1,1).

lower_bound

a 2 by 1 vector serves as the lower bound of the parameters. The default is c(0.01,0.01).

Details

eigp_optim

Value

a data frame with 1 row and 3 columns that contains the MLE of theta, eta, and the predicted density change point.

Examples

eigp_optim(seq(1:100))

Sampling from EIGP distribution.

Description

Create a EIGP random sample of size n, with parameters theta and eta.

Usage

eigp_sampling(n, theta, eta)

Arguments

n

A positive integer to specify the sample size

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

eigp_sampling

Input an the sample size as n, parameters theta and eta, returns a numerical vector of size n.

Value

returns a numerical vector of size n.

Examples

eigp_sampling(100,1,1)

The negative log density of a sample item if it follows exponential in a EEP model

Description

This function return the negative log density of a sample item if if it follows exponential in a EEP model.

Usage

exp_eep(x, theta, eta)

Arguments

x

The value of a sample item.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

exp_exp

Value

This function return the negative log density of a sample item if if it follows exponential in a EEP model.

Examples

exp_eep(1,5,2)

The hazard function of EEP.

Description

hazard_eep

Usage

hazard_eep(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the hazard of EEP at the specific location.

Examples

hazard_eep(2,1,5)
plot(hazard_eep(2,1,seq(0.01,100,by=0.01)))

The hazard function of EIGP.

Description

hazard_eigp

Usage

hazard_eigp(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the hazard of EIGP at the specific location.

Examples

hazard_eigp(1,2,5)

The negative log density of a sample item if it follows inverse gamma in a EIGP model

Description

This function return the negative log density of a sample item if if it follows inverse gamma in a EIGP model.

Usage

inv_gamma_eigp(x, theta, eta)

Arguments

x

The value of a sample item.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

inv_gamma_eigp

Value

This function return the negative log density of a sample item if if it follows inverse gamma in a EIGP model.

Examples

inv_gamma_eigp(1,5,2)

Likelihood Ratio Test (LRT) for the exponent parameter in EEP model.

Description

This function computes the test statistic and the p-value of LRT for the exponent parameter in EEP model.

Usage

LRT_eep(data, theta0, theta1, eta1)

Arguments

data

n by 1 vector with all positive entries.

theta0

The MLE of theta when eta = 1.

theta1

The unrestricted MLE of theta.

eta1

The unrestricted MLE of eta.

Details

LRT_eep

Value

This function returns the test statistic and the p-value of the LRT test

Examples

sample1 = eep_sampling(1000,eta = 1.1,theta = 6)
eta1 = mle_search_eep(data = sample1)$eta
theta1 = mle_search_eep(data = sample1)$theta
theta0 = mle_iter_eep(data = sample1,eta = 1)
LRT_eep(sample1,theta0,theta1,eta1)

Likelihood Ratio Test (LRT) for the exponent parameter in EIGP model.

Description

This function computes the test statistic and the p-value for LRT for the exponent parameter in EIGP model.

Usage

LRT_eigp(data, theta0, theta1, eta1)

Arguments

data

n by 1 vector with all positive entries.

theta0

The MLE of theta when eta = 1.

theta1

The unrestricted MLE of theta.

eta1

The unrestricted MLE of eta.

Details

LRT_eigp

Value

This function returns the test statistic and the p-value from the LRT test

Examples

sample1 = eigp_sampling(1000,eta = 1.1,theta = 3)
eta1 = mle_search_eigp(data = sample1)$eta
theta1 = mle_search_eigp(data = sample1)$theta
theta0 = mle_iter_eigp(data = sample1,eta = 1)
LRT_eigp(sample1,theta0,theta1,eta1)

Analytical solution of theta given eta in EEP model.

Description

This function provides the analytical solution of theta for given eta EEP model.

Usage

mle_eep(s, m, n)

Arguments

s

a numeric value the sum of log(1/x_i^eta), where i is from 1 to m.

m

m is the number of data items less than the density change point.

n

n is the sample size, n has to be greater than m.

Details

mle_eep

Value

This function returns the Maximum Likelihood Estimate of theta for a given eta

Examples

mle_eep(5,2,5)

Analytical solution of theta given eta in EIGP model.

Description

This function provides the analytical solution of theta for given eta EIGP model.

Usage

mle_eigp(s, m, n)

Arguments

s

a numeric value the sum of log(1/x_i^eta), where i is from 1 to m.

m

m is the number of data items less than the density change point.

n

n is the sample size, n has to be greater than m.

Details

mle_eigp

Value

This function returns the Maximum Likelihood Estimate of theta for a given eta

Examples

mle_eigp(5,2,5)

Iteration function to find the analytical solution of theta given eta and data in EEP model.

Description

This function finds the analytical solution of theta given eta and data in EEP model.

Usage

mle_iter_eep(data, eta)

Arguments

data

n by 1 vector with all positive entries.

eta

The exponent parameter. This value is greater than 0.

Details

mle_iter_eep

Value

This function returns the Maximum Likelihood Estimate of theta for a given eta with data.

Examples

mle_iter_eep(seq(1:100),2)

Iteration function to find the analytical solution of theta given eta and data in EIGP model.

Description

This function finds the analytical solution of theta given eta and data in EIGP model.

Usage

mle_iter_eigp(data, eta)

Arguments

data

n by 1 vector with all positive entries.

eta

The exponent parameter. This value is greater than 0.

Details

mle_iter_eigp

Value

This function returns the Maximum Likelihood Estimate of theta for a given eta with data.

Examples

mle_iter_eigp(seq(1:100),2)

The grid search procedure for parameter estimation of EEP.

Description

This function find the parameter estimates of EEP throgh a grid search procedure.

Usage

mle_search_eep(eta_seq = seq(0.5, 10, by = 0.01), data)

Arguments

eta_seq

A predefined range for eta values. The default is c(0.5,10,by = 0.01)

data

n by 1 vector with all positive entries.

Details

mle_search_eep

Value

This function returns a data frame as the parameter estimates for EEP from grid search methods.

Examples

sample1 = eep_sampling(1000,eta = 2,theta = 3)
mle_search_eep(data = sample1)

The grid search procedure for parameter estimation of EIGP.

Description

This function find the parameter estimates of EIGP through a grid search procedure.

Usage

mle_search_eigp(eta_seq = seq(0.5, 10, by = 0.01), data)

Arguments

eta_seq

A predefined range for eta values. The default is c(0.5,10,by = 0.01)

data

n by 1 vector with all positive entries.

Details

mle_search_eigp

Value

This function returns data frame as the parameter estimates for EIGP from grid search methods.

Examples

sample1 = eigp_sampling(1000,eta = 2,theta = 3)
mle_search_eigp(data = sample1)

The negative log likelihood function for EEP distribution.

Description

This function computes the negative log-likelihood for EEP distribution.

Usage

neg_log_eep(y, theta, eta)

Arguments

y

n by 1 vector with all positive entries.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

neg_log_eigp

Value

This function return the negative log density of a sample item if if it follows Pareto in a EEP model.

Examples

neg_log_eep(seq(1:100),2,2)

The negative log likelihood function for EIGP distribution.

Description

This function computes the negative log-likelihood for EIGP distribution.

Usage

neg_log_eigp(y, theta, eta)

Arguments

y

n by 1 vector with all positive entries.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

neg_log_eigp

Value

This function return the negative log density of a sample item if if it follows Pareto in a EIGP model.

Examples

neg_log_eigp(seq(1:100),2,2)

The negative log density of a sample item if it follows Pareto in a EEP model

Description

This function return the negative log density of a sample item if if it follows Pareto in a EEP model.

Usage

pareto_eep(x, theta, eta)

Arguments

x

The value of a sample item.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

pareto_eep

Value

This function return the negative log density of a sample item if if it follows Pareto in a EEP model.

Examples

pareto_eep(10,5,2)

The negative log density of a sample item if it follows Pareto in a EIGP model

Description

This function return the negative log density of a sample item if if it follows Pareto in a EIGP model.

Usage

pareto_eigp(x, theta, eta)

Arguments

x

The value of a sample item.

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

Details

pareto_eigp

Value

This function return the negative log density of a sample item if if it follows Pareto in a EIGP model.

Examples

pareto_eigp(10,5,2)

The probability function of EEP.

Description

pdf_eep

Usage

pdf_eep(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the density of EEP

Examples

pdf_eep(1,2,5)

The probability density function of EIGP.

Description

pdf_eigp

Usage

pdf_eigp(theta, eta, data)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

data

The data item.

Value

Return the density of EIGP

Examples

pdf_eigp(1,2,5)

The quantile function of EEP.

Description

q_eep

Usage

q_eep(theta, eta, p)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

p

This indicates the p-th percentile. p is greater than 0 and less than 100.

Value

Return the p-th percentile of EEP.

Examples

q_eigp(1,2,5)

The quantile function of EIGP.

Description

q_eigp

Usage

q_eigp(theta, eta, p)

Arguments

theta

The location parameter for the base distribution (eta = 1). The value needs to be positive.

eta

The exponent parameter. The value provided needs to be positive.

p

This indicates the p-th percentile. p is greater than 0 and less than 100.

Value

Return the p-th percentile of EIGP.

Examples

q_eigp(1,2,5)

The optimization function for EEP maximum likelihood estimation.

Description

This function serves as the optimization function for EEP at different locations of density change points.

Usage

raw_est_eep(data, init = c(1, 1), lower_bound = c(0.01, 0.01))

Arguments

data

a n by 1 vector with all positive entries.

init

a 2 by 1 vector serves as the initial values of the model parameters. The default is c(1,1).

lower_bound

a 2 by 1 vector serves as the lower bound of the parameters. The default is c(0.01,0.01).

Details

raw_est_eep

x is a 2 by 1 vector; m denotes the number of data items less than the density change point; data is a n by 1 vector, where n denotes the sample size of the data.

Value

a n-1 by 2 matrix with estimates of theta and eta for n-1 different locations of density change points (1st column for theta, 2nd column for eta).

Examples

raw_est_eep(seq(1:100))

The optimization function for EIGP maximum likelihood estimation.

Description

This function serves as the optimization function for EIGP at different locations of density change points.

Usage

raw_est_eigp(data, init = c(1, 1), lower_bound = c(0.01, 0.01))

Arguments

data

a n by 1 vector with all positive entries.

init

a 2 by 1 vector serves as the initial values of the model parameters. The default is c(1,1).

lower_bound

a 2 by 1 vector serves as the lower bound of the parameters. The default is c(0.01,0.01).

Details

raw_est_eigp

x is a 2 by 1 vector; m denotes the number of data items less than the density change point; data is a n by 1 vector, where n denotes the sample size of the data.

Value

a n-1 by 2 matrix with estimates of theta and eta for n-1 different locations of density change points (1st column for theta, 2nd column for eta).

Examples

raw_est_eigp(seq(1:100))

The function for calculating the standard errors of the parameters of EEP model.

Description

This function find the parameter estimates of EEP through a grid search procedure.

Usage

se_eep(data, theta, eta)

Arguments

data

n by 1 vector with all positive entries.

theta

the MLE of theta

eta

the MLE of eta

Details

se_eep

Value

The estimate of SE for theta and eta

Examples

sample1 = eep_sampling(1000,eta = 2,theta = 3)
theta = mle_search_eep(data = sample1)$theta
eta = mle_search_eep(data = sample1)$eta
se_eep(sample1,theta,eta)

The function for calculating the standard errors of the parameters of EIGP model.

Description

This function find the parameter estimates of EIGP through a grid search procedure.

Usage

se_eigp(data, theta, eta)

Arguments

data

n by 1 vector with all positive entries.

theta

the MLE of theta

eta

the MLE of eta

Details

se_eigp

Value

The estimate of SE for theta and eta

Examples

sample1 = eigp_sampling(1000,eta = 2,theta = 3)
theta = mle_search_eigp(data = sample1)$theta
eta = mle_search_eigp(data = sample1)$eta
se_eigp(sample1,theta,eta)

The validation function for model parameters.

Description

This function checks if the estimates from raw_est_eigp or raw_est_eep satisfy the pre-defined conditions for the parameters.

Usage

validation(data, estimate)

Arguments

data

a n by 1 vector with all positive entries.

estimate

a data frame with 2 columns named 'theta' and 'eta'.

Details

validation

Value

a n-1 by 1 Boolean vector.

Examples

estimate = raw_est_eigp(seq(1:100),init = c(1,1),lower_bound = c(0.01,0.01))
estimate = data.frame(estimate)
colnames(estimate) = c('theta','eta')
validation(seq(1:100),estimate)