# weibullg: Weibull G distribution In MPS: Estimating Through the Maximum Product Spacing Approach

## Description

Computes the pdf, cdf, quantile, and random numbers, draws the q-q plot, and estimates the parameters of the Weibull G distribution. General form for the probability density function (pdf) of the Weibull G distribution due to Alzaatreh et al. (2013) is given by

f(x,{Θ}) = \frac{a}{{{b^a}}}\frac{{g(x-μ,θ )}}{{1 - G(x-μ,θ )}}{≤ft[ { - \log ≤ft( {1 - G(x-μ,θ )} \right)} \right]^{a - 1}}{e^{ - {{≤ft( {\frac{{ - \log ≤ft( {1 - G(x-μ,θ )} \right)}}{b}} \right)}^a}}},

where θ is the baseline family parameter vector. Also, a>0, b>0, and μ are the extra parameters induced to the baseline cumulative distribution function (cdf) G whose pdf is g. The general form for the cumulative distribution function (cdf) of the Weibull G distribution is given by

F(x,{Θ}) = 1 - {e^{ - {{≤ft( {\frac{{ - \log ≤ft( {1 - G(x-μ,θ )} \right)}}{b}} \right)}^a}}}.

The weibullg is the special case (Weibull-X) of the Alzaatreh et al. (2013) families of distributions. Here, the baseline G refers to the cdf of famous families such as: Birnbaum-Saunders, Burr type XII, Exponential, Chen, Chisquare, F, Frechet, Gamma, Gompertz, Linear failure rate (lfr), Log-normal, Log-logistic, Lomax, Rayleigh, and Weibull. The parameter vector is Θ=(a,b,θ,μ) where θ is the baseline G family's parameter space. If θ consists of the shape and scale parameters, the last component of θ is the scale parameter (here, a and b are the first and second shape parameters). Always, the location parameter μ is placed in the last component of Θ.

## Usage

 1 2 3 4 5 6 dweibullg(mydata, g, param, location = TRUE, log=FALSE) pweibullg(mydata, g, param, location = TRUE, log.p = FALSE, lower.tail = TRUE) qweibullg(p, g, param, location = TRUE, log.p = FALSE, lower.tail = TRUE) rweibullg(n, g, param, location = TRUE) qqweibullg(mydata, g, location = TRUE, method) mpsweibullg(mydata, g, location = TRUE, method, sig.level) 

## Arguments

 g The name of family's pdf including: "birnbaum-saunders", "burrxii", "chisq", "chen", "exp", "f", "frechet", "gamma", "gompetrz", "lfr", "log-normal", "log-logistic", "lomax", "rayleigh", and "weibull". p a vector of value(s) between 0 and 1 at which the quantile needs to be computed. n number of realizations to be generated. mydata Vector of observations. param parameter vector Θ=(a,b,θ,μ) location If FALSE, then the location parameter will be omitted. log If TRUE, then log(pdf) is returned. log.p If TRUE, then log(cdf) is returned and quantile is computed for exp(-p). lower.tail If FALSE, then 1-cdf is returned and quantile is computed for 1-p. method The used method for maximizing the sum of log-spacing function. It will be "BFGS", "CG", "L-BFGS-B", "Nelder-Mead", or "SANN". sig.level Significance level for the Chi-square goodness-of-fit test.

## Details

It can be shown that the Moran's statistic follows a normal distribution. Also, a chi-square approximation exists for small samples whose mean and variance approximately are m(log(m)+0.57722)-0.5-1/(12m) and m(π^2/6-1)-0.5-1/(6m), respectively, with m=n+1, see Cheng and Stephens (1989). So, a hypothesis tesing can be constructed based on a sample of n independent realizations at the given significance level, indicated in above as sig.level.

## Value

1. A vector of the same length as mydata, giving the pdf values computed at mydata.

2. A vector of the same length as mydata, giving the cdf values computed at mydata.

3. A vector of the same length as p, giving the quantile values computed at p.

4. A vector of the same length as n, giving the random numbers realizations.

