The function FWE()
defines the Flexible Weibull distribution, a two parameter
distribution, for a gamlss.family
object to be used in GAMLSS fitting
using the function gamlss()
.
Value
Returns a gamlss.family object which can be used to fit a FWE distribution in the gamlss()
function.
Details
The Flexible Weibull extension with parameters mu
and sigma
has density given by
\(f(x) = (\mu + \sigma/x^2) exp(\mu x - \sigma/x) exp(-exp(\mu x-\sigma/x))\)
for x>0.
Examples
# Example 1
# Generating some random values with
# known mu and sigma
y <- rFWE(n=100, mu=0.75, sigma=1.3)
# Fitting the model
require(gamlss)
mod <- gamlss(y~1, sigma.fo=~1, family="FWE")
#> GAMLSS-RS iteration 1: Global Deviance = 143.188
#> GAMLSS-RS iteration 2: Global Deviance = 142.9185
#> GAMLSS-RS iteration 3: Global Deviance = 142.8914
#> GAMLSS-RS iteration 4: Global Deviance = 142.888
#> GAMLSS-RS iteration 5: Global Deviance = 142.8875
# Extracting the fitted values for mu and sigma
# using the inverse link function
exp(coef(mod, what="mu"))
#> (Intercept)
#> 0.8663081
exp(coef(mod, what="sigma"))
#> (Intercept)
#> 1.558488
# Example 2
# Generating random values under some model
n <- 200
x1 <- runif(n)
x2 <- runif(n)
mu <- exp(1.21 - 3 * x1)
sigma <- exp(1.26 - 2 * x2)
y <- rFWE(n=n, mu=mu, sigma=sigma)
mod <- gamlss(y~x1, sigma.fo=~x2, family=FWE)
#> GAMLSS-RS iteration 1: Global Deviance = 2522.512
#> GAMLSS-RS iteration 2: Global Deviance = 1393.345
#> GAMLSS-RS iteration 3: Global Deviance = 631.842
#> GAMLSS-RS iteration 4: Global Deviance = 308.8378
#> GAMLSS-RS iteration 5: Global Deviance = 308.3761
#> GAMLSS-RS iteration 6: Global Deviance = 308.3006
#> GAMLSS-RS iteration 7: Global Deviance = 308.2873
#> GAMLSS-RS iteration 8: Global Deviance = 308.285
#> GAMLSS-RS iteration 9: Global Deviance = 308.2846
coef(mod, what="mu")
#> (Intercept) x1
#> 1.253865 -3.050367
coef(mod, what="sigma")
#> (Intercept) x2
#> 1.254222 -2.057288