param.startOW: Initial values extraction for Odd Weibull distribution

View source: R/param.startOW.R

param.startOWR Documentation

Initial values extraction for Odd Weibull distribution

Description

This function can be used to extract initial values found with empirical time on test transform (TTT) through initValuesOW function. This is used for parameter estimation in OW distribution.

Usage

param.startOW(param, initValOW)

Arguments

param

a character used to specify the parameter required. It can take the values "sigma" or "nu".

initValOW

an initValOW object generated with initValuesOW function.

Details

This function just gets initial values computed with initValuesOW for OW family. It must be called in sigma.start and nu.start arguments from gamlss function. This function is useful only if user want to set start values automatically with TTT plot. See example for an illustration.

Value

A length-one vector numeric value corresponding to the initial value of the parameter specified in param extracted from a initValuesOW object specified in the initValOW input argument.

Author(s)

Jaime Mosquera GutiƩrrez jmosquerag@unal.edu.co

Examples

# Random data generation (OW distributed)
y <- rOW(n=500, mu=0.05, sigma=0.6, nu=2)

# Initial values with TTT plot
iv <- initValuesOW(formula = y ~ 1)
summary(iv)

# This data is from unimodal hazard
# See TTT estimate from sample
plot(iv, legend_options=list(pos=1.03))

# See the true hazard
curve(hOW(x, mu=0.05, sigma=0.6, nu=2), to=100, lwd=3, ylab="h(x)")

# Finally, we fit the model
require(gamlss)
con.out <- gamlss.control(n.cyc = 300, trace = FALSE)
con.in <- glim.control(cyc = 300)

(sigma.start <- param.startOW("sigma", iv))
(nu.start <- param.startOW("nu", iv))

mod <- gamlss(y~1, sigma.fo=~1, nu.fo=~1, control=con.out, i.control=con.in,
              family=myOW_region(OW(sigma.link="identity", nu.link="identity"),
                                 valid.values="auto", iv),
              sigma.start=sigma.start, nu.start=nu.start)

# Estimates are close to actual values
(mu <- exp(coef(mod, what = "mu")))
(sigma <- coef(mod, what = "sigma"))
(nu <- coef(mod, what = "nu"))
  

ousuga/RelDists documentation built on Jan. 12, 2023, 10:27 p.m.