The Power Generalised Weibull Distribution

The Power Generalised Weibull (PGW) distribution (Nikulin and Haghighi 2009) is a three-parameter distribution with support on \({\mathbb R}_+\). The corresponding hazard function can accomodate bathtub, unimodal and monotone (increasing and decreasing) hazard shapes. The PGW distribution has become popular in survival analysis given the tractability of its hazard and survival functions. Other flexible distributions that can account for these hazard shapes are discussed in Rubio et al. (2019) and Jones and Noufaily (2015). See also The Exponentiated Weibull distribution and Simulating survival times from a General Hazard structure with a flexible baseline hazard.

Probability Density Function

The pdf of the PGW distribution is \[f(t;\sigma,\nu,\gamma) = \dfrac{\nu}{\gamma \sigma^\nu}t^{\nu-1} \left[ 1 + \left(\dfrac{t}{\sigma}\right)^\nu\right]^{\left(\frac{1}{\gamma}-1\right)} \exp\left\{ 1- \left[ 1 + \left(\dfrac{t}{\sigma}\right)^\nu\right]^{\frac{1}{\gamma}} \right\},\] where \(\sigma>0\) is a scale parameter, and \(\nu,\gamma >0\) are shape parameters.

Survival Function

The survival function of the PGW distribution is \[S(t;\sigma,\nu,\gamma) = \exp\left\{ 1- \left[ 1 + \left(\dfrac{t}{\sigma}\right)^\nu\right]^{\frac{1}{\gamma}} \right\}.\]

Hazard Function

The hazard function of the PGW distribution is \[h(t;\sigma,\nu,\gamma) = \dfrac{\nu}{\gamma \sigma^\nu}t^{\nu-1} \left[ 1 + \left(\dfrac{t}{\sigma}\right)^\nu\right]^{\left(\frac{1}{\gamma}-1\right)}.\] The cdf can be obtained as \(F(t;\sigma,\nu,\gamma)=1-S(t;\sigma,\nu,\gamma)\), and the cumulative hazard function as \(H(t;\sigma,\nu,\gamma) = -\log S(t;\sigma,\nu,\gamma)\), as usual.

Quantile Function

The quantile function of the PGW distribution is \[Q(p;\sigma,\nu,\gamma) = \sigma \left[ \left( 1 - \log(1-p) \right)^{\gamma} - 1 \right]^{\frac{1}{\nu}},\] where \(p\in(0,1)\).

The following R code shows the implementation of the pdf, survival function, hazard function, cumulative hazard function, quantile function, and random number generation associated to the PGW distribution. Some illustrative examples are also presented.

R functions

# sigma   : scale parameter
# nu      : shape parameter
# gamma   : shape parameter
# t       : positive argument   
# p       : probability (0,1)
# n       : number of simulations

# Probability Density Function
dpgw <- function(t, sigma, nu, gamma, log = FALSE){
val <- log(nu) - log(gamma) - nu*log(sigma) + (nu-1)*log(t) + 
       (1/gamma - 1)*log( 1 + (t/sigma)^nu ) + 
       ( 1 - ( 1 + (t/sigma)^nu )^(1/gamma) )
  if(log) return(val) else return(exp(val))
}

# PGW Survival Function
spgw <- function(t, sigma, nu, gamma, log.p = FALSE){
  val <- 1 - ( 1 + (t/sigma)^nu )^(1/gamma)
  if(log.p) return(val) else return(exp(val))
}

# PGW Hazard Function
hpgw <- function(t, sigma, nu, gamma, log = FALSE){
  val <- log(nu) - log(gamma) - nu*log(sigma) + (nu-1)*log(t) + 
    (1/gamma - 1)*log( 1 + (t/sigma)^nu )
  if(log) return(val) else return(exp(val))
}

# PGW Cumulative Hazard Function
chpgw <- function(t, sigma, nu, gamma){
  val <- -1 + ( 1 + (t/sigma)^nu )^(1/gamma)
  return(val) 
}

# Quantile Function
qpgw <- function(p, sigma, nu, gamma){
  out <- sigma*(  ( 1 - log(1-p) )^gamma - 1 )^(1/nu)
  return(out)
}

# Random Number Generation Function
rpgw <- function(n, sigma, nu, gamma){
  p <- runif(n)
  out <- sigma*(  ( 1 - log(1-p) )^gamma - 1 )^(1/nu)
  return(as.vector(out))
}

Examples

PDF and Random number generation