5. A sequence of goodness-of-fit statistics such as: Akaike Information Criterion (AIC), Consistent Akaike Information Criterion (CAIC), Bayesian Information Criterion (BIC), Hannan-Quinn information criterion (HQIC), Cramer-von Misses statistic (CM), Anderson Darling statistic (AD), log-likelihood statistic (log), and Moran's statistic (M). The Kolmogorov-Smirnov (KS) test statistic and corresponding p-value. The Chi-square test statistic, critical upper tail Chi-square distribution, related p-value, and the convergence status.

Mahdi Teimouri

## References

Cheng, R. C. H. and Stephens, M. A. (1989). A goodness-of-fit test using Moran's statistic with estimated parameters, Biometrika, 76 (2), 385-392.

Alzaatreh, A., Lee, C., and Famoye, F. (2013). A new method for generating families of continuous distributions, Metron, 71, 63-79.

## Examples

 1 2 3 4 5 6 7 mydata<-rweibull(100,shape=2,scale=2)+3 dweibullg(mydata, "weibull", c(1,1,2,2,3)) pweibullg(mydata, "weibull", c(1,1,2,2,3)) qweibullg(runif(100), "weibull", c(1,1,2,2,3)) rweibullg(100, "weibull", c(1,1,2,2,3)) qqweibullg(mydata, "weibull", TRUE, "Nelder-Mead") mpsweibullg(mydata, "weibull", TRUE, "Nelder-Mead", 0.05) 

### Example output

  [1] 0.345913813 0.363189362 0.329089832 0.426084896 0.140857362 0.352491250
