Learn R Programming

RelDists (version 1.0.0)

myOW_region: Custimized region search for odd Weibull distribution

Description

This function can be used to modify OW gamlss.family object in order to set a customized region search for gamlss() function.

Usage

myOW_region(family = OW, valid.values = "auto", initVal)

Value

Returns a gamlss.family object which can be used to fit an OW distribution in the gamlss() function.

Arguments

family

The OW family. This arguments allows the user to modify input arguments of the family, like the link functions.

valid.values

a list of character elements specifying the region for sigma and/or nu. See Details and Examples section to learn about its use.

initVal

An initValOW object generated with initValuesOW function.

Author

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

Details

This function was created to help users to fit OW distribution easily bounding the parametric space for sigma and nu.

The valid.values must be defined as a list of characters containing a call of the all function.

Examples

Run this code
# Example 1
# Generating some random values with
# known mu, sigma and nu
y <- rOW(n=200, mu=0.2, sigma=4, nu=0.05)

# Custom search region
myvalues <- list(sigma="all(sigma > 1)",
                 nu="all(nu < 1) & all(nu < 1)")

my_initial_guess <- initValuesOW(formula=y~1)
summary(my_initial_guess)

# OW family modified with 'myOW_region'
require(gamlss)
myOW <- myOW_region(valid.values=myvalues, initVal=my_initial_guess)
mod1 <- gamlss(y~1, sigma.fo=~1, nu.fo=~1, 
               sigma.start=param.startOW('sigma', my_initial_guess), 
               nu.start=param.startOW('nu', my_initial_guess),
               control=gamlss.control(n.cyc=300, trace=FALSE),
               family=myOW)

exp(coef(mod1, what='mu'))
exp(coef(mod1, what='sigma'))
exp(coef(mod1, what='nu'))

# Example 2
# Same example using another link function and using 'myOW_region'
# in the argument 'family'
mod2 <- gamlss(y~1, sigma.fo=~1, nu.fo=~1, 
               sigma.start=2, nu.start=0.1,
               control=gamlss.control(n.cyc=300, trace=FALSE),
               family=myOW_region(family=OW(sigma.link='identity'),
                                  valid.values=myvalues,
                                  initVal=my_initial_guess))

exp(coef(mod2, what='mu'))
coef(mod2, what='sigma')
exp(coef(mod2, what='nu'))

Run the code above in your browser using DataLab