# Simulated data
sigma0 = 1; nu0 = 3; gamma0 = 2
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True pdf
true.pdf <- Vectorize(function(t) dpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
hist(sim, probability = TRUE, cex.axis = 1.5, cex.lab = 1.5, breaks = 25, main = "", xlab = "")
curve(true.pdf, 0, max(sim), lwd = 2, col = "blue", add = T)
box()

sigma0 = 1; nu0 = 0.75; gamma0 = 0.75
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True pdf
true.pdf <- Vectorize(function(t) dpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
hist(sim, probability = TRUE, cex.axis = 1.5, cex.lab = 1.5, breaks = 25, main = "", xlab = "")
curve(true.pdf, 0, max(sim), lwd = 2, col = "blue", add = T)
box()

sigma0 = 1; nu0 = 1.5; gamma0 = 0.75
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True pdf
true.pdf <- Vectorize(function(t) dpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
hist(sim, probability = TRUE, cex.axis = 1.5, cex.lab = 1.5, breaks = 25, main = "", xlab = "")
curve(true.pdf, 0, max(sim), lwd = 2, col = "blue", add = T)
box()

Some Hazard Function shapes

sigma0 = 0.75; nu0 = 1.5; gamma0 = 3
haz <- Vectorize(function(t) hpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
curve(haz,0,10, lwd = 2, col = "red", xlab = "", main = "", ylab = "Hazard Function", cex.axis = 1.5, cex.lab = 1.5, n = 250)

sigma0 = 10; nu0 = 2; gamma0 = 0.5
haz <- Vectorize(function(t) hpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
curve(haz,0,10, lwd = 2, col = "red", xlab = "", main = "", ylab = "Hazard Function", cex.axis = 1.5, cex.lab = 1.5, n = 250)

sigma0 = 5; nu0 = 2; gamma0 = 1.5
haz <- Vectorize(function(t) hpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
curve(haz,0,10, lwd = 2, col = "red", xlab = "", main = "", ylab = "Hazard Function", cex.axis = 1.5, cex.lab = 1.5, n = 250)

sigma0 = 1; nu0 = 0.75; gamma0 = 0.75
haz <- Vectorize(function(t) hpgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
curve(haz,0,10, lwd = 2, col = "red", xlab = "", main = "", ylab = "Hazard Function", cex.axis = 1.5, cex.lab = 1.5, n = 250)

CDF and Random Number Generation (vs ECDF)

# Simulated data
sigma0 = 1; nu0 = 3; gamma0 = 2
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True cdf
true.cdf <- Vectorize(function(t) 1-spgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
plot(ecdf(sim), cex.axis = 1.5, cex.lab = 1.5, main = "", xlab = "", ylab = "CDF vs ECDF")
curve(true.cdf, 0, max(sim), lwd = 2, col = "gray", add = T)
box()

sigma0 = 1; nu0 = 0.75; gamma0 = 0.75
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True cdf
true.cdf <- Vectorize(function(t) 1-spgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
plot(ecdf(sim), cex.axis = 1.5, cex.lab = 1.5, main = "", xlab = "", ylab = "CDF vs ECDF")
curve(true.cdf, 0, max(sim), lwd = 2, col = "gray", add = T)
box()

sigma0 = 1; nu0 = 1.5; gamma0 = 0.75
set.seed(123)
sim <- rpgw(n = 1000, sigma = sigma0, nu = nu0, gamma = gamma0)
# True cdf
true.cdf <- Vectorize(function(t) 1-spgw(t, sigma = sigma0, nu = nu0, gamma = gamma0))
plot(ecdf(sim), cex.axis = 1.5, cex.lab = 1.5, main = "", xlab = "", ylab = "CDF vs ECDF")
curve(true.cdf, 0, max(sim), lwd = 2, col = "gray", add = T)
box()

References

Jones, M.C., and A. Noufaily. 2015. “Log-Location-Scale-Log-Concave Distributions for Survival and Reliability Analysis.” Electronic Journal of Statistics 9 (2): 2732–50.

Nikulin, M., and F. Haghighi. 2009. “On the Power Generalized Weibull Family: Model for Cancer Censored Data.” Metron – International Journal of Statistics 67 (1): 75–86.

Rubio, F.J., L. Remontet, N.P. Jewell, and A. Belot. 2019. “On a General Structure for Hazard-Based Regression Models: An Application to Population-Based Cancer Research.” Statistical Methods in Medical Research 28: 2404–17.