# Introduction to TLCAR

This vignette provides an overview of the “TLCAR” Package. The package TLCAR offers a powerful range of statistical tools for analysis,simulation, and computation based on the Topp-Leone Cauchy Rayleigh distribution (TLCAR). This distribution, which combines the properties of the Topp-Leone, Cauchy, and Rayleigh distributions,is particularly useful for modeling complex, heterogeneous data present in many scientific disciplines. With the “TLCAR” package, users can estimate the parameters of the TLCAR distribution from datasets, generate random samples according to this distribution, plot histograms and density functions, and calculate specific quantiles.

## Installation

You can install the “TLCAR” package from CRAN using the following command:

install.packages("ggplot2")
install.packages("dplyr")
install.packages("TLCAR")

library(stats)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
##     filter, lag
## The following objects are masked from 'package:base':
##
##     intersect, setdiff, setequal, union
library(ggplot2)
library(TLCAR)

## Overview of TLCAR Distribution

The TLCAR distribution is particularly useful for modeling data with heavy tails, skewness, and positive values. It is a versatile distribution that can handle diverse characteristics in the data.

## Probability Density Function (PDF) for TLCAR distribution

The probability density function (PDF) for the TLCAR distribution is given by the formula:

$f(x;\nu)=\frac{2\alpha}{\pi a} \times \left[\frac{1+\left(\frac{x^2}{\theta^2}-1\right)e^{-\frac{x^2}{2\theta^2}}+m}{1+\left(\frac{x\left(1-e^{-\frac{x^2}{2\theta^2}}+m\right) -b}{a}\right)^2}\right] \times\left[\frac{1}{2}-\frac{1}{\pi}\arctan\frac{x\left(1-e^{-\frac{x^2}{2\theta^2}}+m\right) -b}{a}\right] \times \left[ 1-\left(\frac{1}{2}-\frac{1}{\pi}\arctan\frac{x\left(1-e^{-\frac{x^2}{2\theta^2}}+m\right)-b}{a}\right)^2\right]^{\alpha-1}$ where $$\alpha$$ , $$a$$ , $$\theta$$ , $$m$$ > 0 .

## Example 1

Let’s calculate the PDF for $$x=1$$ , $$\alpha=1$$ , $$a=1$$ , $$b=0$$ , $$\theta=2$$ and $$m=1$$

dTLCAR(x = 1, alpha = 1, a = 1, b = 0, theta = 2, m=1)
## [1] 0.08801882

## Example 2

Let’s calculate the PDF for $$x=3$$ , $$\alpha=2$$ , $$a=1$$ , $$b=2$$ , $$\theta=2$$ and $$m=4$$

dTLCAR(x = 3, alpha = 2, a = 1, b = 2, theta = 2, m=4)
## [1] 0.001247268

## Cumulative Distribution Function (CDF) for TLCAR distribution

The cumulative distribution function (CDF) for the TLCAR distribution is given by the formula:

$F(x;\nu)=\left[ 1-\left(\frac{1}{2}-\frac{1}{\pi}\arctan\frac{x\left(1-e^{-\frac{x^2}{2\theta^2}}+m\right) -b}{a}\right)^2\right]^\alpha$

where $$\alpha$$ , $$a$$ , $$\theta$$ , $$m$$ > 0 .

## Example 1

Let’s calculate the CDF for $$x=1$$ , $$\alpha=1$$ , $$a=1$$ , $$b=0$$ , $$\theta=2$$ and $$m=1$$

cTLCAR(x = 1, alpha = 1, a = 1, b = 0, theta = 2,m=1)
## [1] 0.9460113

## Example 2

Let’s calculate the CDF for $$x=3$$ , $$\alpha=2$$ , $$a=1$$ , $$b=2$$ , $$\theta=2$$ and $$m=4$$

cTLCAR(x = 3, alpha = 2, a = 1, b = 2, theta = 2,m=4)
## [1] 0.9986058

## Graphical Plot of the TLCAR Distribution

This function generates a graphical plot of the probability density function (PDF) or cumulative distribution function (CDF) for the TLCAR distribution.

## Example

Let’s plot the PDF for a range of values with parameters $$\alpha=1$$ , $$a=1$$ , $$b=0$$ , $$\theta=2$$ and $$m=1$$

ploTLCAR(x = seq(-4, 10, by = 0.1), alpha = 1, a = 1,b=0, theta = 2,m=1, type = "pdf")