[7] 0.375305672 0.325512807 0.398342395 0.285243363 0.390873407 0.390452550
[13] 0.415761329 0.039844420 0.260921819 0.351052606 0.406710887 0.406834093
[19] 0.404523995 0.427925852 0.405300377 0.426743613 0.011118852 0.385988484
[25] 0.131830171 0.176904173 0.005032580 0.405034099 0.282591618 0.428675102
[31] 0.318072197 0.418144815 0.229805449 0.112644906 0.163155801 0.076808898
[37] 0.424755146 0.424832027 0.220775513 0.427938306 0.242602551 0.354461968
[43] 0.165269458 0.426727760 0.270069405 0.391697299 0.264643231 0.365614737
[49] 0.348513394 0.082683538 0.391083317 0.154299343 0.422602035 0.426907476
[55] 0.101490569 0.412655517 0.258078944 0.382699134 0.353891993 0.250227899
[61] 0.102748797 0.396012903 0.241185391 0.289749226 0.303116574 0.374803674
[67] 0.152462438 0.325504423 0.395425406 0.202280112 0.428599353 0.402530478
[73] 0.375505642 0.051895472 0.085290146 0.121262998 0.368171225 0.105657002
[79] 0.162347606 0.428870225 0.007145067 0.426297253 0.394476366 0.418155048
[85] 0.355446205 0.332006298 0.404290337 0.307920464 0.342696207 0.210046505
[91] 0.423328546 0.427779195 0.240510732 0.372712370 0.425481539 0.428639501
[97] 0.416516438 0.261265050 0.380161719 0.428202471
[1] 0.153934194 0.176927253 0.700135965 0.345191649 0.909022877 0.661168072
[7] 0.195635887 0.705657632 0.240473132 0.094459958 0.224179299 0.223320816
[13] 0.290935016 0.979833662 0.791671366 0.663726376 0.261809043 0.535215824
[19] 0.255839508 0.365066210 0.257922392 0.436771196 0.995186774 0.592758927
[25] 0.017855517 0.878043176 0.997979593 0.257203662 0.765262878 0.380199053
[31] 0.716831011 0.491637998 0.826306341 0.931134644 0.890234957 0.005952688
[37] 0.453859442 0.453286704 0.835727671 0.365250236 0.812488043 0.164844956
[43] 0.888391509 0.351021466 0.083100662 0.225876699 0.079298887 0.180477253
[49] 0.668183990 0.006908039 0.224609633 0.024719825 0.468195482 0.435062233
[55] 0.939382021 0.514657193 0.074870540 0.208437127 0.658653648 0.803978033
[61] 0.938465598 0.235159097 0.814046343 0.098054313 0.738142894 0.617858218
[67] 0.899393511 0.705670456 0.568945567 0.043761616 0.409103556 0.250659851
[73] 0.616363056 0.972644231 0.007355430 0.924571786 0.184318928 0.936333910
[79] 0.890936912 0.390301766 0.997038826 0.347032680 0.231775070 0.491590318
[85] 0.655835820 0.137812189 0.255220105 0.731452930 0.678133402 0.846588694
[91] 0.325885759 0.424473759 0.814785684 0.191414803 0.448218617 0.407946077
[97] 0.293815565 0.791268856 0.606189840 0.369493035
[1] 6.453607 6.007979 5.875472 4.008208 5.117213 6.610387 4.522933 3.220615
[9] 4.223267 4.417851 4.482891 5.568355 3.663580 6.082467 4.916844 3.651488
[17] 6.133415 7.047615 4.211709 7.616759 5.872884 4.542905 5.160267 3.693859
[25] 3.858860 3.542363 6.590058 3.753990 5.424176 3.577281 3.624988 3.737557
[33] 5.579797 4.717505 4.916493 3.574422 6.574434 3.961557 5.816629 5.853531
[41] 4.951157 4.257338 4.172995 5.783357 4.721678 4.750020 4.033493 6.279091
[49] 4.095713 7.003943 5.471335 5.523233 4.764873 4.365391 5.538785 6.766458
[57] 3.521428 4.352081 6.920815 3.488094 4.598936 5.797539 5.598423 7.244688
[65] 4.201068 5.802193 4.293147 5.702553 3.356075 4.506663 5.916382 4.281489
[73] 6.314622 3.871958 5.631829 7.071527 3.505786 3.822311 5.667040 6.592542
[81] 4.531592 4.657563 4.293270 5.340577 3.993954 5.351681 3.222645 4.286188
[89] 5.504274 5.250811 5.860669 3.215117 4.285213 5.185349 4.137217 4.294487
[97] 4.649973 4.674662 4.463754 3.406922
[1] 3.952373 5.397195 5.002479 7.246061 7.176680 5.796055 3.633050 3.531735
[9] 4.548779 3.594165 6.276442 3.942073 3.425946 4.690082 4.435994 4.006722
[17] 3.975698 3.457412 5.774909 5.307288 4.584616 5.356456 4.368828 5.258830
[25] 3.547571 3.535907 5.761937 4.449581 6.154290 4.496187 3.753101 4.595541
[33] 4.753010 5.195095 4.636428 5.549081 4.462310 4.414657 4.342581 6.069102
[41] 4.195602 4.547133 4.172558 4.801104 3.897752 4.840281 4.610415 4.160735
[49] 6.076615 5.277281 3.889327 5.388579 3.041473 5.838028 3.652965 4.260704
[57] 4.821846 3.781543 5.314722 4.172734 4.475418 6.084376 3.476884 7.057604
[65] 3.341815 3.449209 4.813992 3.325747 3.891978 3.063834 4.812112 3.548539
[73] 5.335866 4.253246 3.630906 3.776014 4.837788 3.327945 3.616602 4.193932
[81] 5.020793 4.288765 5.376149 5.506882 4.949877 4.894868 4.827595 4.277112
[89] 5.321623 5.448304 3.999249 5.654522 5.830773 3.897887 4.146216 5.324807
[97] 3.480765 3.711803 4.129332 5.289965
$MPS [1] 1.185517 1.032126 1.487386 1.986438 2.993944$Measures
AIC     CAIC      BIC     HQIC         CM        AD       log    Moran
281.315 281.9533 294.3409 286.5868 0.06314008 0.4231055 -135.6575 531.3379

$KS statistic p-value 0.06797165 0.744682$chi-square
statistic chi-value p-value
117.4369  124.3421 0.11231

\$Convergence Status
[,1]
[1,] "Algorithm Converged"


MPS documentation built on Oct. 5, 2019, 1:04 a.m.