Let’s plot the CDF for a range of values with parameters $$\alpha=1$$ , $$a=1$$ , $$b=0$$ , $$\theta=2$$ and $$m=1$$

ploTLCAR(x = seq(-4, 10, by = 0.1), alpha = 1, a = 1,b=0, theta = 2, m=1,type = "cdf")

## Quantile function for TLCAR distribution

The quantile function calculates the quantile value for a given probability using the TLCAR distribution.

## Example 1

Let’s calculate the 0.5 quantile (median) using parameters $$\alpha=1$$ , $$a=1$$ , $$b=0$$ ,$$\theta=2$$ and $$m=1$$

qTLCAR(p = 0.5, alpha = 1, a = 1, b= 0, theta = 2,m=1)
## [1] -0.7166792

## Example 2

Let’s calculate the 0.75 quantile using parameters $$\alpha=2$$ , $$a=2$$ , $$b=1$$ ,$$\theta=2$$ and $$m=2$$

qTLCAR(p = 0.75, alpha = 2, a = 2, b= 1, theta = 2,m=2)
## [1] 0.9037692

## Generate random samples from the TLCAR distribution

This function generates random samples from the TLCAR distribution using the Box-Muller algorithm.

## Example 1

Let’s generate 25 random samples with parameters $$\alpha=1$$ , $$a=1$$ , $$b=0$$ ,$$\theta=2$$ and $$m=1$$

rTLCAR(n = 25, alpha = 1, a = 2, b = 0, theta = 2,m=1)
##  [1]  -0.7025289  -1.0591749   1.9324451  -0.3384789   2.0136376   0.8894991
##  [7]  -4.6530735  -0.6864125  -0.5854632   0.0678766  -0.7867331 -45.4280152
## [13]  -1.6517409  -3.9558302   0.4378498 -16.5788655  -1.2367879  -2.1140315
## [19]   1.7325325  -3.9671058  -2.8861827  -1.5670429  -3.3882363 -10.3419322
## [25]   1.4776296

## Example 2

Let’s generate 50 random samples with parameters $$\alpha=2$$ , $$a=2$$ , $$b=1$$ ,$$\theta=2$$ and $$m=2$$

rTLCAR(n = 50, alpha = 2, a = 2, b = 1, theta = 2,m=2)
##  [1] -0.3367058  1.7285812  1.1875268  0.4120580  1.0581625  0.3990519
##  [7]  1.0071567  2.1849633  2.3598769  0.2319956 -0.5748939  1.0236759
## [13]  0.1246406  0.5529991 -1.2433635  0.3173053 -1.3641320 -0.7273208
## [19]  1.9033033  1.5304993  1.0602287 -0.6917317  0.6620348  1.3377633
## [25]  0.3161296  0.3535551  0.1526248  0.3199435  1.1434471 -1.5357639
## [31]  0.7347157  0.5214707  0.1937358  0.8818820 -0.8341408  0.8520853
## [37]  0.2262596  0.1394313  0.5857642  0.6400057 -1.3768247 -1.0428210
## [43]  0.8939435  0.5473589 -1.7624686 -0.6047640 -0.4882200  0.2529339
## [49] -2.8642775 -0.4241723

## Estimate parameters with constraints

This function estimates the parameters of the TLCAR distribution while respecting constraints on the parameters.

## Example 1

Let’s estimate parameters from a sample data vector.

data(ConductorFailureTimes)
fTLCAR(ConductorFailureTimes)
## [1]  3.017587  3.495700 13.258842  1.696800  1.000000

## Example 2

data(Tree_diameters)
fTLCAR(Tree_diameters)
## [1]  3.447945  6.540533 26.392380  1.000000  1.000000

## Estimate parameters with constraints and plot histogram with estimated density

This function estimates parameters and plots the histogram of the data along with the estimated density curve.

## Example 1

sTLCAR(ConductorFailureTimes)

## Example 2

sTLCAR(Tree_diameters)

This concludes the overview of the “TLCAR” package and its functionalities for working with the Topp-Leone Cauchy Rayleigh distribution.

## References

Atchadé, M.N., Bogninou, M.J., Djibril, A.M. et al. Topp-Leone Cauchy Family of Distributions with Applications in Industrial Engineering. J Stat Theory Appl 22, 339–365 (2023). https://doi.org/10.1007/s44199-023-00066-4