the gamlss package -...
TRANSCRIPT
The gamlss PackageOctober 2, 2007
Description The main GAMLSS library and datasets.
Title Generalized Additive Models for Location Scale and Shape.
LazyLoad yes
Version 1.7-0
Date 2007-10-02
Depends R (>= 2.4.0), graphics, stats, splines, utils
Imports MASS, survival
Author Mikis Stasinopoulos <[email protected]>, Bob Rigby<[email protected]> with contributions from Calliope Akantziliotou.
Maintainer Mikis Stasinopoulos <[email protected]>
License GPL-2 | GPL-3
URL http://www.gamlss.com/
R topics documented:BB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3BCCG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5BCPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8BCT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10BE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13BEINF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14BI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17GA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18GU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20IC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22IG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23JSU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25JSUo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27LNO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
1
2 R topics documented:
LO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Mums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33NBI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34NBII . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38NO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40NO.var . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41PE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43PIG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45PO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Q.stats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48RG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50SEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51SI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54TF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56VGD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57WEI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59WEI2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61ZAIG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62ZIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65abdom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67additive.fit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68aep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69aids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70db . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71bfp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72centiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74centiles.com . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76centiles.pred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78centiles.split . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80checklink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82coef.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84deviance.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86fabric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88find.hyper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89fitted.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91fitted.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92formula.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94gamlss.control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98gamlss.cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100gamlss.family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101gamlss.fp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104gamlss.lo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105gamlss-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106gamlss.ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107gamlss.ra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
BB 3
gamlss.random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110gamlss.rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111gamlss.scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112glim.control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113histDist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114hodges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116lo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117lpred . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119make.link.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121model.frame.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123par.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125pdf.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126plot.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128polyS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130predict.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131print.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133prof.dev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134prof.term . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135ps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137ra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139random . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140rc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142refit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143rent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144residuals.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145rqres.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147stepGAIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148summary.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151term.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153update.gamlss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155usair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156wp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Index 160
BB Beta Binomial Distribution For Fitting a GAMLSS Model
Description
This function defines the beta binomial distribution, a two parameter distribution, for a gamlss.familyobject to be used in a GAMLSS fitting using the function gamlss()
4 BB
Usage
BB(mu.link = "logit", sigma.link = "log")dBB(y, mu = 0.5, sigma = 1, bd = 10, log = FALSE)pBB(q, mu = 0.5, sigma = 1, bd = 10, lower.tail = TRUE,
log.p = FALSE)qBB(p, mu = 0.5, sigma = 1, bd = 10, lower.tail = TRUE,
log.p = FALSE, fast = FALSE)rBB(n, mu = 0.5, sigma = 1, bd = 10, fast = FALSE)
Arguments
mu.link Defines the mu.link, with "logit" link as the default for the mu parameter.Other links are "probit" and "cloglog"’(complementary log-log)
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter. Other links are "inverse", "identity" and "sqrt"
mu vector of positive probabilities
sigma the dispersion parameter
bd vector of binomial denominators
p vector of probabilities
y,q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
fast a logical variable if fast=TRUE the dBB function is used in the calculation ofthe inverse c.d.f function. This is faster to the default fast=FALSE, where thepBB is used, but not always consistent with the results obtained from pBB(),for example if p <- pBB(c(0,1,2,3,4,5), mu=.5 , sigma=1, bd=5) do not ensurethat qBB(p, mu=.5 , sigma=1, bd=5) will be c(0,1,2,3,4,5)
Details
Definition file for beta binomial distribution.
f(y|µ, σ) =Γ(n + 1)
Γ(y + 1)Γ(n− y + 1)Γ( 1
σ )Γ(y + µσ )Γ[n + (1−µ)
σ − y]Γ(n + 1
σ )Γ(µσ )Γ( 1−µ
σ )
for y = 0, 1, 2, . . . , n, 0 < µ < 1 and σ > 0. For µ = 0.5 and σ = 0.5 the distribution is uniform.
Value
Returns a gamlss.family object which can be used to fit a Beta Binomial distribution in thegamlss() function.
Warning
The functions pBB and qBB are calculated using a laborious procedure so they are relatively slow.
BB 5
Note
The response variable should be a matrix containing two columns, the first with the count of suc-cesses and the second with the count of failures. The parameter mu represents a probability param-eter with limits 0 < µ < 1. nµ is the mean of the distribution where n is the binomial denominator.nµ(1− µ)[1 + (n− 1)σ/(σ + 1)]0.5 is the standard deviation of the Beta Binomial distribution.Hence σ is a dispersion type parameter
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Kalliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
BB()# gives information about the default links for the Beta Binomial distribution#plot the pdfplot(function(y) dBB(y, mu = .5, sigma = 1, bd =40), from=0, to=40, n=40+1, type="h")#calculate the cdf and plotting itppBB <- pBB(seq(from=0, to=40), mu=.2 , sigma=3, bd=40)plot(0:40,ppBB, type="h")#calculating quantiles and plotting themqqBB <- qBB(ppBB, mu=.2 , sigma=3, bd=40)plot(qqBB~ ppBB)# when the argument fast is usefulp <- pBB(c(0,1,2,3,4,5), mu=.01 , sigma=1, bd=5)qBB(p, mu=.01 , sigma=1, bd=5, fast=TRUE)# 0 1 1 2 3 5qBB(p, mu=.01 , sigma=1, bd=5, fast=FALSE)# 0 1 2 3 4 5# generate random sampletN <- table(Ni <- rBB(1000, mu=.2, sigma=1, bd=20))r <- barplot(tN, col='lightblue')# fitting a modeldata(aep)library(gamlss)# fits a Beta-Binomial modelh<-gamlss(y~ward+loglos+year, sigma.formula=~year+ward, family=BB, data=aep)rm(h, r, tN, ppBB, qqBB)
6 BCCG
BCCG Box-Cox Cole and Green distribution (or Box-Cox normal) for fittinga GAMLSS
Description
The function BCCG defines the Box-Cox Cole and Green distribution (Box-Cox normal), a threeparameter distribution, for a gamlss.family object to be used in GAMLSS fitting using thefunction gamlss(). The functions dBCCG, pBCCG, qBCCG and rBCCG define the density, dis-tribution function, quantile function and random generation for the specific parameterization of theBox-Cox Cole and Green distribution. [The function BCCGuntr() is the original version of thefunction suitable only for the untruncated Box-Cox Cole and Green distribution See Cole and Green(1992) and Rigby and Stasinopoulos (2003a,2003b) for details.
Usage
BCCG(mu.link = "identity", sigma.link = "log", nu.link = "identity")BCCGuntr(mu.link = "identity", sigma.link = "log", nu.link = "identity")dBCCG(y, mu = 1, sigma = 0.1, nu = 1, log = FALSE)pBCCG(q, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)qBCCG(p, mu = 1, sigma = 0.1, nu = 1, lower.tail = TRUE, log.p = FALSE)rBCCG(n, mu = 1, sigma = 0.1, nu = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter,other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter,other links are "1/nu2" and "log"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of skewness parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
BCCG 7
Details
The probability distribution function of the untrucated Box-Cox Cole and Green distribution, BCCGuntr,is defined as
f(y|µ, σ, ν) =1√2πσ
yν−1
µνexp(−z2
2)
where if ν 6= 0 then z = [(y/µ)ν − 1]/(νσ) else z = log(y/µ)/σ, for y > 0, µ > 0, σ > 0 andν = (−∞,+∞).
The Box-Cox Cole anf Green distribution, BCCG, adjusts the above density f(y|µ, σ, ν) for thetruncation resulting from the condition y > 0. See Rigby and Stasinopoulos (2003a,2003b) fordetails.
Value
BCCG() returns a gamlss.family object which can be used to fit a Cole and Green distributionin the gamlss() function. dBCCG() gives the density, pBCCG() gives the distribution function,qBCCG() gives the quantile function, and rBCCG() generates random deviates.
Warning
The BCCGuntr distribution may be unsuitable for some combinations of the parameters (mainlyfor large σ) where the integrating constant is less than 0.99. A warning will be given if this is thecase. The BCCG distribution is suitable for all combinations of the distributional parameters withintheir range [i.e. µ > 0, σ > 0, ν = (−∞,+∞)]
Note
µ is the median of the distribution σ is approximately the coefficient of variation (for small valuesof σ), and ν controls the skewness.
The BCCG distribution is suitable for all combinations of the parameters within their ranges [i.e.µ > 0, σ > 0, andν = (−∞,∞) ]
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Kalliope Akantziliotou
References
Cole, T. J. and Green, P. J. (1992) Smoothing reference centile curves: the LMS method and penal-ized likelihood, Statist. Med. 11, 1305–1319
Rigby, R. A. and Stasinopoulos, D. M. (2004). Smooth centile curves for skew and kurtotic datamodelled using the Box-Cox Power Exponential distribution. Statistics in Medicine, 23: 3053-3076.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R.A. Stasinopoulos, D.M. (2006). Using the Box-Cox t distribution in GAMLSS to modeskewnees and and kurtosis. to appear in Statistical Modelling.
8 BCPE
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
BCCG() # gives information about the default links for the Cole and Green distributiondata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCCG, data=abdom)plot(h)plot(function(x) dBCCG(x, mu=5,sigma=.5,nu=-1), 0.0, 20,main = "The BCCG density mu=5,sigma=.5,nu=-1")plot(function(x) pBCCG(x, mu=5,sigma=.5,nu=-1), 0.0, 20,main = "The BCCG cdf mu=5, sigma=.5, nu=-1")rm(h)
BCPE Box-Cox Power Exponential distribution for fitting a GAMLSS
Description
This function defines the Box-Cox Power Exponential distribution, a four parameter distribution, fora gamlss.family object to be used for a GAMLSS fitting using the function gamlss(). Thefunctions dBCPE, pBCPE, qBCPE and rBCPE define the density, distribution function, quantilefunction and random generation for the Box-Cox Power Exponential distribution. The functioncheckBCPE can be used, typically when a BCPE model is fitted, to check whether there exit aturning point of the distribution close to zero. It give the number of values of the response belowtheir minimum turning point and also the maximum probability of the lower tail below minimumturning point. [The function Biventer() is the original version of the function suitable only forthe untruncated BCPE distribution.] See Rigby and Stasinopoulos (2003) for details.
Usage
BCPE(mu.link = "identity", sigma.link = "log", nu.link = "identity",tau.link = "log")
BCPEuntr(mu.link = "identity", sigma.link = "log", nu.link = "identity",tau.link = "log")
dBCPE(y, mu = 5, sigma = 0.1, nu = 1, tau = 2, log = FALSE)pBCPE(q, mu = 5, sigma = 0.1, nu = 1, tau = 2, lower.tail = TRUE, log.p = FALSE)qBCPE(p, mu = 5, sigma = 0.1, nu = 1, tau = 2, lower.tail = TRUE, log.p = FALSE)rBCPE(n, mu = 5, sigma = 0.1, nu = 1, tau = 2)checkBCPE(obj = NULL, mu = 10, sigma = 0.1, nu = 0.5, tau = 2,...)
BCPE 9
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter.Other links are "1/nu2" and "log"
tau.link Defines the tau.link, with "log" link as the default for the tau parameter.Other links are "1/tau2", and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of nu parameter values
tau vector of tau parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
obj a gamlss BCPE family object
... for extra arguments
Details
The probability density function of the untrucated Box Cox Power Exponential distribution, (BCPE.untr),is defined as
f(y|µ, σ, ν, τ) =yν−1τ exp[− 1
2 |zc |
τ ]µνσc2(1+1/τ)Γ( 1
τ )
where c = [2(−2/τ)Γ(1/τ)/Γ(3/τ)]0.5, where if ν 6= 0 then z = [(y/µ)ν − 1]/(νσ) else z =log(y/µ)/σ, for y > 0, µ > 0, σ > 0, ν = (−∞,+∞) and τ > 0.
The Box-Cox Power Exponential, BCPE, adjusts the above density f(y|µ, σ, ν, τ) for the truncationresulting from the condition y > 0. See Rigby and Stasinopoulos (2003) for details.
Value
BCPE() returns a gamlss.family object which can be used to fit a Box Cox Power Exponentialdistribution in the gamlss() function. dBCPE() gives the density, pBCPE() gives the distribu-tion function, qBCPE() gives the quantile function, and rBCPE() generates random deviates.
10 BCPE
Warning
The BCPE.untr distribution may be unsuitable for some combinations of the parameters (mainlyfor large σ) where the integrating constant is less than 0.99. A warning will be given if this is thecase.
The BCPE distribution is suitable for all combinations of the parameters within their ranges [i.e.µ > 0, σ > 0, ν = (−∞,∞)andτ > 0 ]
Note
µ, is the median of the distribution, σ is approximately the coefficient of variation (for small σ andmoderate nu>0), ν controls the skewness and τ the kurtosis of the distribution
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R. A. and Stasinopoulos, D. M. (2004). Smooth centile curves for skew and kurtotic datamodelled using the Box-Cox Power Exponential distribution. Statistics in Medicine, 23: 3053-3076.
Stasinopoulos D. M. Rigby R. A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, BCT
Examples
BCPE() #data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCPE, data=abdom)plot(h)rm(h)plot(function(x)dBCPE(x, mu=5,sigma=.5,nu=1, tau=3), 0.0, 15,main = "The BCPE density mu=5,sigma=.5,nu=1, tau=3")plot(function(x) pBCPE(x, mu=5,sigma=.5,nu=1, tau=3), 0.0, 15,main = "The BCPE cdf mu=5, sigma=.5, nu=1, tau=3")
BCT 11
BCT Box-Cox t distribution for fitting a GAMLSS
Description
The function BCT() defines the Box-Cox t distribution, a four parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The functions dBCT, pBCT,qBCT and rBCT define the density, distribution function, quantile function and random generationfor the Box-Cox t distribution. [The function BCTuntr() is the original version of the functionsuitable only for the untruncated BCT distribution]. See Rigby and Stasinopoulos (2003) for details.
Usage
BCT(mu.link = "identity", sigma.link = "log", nu.link = "identity",tau.link = "log")
BCTuntr(mu.link = "identity", sigma.link = "log", nu.link = "identity",tau.link = "log")
dBCT(y, mu = 5, sigma = 0.1, nu = 1, tau = 2, log = FALSE)pBCT(q, mu = 5, sigma = 0.1, nu = 1, tau = 2, lower.tail = TRUE, log.p = FALSE)qBCT(p, mu = 5, sigma = 0.1, nu = 1, tau = 2, lower.tail = TRUE, log.p = FALSE)rBCT(n, mu = 5, sigma = 0.1, nu = 1, tau = 2)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter.Other links are "1/nu2" and "log"
tau.link Defines the tau.link, with "log" link as the default for the tau parameter.Other links are "1/tau2", and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of nu parameter values
tau vector of tau parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
12 BCT
Details
The probability density function of the untruncated Box-Cox t distribution, BCTuntr, is given by
f(y|µ, σ, ν, τ) =yν−1
µνσ
Γ[(τ + 1)/2]Γ(1/2)Γ(τ/2)τ0.5
[1 + (1/τ)z2]−(τ+1)/2
where if ν 6= 0 then z = [(y/µ)ν − 1]/(νσ) else z = log(y/µ)/σ, for y > 0, µ > 0, σ > 0,ν = (−∞,+∞) and τ > 0.
The Box-Cox t distribution, BCT, adjusts the above density f(y|µ, σ, ν, τ) for the truncation result-ing from the condition y > 0. See Rigby and Stasinopoulos (2003) for details.
Value
BCT() returns a gamlss.family object which can be used to fit a Box Cox-t distribution in thegamlss() function. dBCT() gives the density, pBCT() gives the distribution function, qBCT()gives the quantile function, and rBCT() generates random deviates.
Warning
The use BCTuntr distribution may be unsuitable for some combinations of the parameters (mainlyfor large σ) where the integrating constant is less than 0.99. A warning will be given if this is thecase.
The BCT distribution is suitable for all combinations of the parameters within their ranges [i.e.µ > 0, σ > 0, ν = (−∞,∞)andτ > 0 ]
Note
µ is the median of the distribution, σ( ττ−2 )0.5 is approximate the coefficient of variation (for small
σ and moderate nu>0 and moderate or large τ ), ν controls the skewness and τ the kurtosis of thedistribution
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Rigby, R.A. Stasinopoulos, D.M. (2006). Using the Box-Cox t distribution in GAMLSS to modeskewnees and and kurtosis. to appear in Statistical Modelling.
Stasinopoulos, D. M. Rigby, R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
BE 13
Examples
BCT() # gives information about the default links for the Box Cox t distributiondata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom) #plot(h)plot(function(x)dBCT(x, mu=5,sigma=.5,nu=1, tau=2), 0.0, 20,main = "The BCT density mu=5,sigma=.5,nu=1, tau=2")plot(function(x) pBCT(x, mu=5,sigma=.5,nu=1, tau=2), 0.0, 20,main = "The BCT cdf mu=5, sigma=.5, nu=1, tau=2")rm(h)
BE The beta distribution for fitting a GAMLSS
Description
The function BE() defines the beta distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(), with mean equal to the param-eter mu and sigma a scale parameter, see below. The functions dBE, pBE, qBE and rBE define thedensity, distribution function, quantile function and random generation for the BE parameterizationof the beta distribution.
Usage
BE(mu.link = "logit", sigma.link = "logit")dBE(y, mu = 0.5, sigma = 0.02, log = FALSE)pBE(q, mu = 0.5, sigma = 0.02, lower.tail = TRUE, log.p = FALSE)qBE(p, mu = 0.5, sigma = 0.02, lower.tail = TRUE, log.p = FALSE)rBE(n, mu = 0.5, sigma = 0.02)
Arguments
mu.link the mu link function with default logit
sigma.link the sigma link function with default logit
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
14 BE
Details
The beta distribution is given as
f(y|α, β) =1
B(α, β)yα−1(1− y)β−1
for y = (0, 1), α > 0 and β > 0. The parametrization in the function BE() is µ = αα+β and
σ = 1α+β+1 for µ = (0, 1) and σ = (0, 1). The expected value of y is µ and the variance is
σ2µ ∗ (1− µ).
Value
returns a gamlss.family object which can be used to fit a normal distribution in the gamlss()function.
Note
Note that mu is the mean and sigma a scale parameter contributing to the variance of y
Author(s)
Bob Rigby and Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, BEINF
Examples
BE()# gives information about the default links for the normal distributiondat<-rBE(100, mu=.3, sigma=.5)hist(dat)mod1<-gamlss(dat~1,family=BE) # fits a constant for mu and sigmafitted(mod1)[1]fitted(mod1,"sigma")[1]plot(function(y) dBE(y, mu=.1 ,sigma=.5), 0.001, .999)plot(function(y) pBE(y, mu=.1 ,sigma=.5), 0.001, 0.999)plot(function(y) qBE(y, mu=.1 ,sigma=.5), 0.001, 0.999)plot(function(y) qBE(y, mu=.1 ,sigma=.5, lower.tail=FALSE), 0.001, .999)
BEINF 15
BEINF The beta inflated distribution for fitting a GAMLSS
Description
The function BEINF() defines the beta inflated distribution, a four parameter distribution, fora gamlss.family object to be used in GAMLSS fitting using the function gamlss(). Thebeta inflated is similar to the beta but allows zeros and one as y values. The two extra parametersmodel the probabilities at zero and one. The functions dBEINF, pBEINF, qBEINF and rBEInFdefine the density, distribution function, quantile function and random generation for the BEINFparameterization of the beta inflated distribution. plotBEINF can be used to plot the distribution.meanBEINF calculates the expected value of the response for a fitted model.
Usage
BEINF(mu.link = "logit", sigma.link = "logit", nu.link = "log",tau.link = "log")
dBEINF(y, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1,log = FALSE)
pBEINF(q, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1,lower.tail = TRUE, log.p = FALSE)
qBEINF(p, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1,lower.tail = TRUE, log.p = FALSE)
rBEINF(n, mu = 0.5, sigma = 0.1, nu = 0.1, tau = 0.1)plotBEINF(mu = 0.5, sigma = 0.5, nu = 0.5, tau = 0.5,
from = 0, to = 1, n = 101, ...)meanBEINF(obj)
Arguments
mu.link the mu link function with default logit
sigma.link the sigma link function with default logit
nu.link the nu link function with default log
tau.link the tau link function with default log
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of parameter values modelling the probability at zero
tau vector of parameter values modelling the probability at one
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
16 BEINF
from where to start plotting the distribution from
to up to where to plot the distribution
obj a fitted BEINF object
... other graphical parameters for plotting
Details
The beta inflated distribution is given as
f(y) = p0
if (y=0)f(y) = p1
if (y=1)
f(y|α, β) =1
B(α, β)yα−1(1− y)β−1
otherwise
for y = (0, 1), α > 0 and β > 0. The parametrization in the function BEINF() is µ = αα+β and
σ = 1α+β+1 for µ = (0, 1) and σ = (0, 1) and ν = p0
p2, τ = p1
p2where p2 = f(y).
Value
returns a gamlss.family object which can be used to fit a beta inflated distribution in thegamlss() function. ...
Note
Author(s)
Bob Rigby and Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, BE
BI 17
Examples
BEINF()# gives information about the default links for the normal distribution# plotting the distributionplotBEINF( mu =.5 , sigma=.5, nu = 0.5, tau = 0.5, from = 0, to=1, n = 101)# plotting the cdfplot(function(y) pBEINF(y, mu=.5 ,sigma=.5, nu = 0.5, tau = 0.5,), 0, 1)# plotting the inverse cdfplot(function(y) qBEINF(y, mu=.5 ,sigma=.5, nu = 0.5, tau = 0.5,), 0.01, .99)# generate random numbersdat <- rBEINF(1000,mu=.5,sigma=.5, nu=.5, tau=.5)# fit a model to the datam1<-gamlss(dat~1,family=BEINF)meanBEINF(m1)[1]
BI Binomial distribution for fitting a GAMLSS
Description
The BI() function defines the binomial distribution, a one parameter family distribution, for agamlss.family object to be used in GAMLSS fitting using the function gamlss(). The func-tions dBI, pBI, qBI and rBI define the density, distribution function, quantile function and ran-dom generation for the binomial, BI(), distribution.
Usage
BI(mu.link = "logit")dBI(y, bd = 1, mu = 0.5, log = FALSE)pBI(q, bd = 1, mu = 0.5, lower.tail = TRUE, log.p = FALSE)qBI(p, bd = 1, mu = 0.5, lower.tail = TRUE, log.p = FALSE)rBI(n, bd = 1, mu = 0.5)
Arguments
mu.link Defines the mu.link, with "logit" link as the default for the mu parameter.Other links are "probit" and "cloglog"’(complementary log-log)
y vector of (non-negative integer) quantiles
mu vector of positive probabilities
bd vector of binomial denominators
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
18 BI
Details
Definition file for binomial distribution.
f(y|µ) =Γ(n + 1)
Γ(y + 1)Γ(n− y + 1)µy(1− µ)(n−y)
for y = 0, 1, 2, ..., n and 0 < µ < 1.
Value
returns a gamlss.family object which can be used to fit a binomial distribution in the gamlss()function.
Note
The response variable should be a matrix containing two columns, the first with the count of suc-cesses and the second with the count of failures. The parameter mu represents a probability param-eter with limits 0 < µ < 1. nµ is the mean of the distribution where n is the binomial denominator.
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
BI()# gives information about the default links for the Binomial distributiondata(aep)library(gamlss)h<-gamlss(y~ward+loglos+year, family=BI, data=aep)# plot of the binomial distributioncurve(dBI(y=x, mu = .5, bd=10), from=0, to=10, n=10+1, type="h")tN <- table(Ni <- rBI(1000, mu=.2, bd=10))r <- barplot(tN, col='lightblue')rm(h,tN,r)
GA 19
GA Gamma distribution for fitting a GAMLSS
Description
The function GA defines the gamma distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The parameterization used hasthe mean of the distribution equal to µ and the variance equal to σ2µ2. The functions dGA, pGA,qGA and rGA define the density, distribution function, quantile function and random generation forthe specific parameterization of the gamma distribution defined by function GA.
Usage
GA(mu.link = "log", sigma.link ="log")dGA(y, mu = 1, sigma = 1, log = FALSE)pGA(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qGA(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)rGA(n, mu = 1, sigma = 1)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter, otherlinks are "inverse" and "identity"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other link is the "inverse" and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The specific parameterization of the gamma distribution used in GA is
f(y|µ, σ) =y(1/σ2−1) exp[−y/(σ2µ)]
(σ2µ)(1/σ2)Γ(1/σ2)
for y > 0, µ > 0 and σ > 0.
20 GU
Value
GA() returns a gamlss.family object which can be used to fit a gamma distribution in thegamlss() function. dGA() gives the density, pGA() gives the distribution function, qGA()gives the quantile function, and rGA() generates random deviates. The latest functions are basedon the equivalent R functions for gamma distribution.
Note
µ is the mean of the distribution in GA. In the function GA, σ is the square root of the usual dispersionparameter for a GLM gamma model. Hence σµ is the standard deviation of the distribution definedin GA.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
GA()# gives information about the default links for the gamma distributiondat<-rgamma(100, shape=1, scale=10) # generates 100 random observationsgamlss(dat~1,family=GA)# fits a constant for each parameter mu and sigma of the gamma distributionnewdata<-rGA(1000,mu=1,sigma=1) # generates 1000 random observationshist(newdata)rm(dat,newdata)
GU The Gumbel distribution for fitting a GAMLSS
Description
The function GU defines the Gumbel distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The functions dGU, pGU, qGUand rGU define the density, distribution function, quantile function and random generation for thespecific parameterization of the Gumbel distribution.
GU 21
Usage
GU(mu.link = "identity", sigma.link = "log")dGU(y, mu = 0, sigma = 1, log = FALSE)pGU(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qGU(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rGU(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.other available link is "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other links are the "inverse" and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The specific parameterization of the Gumbel distribution used in GU is
f(y|µ, σ) =1σ
exp(
y − µ
σ
)− exp
(y − µ
σ
)for y = (−∞,∞), µ = (−∞,+∞) and σ > 0.
Value
GU() returns a gamlss.family object which can be used to fit a Gumbel distribution in thegamlss() function. dGU() gives the density, pGU() gives the distribution function, qGU()gives the quantile function, and rGU() generates random deviates.
Note
The mean of the distribution is µ− 0.57722σ and the variance is π2σ2/6.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
22 IC
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
plot(function(x) dGU(x, mu=0,sigma=1), -6, 3,main = "Gumbel density mu=0,sigma=1")GU()# gives information about the default links for the Gumbel distributiondat<-rGU(100, mu=10, sigma=2) # generates 100 random observationsgamlss(dat~1,family=GU) # fits a constant for each parameter mu and sigma
IC Gives the GAIC for a GAMLSS Object
Description
IC is a function to calculate the Generalized Akaike information criterion (GAIC) for a givenpenalty k for a fitted GAMLSS object. The function AIC.gamlss is the method associated with aGAMLSS object of the generic function AIC. The function GAIC is a synonymous of the functionAIC.gamlss. The function extractAIC is a the method associated a GAMLSS object of thegeneric function extractAIC and it is mainly used in the stepAIC function.
Usage
IC(object, k = 2)## S3 method for class 'gamlss':AIC(object, ..., k = 2)GAIC(object, ..., k = 2 )## S3 method for class 'gamlss':extractAIC(fit, scale, k = 2, ...)
Arguments
object an gamlss fitted modelfit an gamlss fitted model... allows several GAMLSS object to be compared using a GAICk the penalty with default k=2.5scale this argument is not used in gamlss
IG 23
Value
The function IC returns the GAIC for given penalty k of the GAMLSS object. The function AICreturns a matrix contains the df’s and the GAIC’s for given penalty k. The function GAIC returnsidentical results to AIC. The function extractAIC returns vector of length two with the degreesof freedom and the AIC criterion.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
Examples
data(abdom)mod1<-gamlss(y~cs(x,df=3),sigma.fo=~cs(x,df=1),family=BCT, data=abdom)IC(mod1)mod2<-gamlss(y~cs(x,df=3),sigma.fo=~x,family=BCT, data=abdom)AIC(mod1,mod2,k=3)GAIC(mod1,mod2,k=3)extractAIC(mod1,k=3)rm(mod1,mod2)
IG Inverse Gaussian distribution for fitting a GAMLSS
Description
The function IG(), or equivalently Inverse.Gaussian(), defines the inverse Gaussian distri-bution, a two parameter distribution, for a gamlss.family object to be used in GAMLSS fittingusing the function gamlss(). The functions dIG, pIG, qIG and rIG define the density, distri-bution function, quantile function and random generation for the specific parameterization of theInverse Gaussian distribution defined by function IG.
24 IG
Usage
IG(mu.link = "log", sigma.link = "log")dIG(y, mu = 1, sigma = 1, log = FALSE)pIG(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qIG(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE,
lower.limit = 0, upper.limit = mu+10*sqrt(sigma^2*mu^3))rIG(n, mu = 1, sigma = 1, ...)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
lower.limit the argument lower.limit sets the lower limit in the golden section searchfor q, the default is zero but it may have to change for small values of sigmasay less than 0.05 since the distribution will be concentrated close to mu
upper.limit the argument upper.limit sets the upper limit in the golden section searchfor q, the default is 10 time its standard deviation
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
... ... can be used to pass the uppr.limit argument to qIG
Details
Definition file for inverse Gaussian distribution.
f(y|µ, σ) =1√
2πσ2y3exp
− 1
2µ2σ2y(y − µ)2
for y > 0, µ > 0 and σ > 0.
Value
returns a gamlss.family object which can be used to fit a inverse Gaussian distribution in thegamlss() function.
Note
µ is the mean and σ2µ3 is the variance of the inverse Gaussian
JSU 25
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/)
See Also
gamlss, gamlss.family
Examples
IG()# gives information about the default links for the normal distributiondata(rent)gamlss(R~cs(Fl),family=IG, data=rent) #plot(function(x)dIG(x, mu=1,sigma=.5), 0.01, 6,main = "Inverse Gaussian density mu=1,sigma=0.5")plot(function(x)pIG(x, mu=1,sigma=.5), 0.01, 6,main = "Inverse Gaussian cdf mu=1,sigma=0.5")
JSU The Johnson’s Su distribution for fitting a GAMLSS
Description
This function defines the , a four parameter distribution, for a gamlss.family object to be usedfor a GAMLSS fitting using the function gamlss(). The functions dJSU, pJSU, qJSU andrJSU define the density, distribution function, quantile function and random generation for the theJohnson’s Su distribution.
Usage
JSU(mu.link = "identity", sigma.link = "log", nu.link = "identity", tau.link = "log")dJSU(y, mu = 0, sigma = 1, nu = 1, tau = 0.5, log = FALSE)pJSU(q, mu = 0, sigma = 1, nu = 1, tau = 0.5, lower.tail = TRUE, log.p = FALSE)qJSU(p, mu = 0, sigma = 1, nu = 0, tau = 0.5, lower.tail = TRUE, log.p = FALSE)rJSU(n, mu = 0, sigma = 1, nu = 0, tau = 0.5)
26 JSU
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter.Other links are "1/nu2" and "log"
tau.link Defines the tau.link, with "log" link as the default for the tau parameter.Other links are "1/τ2", and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of skewness nu parameter values
tau vector of kurtosis tau parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The probability density function of the Jonhson’s SU distribution, (JSU), is defined as
f(y|n, µ, σ ν, τ) ==1cσ
1τ(z2 + 1)
12
1√2π
exp[−1
2r2
]
for −∞ < y < ∞, µ = (−∞,+∞), σ > 0, ν = (−∞,+∞) and τ > 0. where r = −ν +1τ sinh−1(z), z = y−(µ+cσw
12 sinh Ω)
cσ , c = [12 (w − 1)(w cosh 2Ω + 1)]12 , w = eτ2
and Ω = −ντ .
This is a reparameterization of the original Johnson Su distribution, Johnson (1954), so the param-eters mu and sigma are the mean and the standard deviation of the distribution. The parameternu determines the skewness of the distribution with nu>0 indicating positive skewness and nu<0negative. The parameter tau determines the kurtosis of the distribution. tau should be positiveand most likely in the region from zero to 1. As tau goes to 0 (and for nu=0) the distributionapproaches the the Normal density function. The distribution is appropriate for leptokurtic data thatis data with kurtosis larger that the Normal distribution one.
Value
JSU() returns a gamlss.family object which can be used to fit a Johnson’s Su distributionin the gamlss() function. dJSU() gives the density, pJSU() gives the distribution function,qJSU() gives the quantile function, and rJSU() generates random deviates.
JSUo 27
Warning
The function JSU uses first derivatives square in the fitting procedure so standard errors should beinterpreted with caution
Note
Author(s)
Bob Rigby and Mikis Stasinopoulos
References
Johnson, N. L. (1954). Systems of frequency curves derived from the first law of Laplace., Trabajosde Estadistica, 5, 283-291.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M. Rigby R. A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, JSU, BCT
Examples
JSU()data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=JSU, data=abdom)plot(h)rm(h)plot(function(x)dJSU(x, mu=0,sigma=1,nu=-1, tau=.5), -4, 4,main = "The JSU density mu=0,sigma=1,nu=-1, tau=.5")plot(function(x) pJSU(x, mu=0,sigma=1,nu=-1, tau=.5), -4, 4,main = "The JSU cdf mu=0, sigma=1, nu=-1, tau=.5")
JSUo The original Johnson’s Su distribution for fitting a GAMLSS
Description
This function defines the , a four parameter distribution, for a gamlss.family object to be usedfor a GAMLSS fitting using the function gamlss(). The functions dJSUo, pJSUo, qJSUo andrJSUo define the density, distribution function, quantile function and random generation for thethe Johnson’s Su distribution.
28 JSUo
Usage
JSUo(mu.link = "identity", sigma.link = "log", nu.link = "identity", tau.link = "log")dJSUo(y, mu = 0, sigma = 1, nu = 0, tau = 1, log = FALSE)pJSUo(q, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE)qJSUo(p, mu = 0, sigma = 1, nu = 0, tau = 1, lower.tail = TRUE, log.p = FALSE)rJSUo(n, mu = 0, sigma = 1, nu = 0, tau = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter.Other links are "1/nu2" and "log"
tau.link Defines the tau.link, with "log" link as the default for the tau parameter.Other links are "1/tau2", and "identity
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of skewness nu parameter values
tau vector of kurtosis tau parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The probability density function of the orininal Jonhson’s SU distribution, (JSU), is defined as
f(y|n, µ, σ ν, τ) =τ
σ
1(z2 + 1)
12
1√2π
exp[−1
2r2
]
for −∞ < y < ∞, µ = (−∞,+∞), σ > 0, ν = (−∞,+∞) and τ > 0. where z = (y−µ)σ ,
r = ν + τsinh−1(z).
Value
JSUo() returns a gamlss.family object which can be used to fit a Johnson’s Su distributionin the gamlss() function. dJSUo() gives the density, pJSUo() gives the distribution function,qJSUo() gives the quantile function, and rJSUo() generates random deviates.
LNO 29
Warning
The function JSU uses first derivatives square in the fitting procedure so standard errors should beinterpreted with caution. It is recomented to be used only with method=mixed(2,20)
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby 〈[email protected]〉
References
Johnson, N. L. (1954). Systems of frequency curves derived from the first law of Laplace., Trabajosde Estadistica, 5, 283-291.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M. Rigby R. A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, JSU, BCT
Examples
JSU()data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=JSUo,
data=abdom, method=mixed(2,20))plot(h)rm(h)plot(function(x)dJSUo(x, mu=0,sigma=1,nu=-1, tau=.5), -4, 15,main = "The JSUo density mu=0,sigma=1,nu=-1, tau=.5")plot(function(x) pJSUo(x, mu=0,sigma=1,nu=-1, tau=.5), -4, 15,main = "The JSUo cdf mu=0, sigma=1, nu=-1, tau=.5")
LNO Log Normal distribution for fitting a GAMLSS
30 LNO
Description
The function LOGNO defines a gamlss.family distribution to fits the log-Normal distribu-tion. The function LNO is more general and can fit a Box-Cox transformation to data using thegamlss() function. In the LOGNO there are two parameters involved mu sigma, while in theLNO there are three parameters mu sigma, and the transformation parameter nu. The transforma-tion parameter nu in LNO is a ’fixed’ parameter (not estimated) and it has its default value equalto zero allowing the fitting of the log-normal distribution as in LOGNO. See the example below onhow to fix nu to be a particular value. In order to estimate (or model) the parameter nu, use thegamlss.family BCCG distribution which uses a reparameterized version of the the Box-Coxtransformation. The functions dLOGNO, pLOGNO, qLOGNO and rLOGNO define the density, dis-tribution function, quantile function and random generation for the specific parameterization of thelog-normal distribution. The functions dLNO, pLNO, qLNO and rLNO define the density, distri-bution function, quantile function and random generation for the specific parameterization of thelog-normal distribution and more generally a Box-Cox transformation.
Usage
LNO(mu.link = "identity", sigma.link = "log")LOGNO(mu.link = "identity", sigma.link = "log")dLNO(y, mu = 1, sigma = 0.1, nu = 0, log = FALSE)dLOGNO(y, mu = 0, sigma = 1, log = FALSE)pLNO(q, mu = 1, sigma = 0.1, nu = 0, lower.tail = TRUE, log.p = FALSE)pLOGNO(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qLNO(p, mu = 1, sigma = 0.1, nu = 0, lower.tail = TRUE, log.p = FALSE)qLOGNO(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rLNO(n, mu = 1, sigma = 0.1, nu = 0)rLOGNO(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter. Other links are "inverse", and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of shape parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
LNO 31
Details
The probability density function in LOGNO is defined as
f(y|µ, σ) =1
y√
2πσexp[− 1
2σ2(log(y)− µ)2]
for y > 0, µ = (−∞,+∞) and σ > 0.
The probability density function in LNO is defined as
f(y|µ, σ, ν) =1√2πσ
yν−1 exp[− 12σ2
(z − µ)2]
where if ν 6= 0 z = (yν − 1)/ν else z = log(y) and z ∼ N(0, σ2), for y > 0, µ > 0, σ > 0 andν = (−∞,+∞).
Value
LNO() returns a gamlss.family object which can be used to fit a log-narmal distribution in thegamlss() function. dLNO() gives the density, pLNO() gives the distribution function, qLNO()gives the quantile function, and rLNO() generates random deviates.
Warning
This is a two parameter fit for µ and σ while ν is fixed. If you wish to model ν use the gamlssfamily BCCG.
Note
µ is the mean of z (and also the median of y), the Box-Cox transformed variable and σ is thestandard deviation of z and approximate the coefficient of variation of y
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations (with discussion), J. R. Statist.Soc. B., 26, 211–252
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, BCCG
32 LO
Examples
LOGNO()# gives information about the default links for the log normal distributionLNO()# gives information about the default links for the Box Cox distributiondata(abdom)h1<-gamlss(y~cs(x), family=LOGNO, data=abdom)#fits the log-Normal distributionh2<-gamlss(y~cs(x), family=LNO, data=abdom) #should be identical to the one above# to change to square root transformation, i.e. fix nu=0.5h3<-gamlss(y~cs(x), family=LNO, data=abdom, nu.fix=TRUE, nu.start=0.5)rm(h1,h2,h3)
LO Logistic distribution for fitting a GAMLSS
Description
The function LO(), or equivalently Logistic(), defines the logistic distribution, a two param-eter distribution, for a gamlss.family object to be used in GAMLSS fitting using the functiongamlss()
Usage
LO(mu.link = "identity", sigma.link = "log")dLO(y, mu = 0, sigma = 1, log = FALSE)pLO(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qLO(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rLO(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
LO 33
Details
Definition file for Logistic distribution.
f(y|µ, σ) =1σ
e−y−µ
σ [1 + e−y−µ
σ ]−2
for y = (−∞,∞), µ = (−∞,∞) and σ > 0.
Value
LO() returns a gamlss.family object which can be used to fit a logistic distribution in thegamlss() function. dLO() gives the density, pLO() gives the distribution function, qLO()gives the quantile function, and rLO() generates random deviates for the logistic distribution. Thelatest functions are based on the equivalent R functions for logistic distribution.
Note
µ is the mean and σπ/√
3 is the standard deviation for the logistic distribution
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
LO()# gives information about the default links for the Logistic distributiondata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=LO, data=abdom) # fitsplot(h)rm(h)plot(function(y) dLO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) pLO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) qLO(y, mu=10 ,sigma=2), 0, 1)
34 Mums
Mums Mothers encouragement data
Description
Mothers encouragement for participation in Higher Education. The response variable is mums athree level factor which can be used in a multinomial Logistic model or mumsB a two level factorsuitable for binary logistic model.
Usage
data(Mums)
Format
A data frame with 871 observations on the following 7 variables.
mums mothers encouragement: factor with levels 1 is for strong encouragement, 2 is for someencouragement and 3 for no encouragement/discouragement
class social class: a factor with levels 1is C1, 2 is C2, 3 is D and 4 is E
age age of the participants: a factor with levels 1 is 16-18, 2 is 19-20 and 3 is 20-30
gender a factor with levels 1 is male and 2 is female
ethn ethnicity of the participants: a factor with levels 1 is white, 2 is black, 3 is asian and 4 isother
qual qualifications of the participants: a factor with levels, 1 is greater or equal to 2 A levels, 2is HND or more than 5 GCSE’s, 3 is less than 5 GSCSE’s ar none above and 4 no formalqualification
mumsb mothers encouragement: a factor with levels, 0 is no encouragement or some encourage-ment 1 is for strong encouragement
Details
The data were collected as part of the Social Class and widening Participation in Higher Educa-tion Project based at the University of North London (now London Metropolitan University) andsupported by the University’s Development and Diversity Fund over the period 1998-2000.
Source
Professor Robert Gilchrist director of STORM at London Metropolitan
References
Collier T., Gilchrist R. and Phillips D. (2003), Who Plans to Go to University? Statistical Modellingof potential Working-Class Participants, Education Research and Evaluation, Vol 9, No 3, pp 239-263.
NBI 35
Examples
data(Mums)MM<-xtabs(~mums+qual, data=Mums)mosaicplot(MM, color=TRUE)MM<-xtabs(~mums+ethn+gender, data=Mums)mosaicplot(MM, color=TRUE)
NBI Negative Binomial type I distribution for fitting a GAMLSS
Description
The NBI() function defines the Negative Binomial type I distribution, a two parameter distribution,for a gamlss.family object to be used in GAMLSS fitting using the function gamlss(). Thefunctions dNBI, pNBI, qNBI and rNBI define the density, distribution function, quantile functionand random generation for the Negative Binomial type I, NBI(), distribution.
Usage
NBI(mu.link = "log", sigma.link = "log")dNBI(y, mu = 1, sigma = 1, log = FALSE)pNBI(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qNBI(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)rNBI(n, mu = 1, sigma = 1)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parametersigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-
tery vector of (non-negative integer) quantilesmu vector of positive meanssigma vector of positive despersion parameterp vector of probabilitiesq vector of quantilesn number of random values to returnlog, log.p logical; if TRUE, probabilities p are given as log(p)lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
Details
Definition file for Negative Binomial type I distribution.
f(y|µ, σ) =Γ(y + 1/σ)
Γ(y + 1)Γ(1/σ)
[(µσ)y
(µσ + 1)
]y+(1/σ)
for y = 0, 1, 2, . . . ,∞, µ > 0 and σ > 0. This parameterization is equivalent to that used byAnscombe (1950) except he used α = 1/σ instead of σ.
36 NBI
Value
returns a gamlss.family object which can be used to fit a Negative Binomial type I distributionin the gamlss() function.
Warning
For values of σ < 0.0001 the d,p,q,r functions switch to the Poisson distribution
Note
µ is the mean and (µ+σµ2)0.5 is the standard deviation of the Negative Binomial type I distribution(so σ is the dispersion parameter in the usual GLM for the negative binomial type I distribution)
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Anscombe, F. J. (1950) Sampling theory of the negative bimomial and logarithmic distributiona,Biometrika, 37, 358-382.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, NBII, PIG, SI
Examples
NBI() # gives information about the default links for the Negative Binomial type I distributiondata(aids)h<-gamlss(y~cs(x,df=7)+qrt, family=NBI, data=aids) # fits the modelplot(h)# plotting the distributionplot(function(y) dNBI(y, mu = 10, sigma = 0.5 ), from=0, to=40, n=40+1, type="h")pdf.plot(family=NBI, mu=10, sigma=0.5, min=0, max=40, step=1)# creating random variables and plot themtN <- table(Ni <- rNBI(1000, mu=5, sigma=0.5))r <- barplot(tN, col='lightblue')rm(h, tN, r)
NBII 37
NBII Negative Binomial type II distribution for fitting a GAMLSS
Description
The NBII() function defines the Negative Binomial type II distribution, a two parameter distribu-tion, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().The functions dNBII, pNBII, qNBII and rNBII define the density, distribution function, quan-tile function and random generation for the Negative Binomial type II, NBII(), distribution.
Usage
NBII(mu.link = "log", sigma.link = "log")dNBII(y, mu = 1, sigma = 1, log = FALSE)pNBII(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qNBII(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)rNBII(n, mu = 1, sigma = 1)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y vector of (non-negative integer) quantiles
mu vector of positive means
sigma vector of positive despersion parameter
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
Details
Definition file for Negative Binomial type II distribution.
f(y|µ, σ) =Γ(y + (µ/σ))σy
Γ(µ/σ)Γ(y + 1)(1 + σ)y+(µ/σ)
for y = 0, 1, 2, ...,∞, µ > 0 and σ > 0. This parameterization was used by Evans (1953) ans alsoby Johnson et al (1993) p 200.
Value
returns a gamlss.family object which can be used to fit a Negative Binomial type II distributionin the gamlss() function.
38 NET
Note
µ is the mean and [(1 + σ)µ]0.5 is the standard deviation of the Negative Binomial type II distribu-tion, so σ is a dispersion parameter
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Evans, D. A. (1953). Experimental evidence concerning contagious distributions in ecology. Biometrika,40: 186-211.
Johnson, N. L., Kotz, S. and Kemp, A. W. (1993). Univariate Discrete Distributions, 2nd edn.Wiley, New York.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, NBII, PIG, SI
Examples
NBII() # gives information about the default links for the Negative Binomial type II distributiondata(aids)h<-gamlss(y~cs(x,df=7)+qrt, family=NBII, data=aids) # fits a modelplot(h)# plotting the distributionplot(function(y) dNBII(y, mu = 10, sigma = 0.5 ), from=0, to=40, n=40+1, type="h")pdf.plot(family=NBII, mu=10, sigma=0.5, min=0, max=40, step=1)# creating random variables and plot themtN <- table(Ni <- rNBII(1000, mu=5, sigma=0.5))r <- barplot(tN, col='lightblue')rm(h, tN, r)
NET Normal Exponential t distribution (NET) for fitting a GAMLSS
Description
This function defines the Power Exponential t distribution (NET), a four parameter distribution, fora gamlss.family object to be used for a GAMLSS fitting using the function gamlss(). Thefunctions dNET, pNET define the density and distribution function the NET distribution.
NET 39
Usage
NET(mu.link = "identity", sigma.link = "log")pNET(q, mu = 5, sigma = 0.1, nu = 1, tau = 2)dNET(y, mu = 0, sigma = 1, nu = 1.5, tau = 2, log = FALSE)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "inverse" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of nu parameter values
tau vector of tau parameter values
log logical; if TRUE, probabilities p are given as log(p).
Details
The NET distribution was introduced by Rigby and Stasinopoulos (1994) as a robust distribution fora response variable with heavier tails than the normal. The NET distribution is the abbreviation ofthe Normal Exponential Student t distribution. The NET distribution is a four parameter continuousdistribution, although in the GAMLSS implementation only the two parameters, mu and sigma,of the distribution are modelled with nu and tau fixed. The distribution takes its names becauseit is normal up to nu, Exponential from nu to tau (hence abs(nu)<=abs(tau)) and Student-twith nu*tau-1 degrees of freedom after tau. Maximum likelihood estimator of the third andforth parameter can be obtained, using the GAMLSS functions, find.hyper or prof.dev.
Value
NET() returns a gamlss.family object which can be used to fit a Box Cox Power Exponentialdistribution in the gamlss() function. dNET() gives the density, pNET() gives the distributionfunction.
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos, D. M. (1994), Robust fitting of an additive model for varianceheterogeneity, COMPSTAT : Proceedings in Computational Statistics, editors:R. Dutter and W.Grossmann, pp 263-268, Physica, Heidelberg.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
40 NO
Stasinopoulos D. M. Rigby R. A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, BCPE
Examples
NET() #data(abdom)# fit NET with nu=1 and tau=3h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=NET,
data=abdom, nu.start=2, tau.start=3)plot(h)rm(h)plot(function(x)dNET(x, mu=0,sigma=1,nu=2, tau=3), -5, 5)plot(function(x)pNET(x, mu=0,sigma=1,nu=2, tau=3), -5, 5)
NO Normal distribution for fitting a GAMLSS
Description
The function NO() defines the normal distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(), with mean equal to the param-eter mu and sigma equal the standard deviation. The functions dNO, pNO, qNO and rNO define thedensity, distribution function, quantile function and random generation for the NO parameterizationof the normal distribution. [A alternative parameterization with sigma equal to the variance isgiven in the function NO.var()]
Usage
NO(mu.link = "identity", sigma.link = "log")dNO(y, mu = 0, sigma = 1, log = FALSE)pNO(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qNO(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rNO(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y,q vector of quantiles
mu vector of location parameter values
NO 41
sigma vector of scale parameter valueslog, log.p logical; if TRUE, probabilities p are given as log(p).lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]p vector of probabilities.n number of observations. If length(n) > 1, the length is taken to be the
number required
Details
The parametrization of the normal distribution given in the function NO() is
f(y|µ, σ) =1√2πσ
exp[−1
2(y − µ
σ)2]
for y = (−∞,∞), µ = (−∞,+∞) and σ > 0.
Value
returns a gamlss.family object which can be used to fit a normal distribution in the gamlss()function.
Note
For the function NO(), µ is the mean and σ is the standard deviation (not the variance) of thenormal distribution.
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, NO.var
Examples
NO()# gives information about the default links for the normal distributiondat<-rNO(100)gamlss(dat~1,family=NO) # fits a constant for mu and sigmaplot(function(y) dNO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) pNO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) qNO(y, mu=10 ,sigma=2), 0, 1)
42 NO.var
NO.var Normal distribution (with variance as sigma parameter) for fitting aGAMLSS
Description
The function NO.var() defines the normal distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss()with mean equal to mu and vari-ance equal to sigma. The functions dNO.var, pNO.var, qNO.var and rNO.var define thedensity, distribution function, quantile function and random generation for this specific parameteri-zation of the normal distribution.
[A alternative parameterization with sigma as the standard deviation is given in the function NO()]
Usage
NO.var(mu.link = "identity", sigma.link = "log")dNO.var(y, mu = 0, sigma = 1, log = FALSE)pNO.var(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qNO.var(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rNO.var(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The parametrization of the normal distribution given in the function NO.var() is
f(y|µ, σ) =1√2πσ
exp[−1
2(y − µ)2
σ
]
for y = (−∞,∞), µ = (−∞,+∞) and σ > 0.
PE 43
Value
returns a gamlss.family object which can be used to fit a normal distribution in the gamlss()function.
Note
For the function NO(), µ is the mean and σ is the standard deviation (not the variance) of the normaldistribution. [The function NO.var() defines the normal distribution with σ as the variance.]
Author(s)
Mikis Stasinopoulos, Bob Rigby and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
NO()# gives information about the default links for the normal distributiondat<-rNO(100)gamlss(dat~1,family=NO) # fits a constant for mu and sigmaplot(function(y) dNO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) pNO(y, mu=10 ,sigma=2), 0, 20)plot(function(y) qNO(y, mu=10 ,sigma=2), 0, 1)
PE Power Exponential distribution for fitting a GAMLSS
Description
This function defines the Power Exponential distribution, a three parameter distribution, for agamlss.family object to be used in GAMLSS fitting using the function gamlss(). Thefunctions dPE, pPE, qPE and rPE define the density, distribution function, quantile function andrandom generation for the specific parameterization of the power exponential distribution.
44 PE
Usage
PE(mu.link = "identity", sigma.link = "log", nu.link = "log")dPE(y, mu = 0, sigma = 1, nu = 2, log = FALSE)pPE(q, mu = 0, sigma = 1, nu = 2, lower.tail = TRUE, log.p = FALSE)qPE(p, mu = 0, sigma = 1, nu = 2, lower.tail = TRUE, log.p = FALSE)rPE(n, mu = 0, sigma = 1, nu = 2)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
nu.link Defines the nu.link, with "log" link as the default for the nu parameter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of kurtosis parameter
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
Power Exponential distribution is defined as
f(y|µ, σ, ν) =ν exp[−( 1
2 )| zc |ν ]
σc2(1+1/ν)Γ( 1ν )
where c = [2−2/νΓ(1/ν)/Γ(3/ν)]0.5, for y = (−∞,+∞), µ = (−∞,+∞), σ > 0 and ν > 0.This parametrization was used by Nelson (1991) and ensures µ is the mean and σ is the standarddeviation of y (for all parameter values of µ, σ and ν within the rages above)
Value
returns a gamlss.family object which can be used to fit a Power Exponential distribution in thegamlss() function.
Note
µ is the mean and σ is the standard deviation of the Power Exponential distribution
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
PIG 45
References
Nelson, D.B. (1991) Conditional heteroskedasticity in asset returns: a new approach. Econometrica,57, 347-370.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
PE()# gives information about the default links for the Power Exponential distributiondata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=PE, data=abdom) # fitsplot(h)rm(h)# leptokurtoticplot(function(x) dPE(x, mu=10,sigma=2,nu=1), 0.0, 20,main = "The PE density mu=10,sigma=2,nu=1")# platykurtoticplot(function(x) dPE(x, mu=10,sigma=2,nu=4), 0.0, 20,main = "The PE density mu=10,sigma=2,nu=4")
PIG The Poisson-inverse Gaussian distribution for fitting a GAMLSS model
Description
The PIG() function defines the Poisson-inverse Gaussian distribution, a two parameter distribu-tion, for a gamlss.family object to be used in GAMLSS fitting using the function gamlss().The functions dPIG, pPIG, qPIG and rPIG define the density, distribution function, quantilefunction and random generation for the Poisson-inverse Gaussian PIG(), distribution.
Usage
PIG(mu.link = "log", sigma.link = "log")dPIG(y, mu = 0.5, sigma = 0.02, log = FALSE)pPIG(q, mu = 0.5, sigma = 0.02, lower.tail = TRUE, log.p = FALSE)qPIG(p, mu = 0.5, sigma = 0.02, lower.tail = TRUE, log.p = FALSE,
max.value = 10000)rPIG(n, mu = 0.5, sigma = 0.02)
46 PIG
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
y vector of (non-negative integer) quantiles
mu vector of positive means
sigma vector of positive despersion parameter
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
max.value a constant, set to the default value of 10000 for how far the algorithm shouldlook for q
Details
The probability function of the Poisson-inverse Gaussian distribution, is given by
f(y|µ, σ) =
(2α
π
12
)µye
1σ Ky− 1
2(α)
(ασ)yy!
where α2 = 1σ2 + 2µ
σ , for y = 0, 1, 2, ...,∞where µ > 0 and σ > 0 and Kλ(t) = 12
∫∞0
xλ−1 exp− 12 t(x+
x−1)dx is the modified Bessel function of the third kind. [Note that the above parameterizationwas used by Dean, Lawless and Willmot(1989). It is also a special case of the Sichel distributionSI() when ν = − 1
2 .]
Value
Returns a gamlss.family object which can be used to fit a Poisson-inverse Gaussian distributionin the gamlss() function.
Note
Author(s)
PO 47
References
Dean, C., Lawless, J. F. and Willmot, G. E., A mixed poisson-inverse-Gaussian regression model,Canadian J. Statist., 17, 2, pp 171-181
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, NBI, NBII, SI
Examples
PIG()# gives information about the default links for the Poisson-inverse Gaussian distribution#plot the pdf using plotplot(function(y) dPIG(y, mu=10, sigma = 1 ), from=0, to=50, n=50+1, type="h") # pdf# plot the cdfplot(seq(from=0,to=50),pPIG(seq(from=0,to=50), mu=10, sigma=1), type="h") # cdf# generate random sampletN <- table(Ni <- rPIG(100, mu=5, sigma=1))r <- barplot(tN, col='lightblue')# fit a model to the datagamlss(Ni~1,family=PIG)
PO Poisson distribution for fitting a GAMLSS model
Description
This function PO defines the Poisson distribution, an one parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The functions dPO, pPO, qPOand rPO define the density, distribution function, quantile function and random generation for thePoisson, PO(), distribution.
Usage
PO(mu.link = "log")dPO(y, mu = 1, log = FALSE)pPO(q, mu = 1, lower.tail = TRUE, log.p = FALSE)qPO(p, mu = 1, lower.tail = TRUE, log.p = FALSE)rPO(n, mu = 1)
48 PO
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
y vector of (non-negative integer) quantiles
mu vector of positive means
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
Details
Definition file for Poisson distribution.
f(y|µ) =e−µµy
Γ(y + 1)
for y = 0, 1, 2, ... and µ > 0.
Value
returns a gamlss.family object which can be used to fit a Poisson distribution in the gamlss()function.
Note
µ is the mean of the Poisson distribution
Author(s)
Bob Rigby 〈[email protected]〉, Mikis Stasinopoulos 〈[email protected]〉,and Kalliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Q.stats 49
Examples
PO()# gives information about the default links for the Poisson distribution# fitting data using PO()data(aids)h<-gamlss(y~cs(x,df=7)+qrt, family=PO, data=aids) # fits the constant+x+qrt modelplot(h)# plotting the distributionplot(function(y) dPO(y, mu=10 ), from=0, to=20, n=20+1, type="h")pdf.plot(family=PO, mu=10, min=0, max=20, step=1)# creating random variables and plot themtN <- table(Ni <- rPO(1000, mu=5))r <- barplot(tN, col='lightblue')rm(h, tN, r)
Q.stats A function to calculate the Q-statistics
Description
This function calculates and prints the Q-statistics which are useful to test normality of the residualswithin a range of an independent variable, for example age in centile estimation, see Royston andWright (2000).
Usage
Q.stats(obj, xvar = NULL, xcut.points = NULL, n.inter = 10, zvals = TRUE,save = TRUE, ...)
Arguments
obj a GAMLSS object or any other residual vector
xvar a unique explanatory variable
xcut.points the x-axis cut off points e.g. c(20,30). If xcut.points=NULL then then.inter argument is activated
n.inter if xcut.points=NULL this argument gives the number of intervals in whichthe x-variable will be split, with default 4
zvals if TRUE the output matix contains the individual z’s rather that Q statistics
save whether to save the Q-statistics or not with default equal to TRUE. In this casethe functions produce a matrix giving individual Q (or z) statistics and the finalaggregate Q’s
... for extra arguments
Details
50 RG
Value
A matrix containing the individual Q’s and the aggregate Q-statistics
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉,with contributions from Elaine Borghie
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Royston P. and Wright E. M. (2000) Goodness of fit statistics for the age-specific reference intervals.Statistics in Medicine, 19, pp 2943-2962.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, centiles.split, wp
Examples
data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom)Q.stats(h,xvar=abdom$x,n.inter=8)Q.stats(h,xvar=abdom$x,n.inter=8,zvals=FALSE)rm(h)
RG The Reverse Gumbel distribution for fitting a GAMLSS
Description
The function RG defines the reverse Gumbel distribution, a two parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The functions dRG, pRG, qRGand rRG define the density, distribution function, quantile function and random generation for thespecific parameterization of the reverse Gumbel distribution.
RG 51
Usage
RG(mu.link = "identity", sigma.link = "log")dRG(y, mu = 0, sigma = 1, log = FALSE)pRG(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)qRG(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)rRG(n, mu = 0, sigma = 1)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.other available link is "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other links are the "inverse" and "identity"
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
The specific parameterization of the reverse Gumbel distribution used in RG is
f(y|µ, σ) =1σ
exp−(
y − µ
σ
)− exp
[− (y − µ)
σ
]for y = (−∞,∞), µ = (−∞,+∞) and σ > 0.
Value
RG() returns a gamlss.family object which can be used to fit a Gumbel distribution in thegamlss() function. dRG() gives the density, pGU() gives the distribution function, qRG()gives the quantile function, and rRG() generates random deviates.
Note
The mean of the distribution is µ + 0.57722σ and the variance is π2σ2/6.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
52 SEP
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
plot(function(x) dRG(x, mu=0,sigma=1), -3, 6,main = "Reverse Gumbel density mu=0,sigma=1")RG()# gives information about the default links for the Gumbel distributiondat<-rRG(100, mu=10, sigma=2) # generates 100 random observationsgamlss(dat~1,family=RG) # fits a constant for each parameter mu and sigma
SEP The Skew Power exponential (SEP) distribution for fitting a GAMLSS
Description
This function defines the Skew Power exponential (SEP) distribution, a four parameter distribution,for a gamlss.family object to be used for a GAMLSS fitting using the function gamlss().The functions dSEP, pSEP, qSEP and rSEP define the density, distribution function, quantilefunction and random generation for the Skew Power exponential (SEP) distribution.
Usage
SEP(mu.link = "identity", sigma.link = "log", nu.link = "identity",tau.link = "log")
dSEP(y, mu = 0, sigma = 1, nu = 0, tau = 2, log = FALSE)pSEP(q, mu = 0, sigma = 1, nu = 0, tau = 2, lower.tail = TRUE,
log.p = FALSE)qSEP(p, mu = 0, sigma = 1, nu = 0, tau = 2, lower.tail = TRUE,
log.p = FALSE, lower.limit = mu - 5 * sigma,upper.limit = mu + 5 * sigma)
rSEP(n, mu = 0, sigma = 1, nu = 0, tau = 2)
SEP 53
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter.Other links are "1/mu2" and "log"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma param-eter. Other links are "inverse" and "identity"
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter.Other links are "1/nu2" and "log"
tau.link Defines the tau.link, with "log" link as the default for the tau parameter.Other links are "1/tau2", and "identity
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of skewness nu parameter values
tau vector of kurtosis tau parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
lower.limit lower limit for the golden search to find quantiles from probabilities
upper.limit upper limit for the golden search to find quantiles from probabilities
Details
The probability density function of the Skew Power exponential distribution, (SEP), is defined as
f(y|n, µ, σ ν, τ) ==z
σΦ(ω) fEP (z, 0, 1, τ)
for −∞ < y < ∞, µ = (−∞,+∞), σ > 0, ν = (−∞,+∞) and τ > 0. where z = y−µσ ,
ω = sign(z)|z|τ/2ν√
2/τ and fEP (z, 0, 1, τ) is the pdf of an Exponential Power distribution.
This is a reparameterization of the original Johnson Su distribution, Johnson (1954), so the param-eters mu and sigma are the mean and the standard deviation of the distribution. The parameternu determines the skewness of the distribution with nu>0 indicating positive skewness and nu<0negative. The parameter tau determines the kurtosis of the distribution. tau should be positiveand most likely in the region from zero to 1. As tau goes to 0 (and for nu=0) the distributionapproaches the the Normal density function. The distribution is appropriate for leptokurtic data thatis data with kurtosis larger that the Normal distribution one.
Value
SEP() returns a gamlss.family object which can be used to fit the SEP distribution in thegamlss() function. dSEP() gives the density, pSEP() gives the distribution function, qSEP()gives the quantile function, and rSEP() generates random deviates.
54 SI
Warning
The qSEP and rSEP are slow since they are relying on golden section for finding the quantiles
Note
Author(s)
Bob Rigby 〈[email protected]〉 and Mikis Stasinopoulos 〈[email protected]〉
References
Diciccio, T. J. and Mondi A. C. (2004). Inferential Aspects of the Skew Exponential Power distri-bution., JASA, 99, 439-450.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M. Rigby R. A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, JSU, BCT
Examples
SEP() #plot(function(x)dSEP(x, mu=0,sigma=1, nu=1, tau=2), -5, 5,main = "The SEP density mu=0,sigma=1,nu=1, tau=2")plot(function(x) pSEP(x, mu=0,sigma=1,nu=1, tau=2), -5, 5,main = "The BCPE cdf mu=0, sigma=1, nu=1, tau=2")dat<-rSEP(100,mu=10,sigma=1,nu=-1,tau=1.5)gamlss(dat~1,family=SEP, control=gamlss.control(n.cyc=30))
SI The Sichel dustribution for fitting a GAMLSS model
Description
The SI() function defines the Sichel distribution, a three parameter discrete distribution, for agamlss.family object to be used in GAMLSS fitting using the function gamlss(). The func-tions dSI, pSI, qSI and rSI define the density, distribution function, quantile function and ran-dom generation for the Sichel SI(), distribution.
SI 55
Usage
SI(mu.link = "log", sigma.link = "log", nu.link = "identity")dSI(y, mu = 0.5, sigma = 0.02, nu = -0.5, log = FALSE)pSI(q, mu = 0.5, sigma = 0.02, nu = -0.5, lower.tail = TRUE,
log.p = FALSE)qSI(p, mu = 0.5, sigma = 0.02, nu = -0.5, lower.tail = TRUE,
log.p = FALSE, max.value = 10000)rSI(n, mu = 0.5, sigma = 0.02, nu = -0.5)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
nu.link Defines the nu.link, with "identity" link as the default for the nu parameter
y vector of (non-negative integer) quantiles
mu vector of positive mu
sigma vector of positive despersion parameter
nu vector of nu
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
max.value a constant, set to the default value of 10000 for how far the algorithm shouldlook for q
Details
The probability function of the Sichel distribution is given by
f(y|µ, σ, ν) =µyKy+ν(α)
(ασ)y+νy!Kν( 1σ )
where α2 = 1σ2 + 2µ
σ , for y = 0, 1, 2, ...,∞ where µ > 0 , σ > 0 and −∞ < ν < ∞ andKλ(t) = 1
2
∫∞0
xλ−1 exp− 12 t(x + x−1)dx is the modified Bessel function of the third kind.
Note that the above parameterization is different from Stein, Zucchini and Juritz (1988) who use theabove probability function but treat µ, α and ν as the parameters. Note that σ = [(µ2+α2)
12 −µ]−1.
Value
Returns a gamlss.family object which can be used to fit a Sichel distribution in the gamlss()function.
56 TF
Note
Author(s)
Akantziliotou C., Rigby, R. A. and Stasinopoulos D. M.
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2003) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
Stein, G. Z., Zucchini, W. and Juritz, J. M. (1987). Parameter Estimation of the Sichel Distributionand its Multivariate Extension. Journal of American Statistical Association, 82, 938-944.
See Also
gamlss, gamlss.family, PIG, NBI, NBII
Examples
SI()# gives information about the default links for the Sichel distribution#plot the pdf using plotplot(function(y) dSI(y, mu=10, sigma=1, nu=1), from=0, to=100, n=100+1, type="h") # pdf# plot the cdfplot(seq(from=0,to=100),pSI(seq(from=0,to=100), mu=10, sigma=1, nu=1), type="h") # cdf# generate random sampletN <- table(Ni <- rSI(100, mu=5, sigma=1, nu=1))r <- barplot(tN, col='lightblue')# fit a model to the datagamlss(Ni~1,family=SI, control=gamlss.control(n.cyc=50))
TF t family distribution for fitting a GAMLSS
Description
The function TF defines the t-family distribution, a three parameter distribution, for a gamlss.familyobject to be used in GAMLSS fitting using the function gamlss(). The functions dTF, pTF, qTFand rTF define the density, distribution function, quantile function and random generation for thespecific parameterization of the t distribution given in details below, with mean equal to µ andstandard deviation equal to σ( ν
ν−2 )0.5 with the degrees of freedom ν
TF 57
Usage
TF(mu.link = "identity", sigma.link = "log", nu.link = "log")dTF(y, mu = 0, sigma = 1, nu = 10, log = FALSE)pTF(q, mu = 0, sigma = 1, nu = 10, lower.tail = TRUE, log.p = FALSE)qTF(p, mu = 0, sigma = 1, nu = 10, lower.tail = TRUE, log.p = FALSE)rTF(n, mu = 0, sigma = 1, nu = 10)
Arguments
mu.link Defines the mu.link, with "identity" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
nu.link Defines the nu.link, with "log" link as the default for the nu parameter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of the degrees of freedom parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
Details
Definition file for t family distribution.
f(y|µ, σ, ν) =Γ((ν + 1)/2)
σΓ(1/2)Γ(ν/2)ν0.5
[1 +
(y − µ)2
νσ2
]−(ν+1)/2
y = (−∞,+∞), µ = (−∞,+∞), σ > 0 and ν > 0. Note that z = (y − µ)/σ has a standard tdistribution with degrees of freedom ν.
Value
TF() returns a gamlss.family object which can be used to fit a t distribution in the gamlss()function. dTF() gives the density, pTF() gives the distribution function, qTF() gives the quan-tile function, and rTF() generates random deviates. The latest functions are based on the equiva-lent R functions for gamma distribution.
Note
µ is the mean and σ[ν/(ν − 2)]0.5 is the standard deviation of the t family distribution. ν > 0 is apositive real valued parameter.
58 VGD
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Kalliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
TF()# gives information about the default links for the t-family distributiondata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=TF, data=abdom) # fitsplot(h)newdata<-rTF(1000,mu=0,sigma=1,nu=5) # generates 1000 random observationshist(newdata)rm(h,newdata)
VGD Validation global deviance
Description
This function helps to validate a GAMLSS model by randomly splitting the data into training(around 60%) and validation (around 40%) sets. It minimizes the global deviance for the trainingdata set and then uses the validation set to calculate the global deviance. The resulting validationglobal deviance (VGD) can be used for selecting the distribution, the terms in the model or a degreesof freedom for smoothing.
Usage
VGD(formula = NULL, sigma.fo = ~1, nu.fo = ~1, tau.fo = ~1,data = NULL, family = NO,control = gamlss.control(trace = FALSE), rand = NULL, ...)
VGD 59
Arguments
formula a gamlss formula for mu (including the response on the left)
sigma.fo a formula for sigma
nu.fo a formula for nu
tau.fo a formula for tau
data the data set used for the fitting
family a gamlss.family object
control gamlss.control to be passed to gamlss
rand a random vector of one and two indicating whether is the trainining set (1)or the validation set (2) i.e. created in advance using something like rand<- sample(2, N, replace=T, prob=c(0.6,0.4)) where N is thelength of the data
... for extra arguments to be passed in the gamlss fit
Details
Value
Rerurns a validated global deviance
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss.family, gamlss, deviance.gamlss
60 WEI
Examples
data(abdom)# generate the random split of the datarand <- sample(2, 610, replace=TRUE, prob=c(0.6,0.4))# the proportions in the sampletable(rand)/610VGD(y~cs(x,df=2),sigma.fo=~cs(x,df=1), data=abdom, family=LO, rand=rand)
WEI Weibull distribution for fitting a GAMLSS
Description
The function WEI can be used to define the Weibull distribution, a two parameter distribution, for agamlss.family object to be used in GAMLSS fitting using the function gamlss(). [Note thatthe GAMLSS function WEI2 uses a different parameterization for fitting the Weibull distribution.]The functions dWEI, pWEI, qWEI and rWEI define the density, distribution function, quantilefunction and random generation for the specific parameterization of the Weibul distribution.
Usage
WEI(mu.link = "log", sigma.link = "log")dWEI(y, mu = 1, sigma = 1, log = FALSE)pWEI(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qWEI(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)rWEI(n, mu = 1, sigma = 1)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter, otherlinks are "inverse" and "identity"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other link is the "inverse" and "identity"
y,q vector of quantiles
mu vector of the mu parameter
sigma vector of sigma parameter
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
WEI 61
Details
The parameterization of the function WEI is given by
f(y|µ, σ) =σyσ−1
µσexp
[−(
y
µ
)σ]for y > 0, µ > 0 and σ > 0. The GAMLSS functions dWEI, pWEI, qWEI, and rWEI can be usedto provide the pdf, the cdf, the quantiles and random generated numbers for the Weibull distributionwith argument mu, and sigma. [See the GAMLSS function WEI2 for a different parameterizationof the Weibull.]
Value
WEI() returns a gamlss.family object which can be used to fit a Weibull distribution in thegamlss() function. dWEI() gives the density, pWEI() gives the distribution function, qWEI()gives the quantile function, and rWEI() generates random deviates. The latest functions are basedon the equivalent R functions for Weibull distribution.
Note
The mean in WEI is given by µΓ( 1σ + 1) and the variance µ2
[Γ( 2
σ + 1)− (Γ( 1σ + 1))2
]Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, WEI2
Examples
WEI()dat<-rWEI(100, mu=10, sigma=2)gamlss(dat~1, family=WEI)
62 WEI2
WEI2 A specific parameterization of the Weibull distribution for fitting aGAMLSS
Description
The function WEI2 can be used to define the Weibull distribution, a two parameter distribution, fora gamlss.family object to be used in GAMLSS fitting using the function gamlss(). This isthe parameterization of the Weibull distribution usually used in proportional hazard models and isdefined in details below. [Note that the GAMLSS function WEI uses a different parameterizationfor fitting the Weibull distribution.] The functions dWEI2, pWEI2, qWEI2 and rWEI2 define thedensity, distribution function, quantile function and random generation for the specific parameteri-zation of the Weibull distribution.
Usage
WEI2(mu.link = "log", sigma.link = "log")dWEI2(y, mu = 1, sigma = 1, log = FALSE)pWEI2(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)qWEI2(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)rWEI2(n, mu = 1, sigma = 1)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter, otherlinks are "inverse" and "identity"
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter, other link is the "inverse" and "identity"
y,q vector of quantilesmu vector of the mu parameter valuessigma vector of sigma parameter valueslog, log.p logical; if TRUE, probabilities p are given as log(p).lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]p vector of probabilities.n number of observations. If length(n) > 1, the length is taken to be the
number required
Details
The parameterization of the function WEI2 is given by
f(y|µ, σ) = σµyσ−1e−µyσ
for y > 0, µ > 0 and σ > 0. The GAMLSS functions dWEI2, pWEI2, qWEI2, and rWEI2 canbe used to provide the pdf, the cdf, the quantiles and random generated numbers for the Weibulldistribution with argument mu, and sigma. [See the GAMLSS function WEI for a different param-eterization of the Weibull.]
ZAIG 63
Value
WEI2() returns a gamlss.family object which can be used to fit a Weibull distribution inthe gamlss() function. dWEI2() gives the density, pWEI2() gives the distribution function,qWEI2() gives the quantile function, and rWEI2() generates random deviates. The latest func-tions are based on the equivalent R functions for Weibull distribution.
Warning
In WEI2 the estimated parameters mu and sigma can be highly correlated so it is advisable to usethe CG() method for fitting [as the RS() method can be veru slow in this situation.]
Note
The mean in WEI2 is given by µ−1/σΓ( 1σ + 1) and the variance µ−2/σ(Γ( 2
σ + 1)−[Γ( 1
σ + 1)]2)
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, WEI
Examples
WEI2()dat<-rWEI(100, mu=.1, sigma=2)gamlss(dat~1, family=WEI2, method=CG())
ZAIG The zero adjusted Inverse Gaussian distribution for fitting a GAMLSSmodel
64 ZAIG
Description
The function ZAIG() defines the zero adjusted Inverse Gaussian distribution, a three parame-ter distribution, for a gamlss.family object to be used in GAMLSS fitting using the functiongamlss(). The zero adjusted Inverse Gaussian distribution is similar to the Inverse Gaussiandistribution but allows zeros as y values. The extra parameter models the probabilities at zero.The functions dZAIG, pZAIG, qZAIG and rZAIG define the density, distribution function, quan-tile function and random generation for the ZAIG parameterization of the zero adjusted InverseGaussian distribution. plotZAIG can be used to plot the distribution. meanZAIG calculates theexpected value of the response for a fitted model.
Usage
ZAIG(mu.link = "log", sigma.link = "log", nu.link = "logit")dZAIG(y, mu = 1, sigma = 1, nu = 0.1, log = FALSE)pZAIG(q, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE, log.p = FALSE)qZAIG(p, mu = 1, sigma = 1, nu = 0.1, lower.tail = TRUE, log.p = FALSE,
lower.limit = nu, upper.limit = mu + 10 * sqrt(sigma^2 * mu^3))rZAIG(n, mu = 1, sigma = 1, nu = 0.1, ...)plotZAIG(mu = 5, sigma = 1, nu = 0.1, from = 0, to = 10, n = 101, ...)meanZAIG(obj)
Arguments
mu.link Defines the mu.link, with "log" link as the default for the mu parameter
sigma.link Defines the sigma.link, with "log" link as the default for the sigma parame-ter
nu.link Defines the nu.link, with "logit" link as the default for the sigma parameter
y,q vector of quantiles
mu vector of location parameter values
sigma vector of scale parameter values
nu vector of probability at zero parameter values
log, log.p logical; if TRUE, probabilities p are given as log(p).
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
lower.limit the argument lower.limit sets the lower limit in the golden section searchfor q, the default is nu
upper.limit the argument upper.limit sets the upper limit in the golden section searchfor q, the default is 10 time its standard deviation
p vector of probabilities.
n number of observations. If length(n) > 1, the length is taken to be thenumber required
from where to start plotting the distribution from
to up to where to plot the distribution
obj a fitted BEINF object
... ... can be used to pass the uppr.limit argument to qIG
ZAIG 65
Details
The Zero adjusted IG distribution is given as
f(y|µ, σ ν) = ν
if (y=0)
f(y|µ, σ, ν) = (1− ν)1√
2πσ2y3exp(− (y − µ)2
2µ2σ2y)
otherwise
for y = (0,∞), µ > 0, σ > 0 and 0 < ν < 1. E(y) = (1−ν)µ and V ar(y) = (1−ν)µ2(ν+µσ2).
Value
returns a gamlss.family object which can be used to fit a zero adjusted inverse Gaussian dis-tribution in the gamlss() function.
Note
Author(s)
Bob Rigby and Mikis Stasinopoulos
References
Heller, G. Stasinopoulos M and Rigby R.A. (2006) The zero-adjusted Inverse Gaussian distributionas a model for insurance claims. in Proceedings of the 21th International Workshop on StatistialModelling, eds J. Hinde, J. Einbeck and J. Newell, pp 226-233, Galway, Ireland.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, IG
Examples
ZAIG()# gives information about the default links for the ZAIG distribution# plotting the distributionplotZAIG( mu =10 , sigma=.5, nu = 0.1, from = 0, to=10, n = 101)# plotting the cdfplot(function(y) pZAIG(y, mu=10 ,sigma=.5, nu = 0.1 ), 0, 1)# plotting the inverse cdfplot(function(y) qZAIG(y, mu=10 ,sigma=.5, nu = 0.1 ), 0.001, .99)# generate random numbers
66 ZIP
dat <- rZAIG(100,mu=10,sigma=.5, nu=.1)# fit a model to the datam1<-gamlss(dat~1,family=ZAIG)meanZAIG(m1)[1]
ZIP Zero inflated poisson distribution for fitting a GAMLSS model
Description
The function ZIP defines the zero inflated Poisson distribution, a two parameter distribution, fora gamlss.family object to be used in GAMLSS fitting using the function gamlss(). Thefunctions dZIP, pZIP, qZIP and rZIP define the density, distribution function, quantile functionand random generation for the inflated poisson, ZIP(), distribution.
Usage
ZIP(mu.link = "log", sigma.link = "logit")dZIP(y, mu = 5, sigma = 0.1, log = FALSE)pZIP(q, mu = 5, sigma = 0.1, lower.tail = TRUE, log.p = FALSE)qZIP(p, mu = 5, sigma = 0.1, lower.tail = TRUE, log.p = FALSE)rZIP(n, mu = 5, sigma = 0.1)
Arguments
mu.link defines the mu.link, with "log" link as the default for the mu parameter
sigma.link defines the sigma.link, with "logit" link as the default for the sigma param-eter which in this case is the probability at zero. Other links are "probit" and"cloglog"’(complementary log-log)
y vector of (non-negative integer) quantiles
mu vector of positive means
sigma vector of probabilities at zero
p vector of probabilities
q vector of quantiles
n number of random values to return
log, log.p logical; if TRUE, probabilities p are given as log(p)
lower.tail logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]
ZIP 67
Details
Let Y = 0 with probability σ and Y ∼ Po(µ) with probability (1 − σ) the Y has a Zero inflatedPoisson Distribution given by
f(y) = σ + (1− σ)e−µ
if (y=0)
f(y) = (1− σ)e−µµy
y!
if (y>0) for y = 0, 1, ...,.
Value
returns a gamlss.family object which can be used to fit a zero inflated poisson distribution inthe gamlss() function.
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Lambert, D. (1992), Zero-inflated Poisson Regression with an application to defects in Manufactur-ing, Technometrics, 34, pp 1-14.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family, PO
Examples
ZIP()# gives information about the default links for the normal distribution# creating data and plotting themdat<-rZIP(1000, mu=5, sigma=.1)r <- barplot(table(dat), col='lightblue')# fit the disteibutionmod1<-gamlss(dat~1, family=ZIP)# fits a constant for mu and sigmafitted(mod1)[1]fitted(mod1,"sigma")[1]
68 abdom
abdom Abdominal Circumference Data
Description
The abdom data frame has 610 rows and 2 columns. The data are measurements of abdominalcircumference (response variable) taken from fetuses during ultrasound scans at Kings CollegeHospital, London, at gestational ages (explanatory variable) ranging between 12 and 42 weeks.
Usage
data(abdom)
Format
This data frame contains the following columns:
y abdominal circumference: a numeric vector
x gestational age: a numeric vector
Details
The data were used to derived reference intervals by Chitty et al. (1994) and also for comparingdifferent reference centile methods by Wright and Royston (1997), who also commented that thedistribution of Z-scores obtained from the different fitted models ’has somewhat longer tails thanthe normal distribution’.
Source
Dr. Eileen M. Wright, Department of Medical Statistics and Evaluation, Royal Postgraduate Medi-cal School, Du Cane Road, London, W12 0NN.
References
Chitty, L.S., Altman, D.G., Henderson, A. and Campbell, S. (1994) Charts of fetal size: 3, abdomi-nal measurement. Br. J. Obstet. Gynaec., 101: 125–131
Wright, E. M. and Royston, P. (1997). A comparison of statistical methods for age-related referenceintervals. J.R.Statist.Soc. A., 160: 47–69.
Examples
data(abdom)attach(abdom)plot(x,y)detach(abdom)
additive.fit 69
additive.fit Implementing Backfitting in GAMLSS
Description
This function is not to be used on its own. It is used for backfitting in the GAMLSS fitting al-gorithms and it is based on the equivalent function written by Trevor Hastie in the gam() S-plusimplementation, (Chambers and Hastie, 1991).
Usage
additive.fit(x, y, w, s, who, smooth.frame, maxit = 30, tol = 0.001,trace = FALSE, se = TRUE, ...)
Arguments
x the linear part of the explanatory variables
y the response variable
w the weights
s the matrix containing the smoothers
who the current smoothers
smooth.frame the data frame used for the smoothers
maxit maximum number of iterations in the backfitting
tol the tolerance level for the backfitting
trace whether to trace the backfitting algorithm
se whether standard errors are required
... for extra arguments
Details
This function should not be used on its own
Value
Returns a list with the linear fit plus the smothers
Note
Author(s)
Mikis Stasinopoulos
70 aep
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
aep The Hospital Stay Data
Description
The data, 1383 observations, are from a study at the Hospital del Mar, Barcelona during the years1988 and 1990, Gange et al. (1996).
Usage
data(aep)
Format
A data frame with 1383 observations on the following 8 variables.
los the total number of days patients spent in hospital: a discrete vector
noinap the number of inappropriate days spent in hospital: a discrete vector
loglos the log(los/10): a numeric vector
sex the gender of patient: a factor with levels 1=male, 2=female
ward the type of ward in the hospital: a factor with levels 1=medical 2=surgical, 3=others
year the specific year 1988 or 1990: a factor with levels 88 and 90
age the age of the patient subtracted from 55: a numeric vector
y the response variable a matrix with 2 columns, the first is noinap the second is equal to (los-noinap)
Details
Gange et al. (1996) used a logistic regression model for the number of inappropriate days (noinap)out of the total number of days spent in hospital (los), with binomial and beta binomial errors andfound that the later provided a better fit to the data. They modelled both the mean and the dispersionof the beta binomial distribution (BB) as functions of explanatory variables
aids 71
Source
References
Gange, S. J. Munoz, A. Saez, M. and Alonso, J. (1996) Use of the beta-binomial distribution tomodel the effect of policy changes on appropriateness of hospital stays. Appl. Statist, 45, 371–382
Examples
data(aep)attach(aep)pro<-noinap/losplot(ward,pro)rm(pro)detach(aep)
aids Aids Cases in England and Wales
Description
The quarterly reported AIDS cases in the U.K. from January 1983 to March 1994 obtained from thePublic Health Laboratory Service, Communicable Disease Surveillance Centre, London.
Usage
data(aids)
Format
A data frame with 45 observations on the following 3 variables.
y the number of quarterly aids cases in England and Wales: a numeric vector
x time in months from January 1983, 1:45 : a numeric vector
qrt the quarterly seasonal effect a factor with 4 levels, [1=Q1 (Jan-March), 2=Q2 (Apr-June), 3=Q3(July-Sept), 4=Q4 (Oct-Dec)]
Details
The counts y can be modelled using a (smooth) Poisson regression model in time x with the quar-terly effects i.e. cs(x,df=7)+qrt. Overdispersion persists, so use a Negative Binomial distribution oftype I or II. The data also can be used to find a break point in time, see Rigby and Stasinopoulos(1992).
Source
Public Health Laboratory Service, Communicable Disease Surveillance Centre, London.
72 db
References
Stasinopoulos, D.M. and Rigby, R. A. (1992). Detecting break points in generalized linear models.Computational Statistics and Data Analysis, 13, 461–471.
Examples
data(aids)attach(aids)plot(x,y,pch=21,bg=c("red","green3","blue","yellow")[unclass(qrt)])detach(aids)
db Head Circumference of Dutch Boys
Description
The data are comming from the Fourth Dutch Growth Study, Fredriks et al. (2000a, 2000b), whichis a cross-sectional study that measures growth and development of the Dutch population betweenthe ages 0 and 21 years. The study measured, among other variables, height, weight, head circum-ference and age for 7482 males and 7018 females. Here we have the only the head circumferenceof Dutch boys.
Usage
data(db)
Format
A data frame with 7040 observations on the following 2 variables.
head head circumference
age age in years
Details
Source
The data were kindly given by professor Stef. van Buuren.
bfp 73
References
Fredriks, A.M. van Buuren, S. Burgmeijer, R.J.F. Meulmeester, J.F. Beuker, R.J. Brugman, E.Roede, M.J. Verloove-Vanhorick, S.P. and Wit, J. M. (2000a), Continuing positive secular changein The Netherlands, 1955-1997, Pediatric Research, 47, 316–323
Fredriks, A.M. van Buuren, S. Wit, J.M. and Verloove-Vanhorick, S. P. (2000b) Body index mea-surments in 1996-7 compared with 1980, Archives of Childhood Diseases, 82, 107–112
van Buuren and Fredriks M. (2001) Worm plot: simple diagnostic device for modelling growthreference curves. Statistics in Medicine, 20, 1259–1277
Examples
data(db)attach(db)plot(age,head)detach(db)
bfp Functions to fit fractional polynomials in GAMLSS
Description
The function bfp generate a power polynomial basis matrix which (for given powers) can be usedto fit power polynomials in one x-variable. The function fp takes a vector and returns it withseveral attributes. The vector is used in the construction of the model matrix. The function fp()is not used for fitting the fractional polynomial curves but assigns the attributes to the vector to aidgamlss in the fitting process. The function doing the fitting is gamlss.fp() which is used at thebackfitting function additive.fit (but never used on its own). The (experimental) function ppcan be use to fit power polynomials as in a+ b1x
p1 + b2xp2 ., where p1 and p2 have arbitrary values
rather restricted as in the fp function.
Usage
bfp(x, powers = c(1, 2), shift = NULL, scale = NULL)fp(x, npoly = 2, shift = NULL, scale = NULL)pp(x, start = list(), shift = NULL, scale = NULL)
Arguments
x the explanatory variable to be used in functions bfp() or fp(). Note that thisis different from the argument x use in gamlss.fp (a function used in thebackfitting but not by straight by the user)
powers a vector containing as elements the powers in which the x has to be raised
shift a number for shifting the x-variable. The default values is zero, if x is positive,or the minimum of the positive difference in x minus the minimum of x
scale a positive number for scalling the x-variable. The default values is 10(sign(log10(range)))∗trunc(abs(log10(range)))
74 bfp
npoly a positive indicating how many fractional polynomials should be considered inthe fit. Can take the values 1, 2 or 3 with 2 as default
start a list containing the starting values for the non-linear maximization to find thepowers. The results from fitting the equivalent fractional polynomials can beused here
Details
The above functions are an implementation of the fractional polynomials introduced by Roystonand Altman (1994). The three functions involved in the fitting are loosely based on the fractionalpolynomials implementation in S-plus written by Gareth Amber. The function bfp generates theright design matrix for the fitting a power polynomial of the type a+b1x
p1 +b2xp2 +. . .+bkxp
k. Forgiven powers p1, p2, . . . , pk given as the argument powers in bfp() the function can be used to fitpower polynomials in the same way as the functions poly() or bs() (of package splines) areused to fit orthogonal or piecewise polynomials respectively. The function fp(), which is workingas a smoother in gamlss, is used to fit the best fractional polynomials within a set of power values.Its argument npoly determines whether one, two or three fractional polynomials should used in thefitting. For a fixed number npoly the algorithm looks for the best fitting fractional polynomials inthe list c(-2, -1, -0.5, 0, 0.5, 1, 2, 3) . Note that npolu=3 is rather slow sinceit fits all possible combinations 3-way combinations at each backfitting interaction. The functiongamlss.fp() is an internal function of GAMLSS allowing the fractional polynomials to be fittedin the backfitting cycle of gamlss, and should be not used on its own.
Value
The function bfp returns a matrix to be used as part of the design matrix in the fitting.
The function fp returns a vector with values zero to be included in the design matrix but withattributes useful in the fitting of the fractional polynomials algorithm in gamlss.fp.
Warning
Since the model constant is included in both the design matrix X and in the backfitting part offractional polynomials, its values is wrongly given in the summary. Its true values is the modelconstant minus the constant from the fractional polynomial fitting ??? What happens if more thatone fractional polynomials are fitted?
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Amber G. (1999) Fracial polynomials in S-plus, http://lib.stat.cmu.edu/S/fracpoly.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
centiles 75
Royston, P. and Altman, D. G., (1994). Regression using fractional polynomials of continuouscovariates: parsimonious parametric modelling (with discussion), Appl. Statist., 43, 429-467.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
data(abdom)#fits polynomials with power 1 and .5mod1<-gamlss(y~bfp(x,c(1,0.5)),data=abdom)# fit the best of one fractional polynomialm1<-gamlss(y~fp(x,1),data=abdom)# fit the best of two fractional polynomialsm2<-gamlss(y~fp(x,2),data=abdom)# fit the best of three fractional polynomialsm3<-gamlss(y~fp(x,3),data=abdom)# get the coefficient for the second modelm2$mu.coefSmo# now power polynomials using the best 2 fp c()m4 <- gamlss(y ~ pp(x, c(1,3)), data = abdom)# This is not good idea in this case because# if you look at the fitted values you see what it went wrongplot(y~x,data=abdom)lines(fitted(m2,"mu")~abdom$x,col="red")lines(fitted(m4,"mu")~abdom$x,col="blue")
centiles Plots the centile curves for a GAMLSS object
Description
This function plots centiles curves for distributions belonging to the GAMLSS family of distribu-tions. The function also tabulates the sample percentages below each centile curve (for comparisonwith the model percentages given by the argument cent.) A restriction of the function is that itapplies to models with one explanatory variable only.
Usage
centiles(obj, xvar = NULL, cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6),legend = TRUE, ylab = "y", xlab = "x", xleg = min(xvar),yleg = max(obj$y), xlim = range(xvar), ylim = range(obj$y),save = FALSE, plot = TRUE, ...)
76 centiles
Arguments
obj a fitted gamlss object from fitting a gamlss distribution
xvar the unique explanatory variable
cent a vector with elements the % centile values for which the centile curves have tobe evaluated
legend whether a legend is required in the plot or not, the default is legent=TRUE
ylab the y-variable label
xlab the x-variable label
xleg position of the legend in the x-axis
yleg position of the legend in the y-axis
xlim the limits of the x-axis
ylim the limits of the y-axis
save whether to save the sample percentages or not with default equal to FALSE. Inthis case the sample percentages are printed but are not saved
plot whether to plot the centiles. This option is useful for centile.split
... for extra arguments
Details
Value
A centile plot is produced and the sample centiles below each centile curve are printed (or saved)
Warning
This function is appropriate only when one continuous explanatory variable is fitted in the model
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
centiles.com 77
See Also
gamlss, centiles.split , centiles.com
Examples
data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom)centiles(h,xvar=abdom$x)rm(h)
centiles.com Comparing centiles from different GAMLSS models
Description
This function compares centiles curves for more than one GAMLSS objects. It is based on thecentiles function. The function also tabulates the sample percentages below each centile curve(for comparison with the model percentages given by the argument cent.) A restriction of thefunction is that it applies to models with one explanatory variable only.
Usage
centiles.com(obj, ..., xvar = NULL, cent = c(0.4, 10, 50, 90, 99.6),legend = TRUE, ylab = "y", xlab = "x", xleg = min(xvar),yleg = max(obj$y), xlim = range(xvar), ylim = NULL,no.data = FALSE, color = TRUE, plot = TRUE)
Arguments
obj a fitted gamlss object from fitting a gamlss continuous distribution... optionally more fitted GAMLSS model objectsxvar the unique explanatory variablecent a vector with elements the % centile values for which the centile curves have to
be evaluatedlegend whether a legend is required in the plot or not, the default is legent=TRUEylab the y-variable labelxlab the x-variable labelxleg position of the legend in the x-axisyleg position of the legend in the y-axisxlim the limits of the x-axisylim the limits of the y-axisno.data whether the data should plotted, default no.data=FALSE or not no.data=TRUEcolor whether the fitted centiles are shown in colour, color=TRUE (the default) or
not color=FALSEplot whether to plot the centiles
78 centiles.com
Details
Value
Centile plots are produced for the different fitted models and the sample centiles below each centilecurve are printed
Warning
This function is appropriate only when one continuous explanatory variable is fitted in the model
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, centiles , centiles.split
Examples
data(abdom)h1<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom)h2<-gamlss(y~lo(x,span=0.4), sigma.formula=~lo(x,span=0.4), family=BCT, data=abdom )centiles.com(h1,h2,xvar=abdom$x)rm(h1,h2)
centiles.pred 79
centiles.pred Creating predictive centiles values
Description
This function creates predictive centiles curves for new x-values given a GAMLSS fitted model.The function has three options: i) for given new x-values and given percentage centiles calculatesa matrix containing the centiles values for y, ii) for given new x-values and standard normalizedcentile values calculates a matrix containing the centiles values for y, iii) for given new x-valuesand new y-values calculates the z-scores. A restriction of the function is that it applies to modelswith only one explanatory variable.
Usage
centiles.pred(obj, type = c("centiles", "z-scores", "standard-centiles"),xname = NULL, xvalues = NULL, power = NULL, yval = NULL,cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6),dev = c(-4, -3, -2, -1, 0, 1, 2, 3, 4),plot = FALSE, legend = TRUE,...)
Arguments
obj a fitted gamlss object from fitting a gamlss continuous distribution
type the default, "centiles", gets the centiles values given in the option cent. type="standard-centiles" gets the standard centiles given in the dev. type="z-scores"gets the z-scores for given y and x new values
xname the name of the unique explanatory variable (it has to be the same as in theoriginal fitted model)
xvalues the new values for the explanatory variable where the prediction will take place
power if power transformation is needed (but read the note below)
yval the response values for a given x required for the calculation of "z-scores"
cent a vector with elements the % centile values for which the centile curves have tobe evaluated
dev a vector with elements the standard normalized values for which the centilecurves have to be evaluated in the option type="standard-centiles"
plot whether to plot the "centiles" or the "standard-centiles", the default is plot=FALSE
legend whether a legend is required in the plot or not, the default is legent=TRUE
... for extra arguments
Details
80 centiles.pred
Value
a vector (for option type="z-scores") or a matrix for options type="centiles" or type="standard-centiles" containing the appropriate values
Warning
See example below of how to use the function when power transofrmation is used for the x-variables
Note
The power option should be only used if the model
Author(s)
Mikis Stasinopoulos , 〈[email protected]〉, based on ideas of Elaine Borghie fromthe World Health Organization
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, centiles, centiles.split
Examples
# bring the data and fit the modeldata(abdom)a<-gamlss(y~cs(x),sigma.fo=~cs(x), data=abdom, family=BCT)#plot the centilescentiles(a,xvar=abdom$x)# calculate the centiles at new x valuesnewx<-seq(12,40,2)mat <- centiles.pred(a, xname="x", xvalues=newx )mat# now plot the centilesmat <- centiles.pred(a, xname="x",xvalues=newx, plot=TRUE )# calculate standard-centiles for new x values using the fitted modelnewx <- seq(12,40,2)mat <- centiles.pred(a, xname="x",xvalues=newx, type="standard-centiles" )mat# now plot the centilesmat <- centiles.pred(a, xname="x",xvalues=newx, type="s", plot = TRUE )# create new y and x values and plot them in the previous plotnewx <- c(20,21.2,23,20.9,24.2,24.1,25)newy <- c(130,121,123,125,140,145,150)
centiles.split 81
for(i in 1:7) points(newx[i],newy[i],col="blue")# now calculate their z-scoresznewx <- centiles.pred(a, xname="x",xvalues=newx,yval=newy, type="z-scores" )znewx# now with transformed x-variable within the formulaaa<-gamlss(y~cs(x^0.5),sigma.fo=~cs(x^0.5), data=abdom, family=BCT)centiles(aa,xvar=abdom$x)mat <- centiles.pred(aa, xname="x",xvalues=c(30) )xx<-rep(mat[,1],9)yy<-mat[,2:10]points(xx,yy,col="red")# now with x-variable previously transformednx<-abdom$x^0.5aa<-gamlss(y~cs(nx),sigma.fo=~cs(nx), data=abdom, family=BCT)centiles(aa, xvar=abdom$x)newd<-data.frame( abdom, nx=abdom$x^0.5)mat <- centiles.pred(aa, xname="nx", xvalues=c(30), power=0.5, data=newd)xxx<-rep(mat[,1],9)yyy<-mat[,2:10]points(xxx,yyy,col="red")
centiles.split Plots centile curves split by x for a GAMLSS object
Description
This function plots centiles curves for separate ranges of the unique explanatory variable x. It issimilar to the centiles function but the range of x is split at a user defined values xcut.pointinto r separate ranges. The functions also tabulates the sample percentages below each centile curvefor each of the r ranges of x (for comparison with the model percentage given by cent) The modelshould have only one explanatory variable.
Usage
centiles.split(obj, xvar = NULL, xcut.points = NULL, n.inter = 4,cent = c(0.4, 2, 10, 25, 50, 75, 90, 98, 99.6),legend = FALSE, ylab = "y", xlab = "x", ylim = NULL,overlap = 0, save = TRUE, plot = TRUE, ...)
Arguments
obj a fitted gamlss object from fitting a gamlss continuous distribution
xvar the unique explanatory variable
xcut.points the x-axis cut off points e.g. c(20,30). If xcut.points=NULL then then.inter argument is activated
n.inter if xcut.points=NULL this argument gives the number of intervals in whichthe x-variable will be splited, with default 4
82 centiles.split
cent a vector with elements the % centile values for which the centile curves are tobe evaluated
legend whether a legend is required in the plots or not, the default is legent=FALSE
ylab the y-variable label
xlab the x-variable label
ylim the range of the y-variable axis
overlap how much overlapping in the xvar intervals. Default value is overlap=0 fornon overlapping intervals
save whether to save the sample percentages or not with default equal to TRUE. Inthis case the functions produce a matrix giving the sample percentages for eachinterval
plot whether to plot the centles. This option is usefull if the sample statistics onlyare to be used
... for extra arguments
Details
Value
Centile plots are produced and the sample centiles below each centile curve for each of the r rangesof x can be saved into a matrix.
Warning
This function is appropriate when only one continuous explanatory variable is fitted in the model
Note
Author(s)
Mikis Stasinopoulos, 〈[email protected]〉, Bob Rigby 〈[email protected]〉,with contributions from Elaine Borghie
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2003) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss centiles, centiles.com
checklink 83
Examples
data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom)mout <- centiles.split(h,xvar=abdom$x)moutrm(h,mout)
checklink Set the Right Link Function for Specified Parameter and Distribution
Description
This function is used within the distribution family specification of a GAMLSS model to define theright link for each of the parameters of the distribution. This function should not be called by theuser unless he/she specify a new distribution family or wishes to change existing link functions inthe parameters.
Usage
checklink(which.link = NULL, which.dist = NULL, link = NULL, link.List = NULL,par.link = c(1))
Arguments
which.link which parameter link e.g. which.link="mu.link"
which.dist which distribution family e.g. which.dist="Cole.Green"
link a repetition of which.link e.g. link=substitute(mu.link)
link.List what link function are required e.g. link.List=c("inverse", "log","identity")
par.link sets the values for the shifted parameter(s) for logshifted and "logitshifted"i.e par.link=1 for logshifted or par.link=c(0,2) for logitshifted
Details
Value
Defines the right link for each parameter
Author(s)
Calliope Akantziliotou
84 coef.gamlss
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/)).
See Also
gamlss, gamlss.family
Examples
coef.gamlss Extract Model Coefficients in a GAMLSS fitted model
Description
coef.gamlss is the GAMLSS specific method for the generic function coef which extractsmodel coefficients from objects returned by modelling functions. ‘coefficients’ is an alias for coef.
Usage
## S3 method for class 'gamlss':coef(object, what = c("mu", "sigma", "nu", "tau"), ... )
Arguments
object a GAMLSS fitted model
what which parameter coefficient is required, default what="mu"
... for extra arguments
Details
Value
Coefficients extracted from the GAMLSS model object.
Note
cs 85
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
RRigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, deviance.gamlss, fitted.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #coef(h)rm(h)
cs Specify a Smoothing Spline Fit in a GAMLSS Formula
Description
Takes a vector and returns it with several attributes. The vector is used in the construction of themodel matrix. The function cs() does no smoothing, but assigns the attributes to the vector to aidgamlss in the smoothing. The function doing the smoothing is gamlss.cs() (a modified versionof the R function smooth.spline()) which is used at the backfitting function additive.fit. The (experimental) function vc can be use to fit varying coefficient models Hastie and Tibshirani(1993).
Usage
cs(x, df = 3, spar = NULL, c.spar = NULL)vc(r, x, df = 3, spar = NULL, c.spar = NULL)
Arguments
x the univariate predictor, (or expression, that evaluates to a numeric vector). Forthe function vc the x argument is the vector which has its (linear) coefficientchange with r
df the desired equivalent number of degrees of freedom (trace of the smoother ma-trix minus two for the constant and linear fit). The real smoothing parameter(spar below) is found such that df=tr(S)-2, where S is the implicit smoothermatrix. Values for df should be greater than 0, with 0 implying a linear fit.
86 cs
spar smoothing parameter, typically (but not necessarily) in (0,1]. The coefficientlambda of the integral of the squared second derivative in the fit (penalizedlog likelihood) criterion is a monotone function of ‘spar’, see the details insmooth.spline.
c.spar This is an option to be used when the degrees of freedom of the fitted gamlssobject are different from the ones given as input in the option df. The de-fault values used are the ones given the option control.spar in the R func-tion smooth.spine() and they are c.spar=c(-1.5, 2). For very largedata sets e.g. 10000 observations, the upper limit may have to increase for ex-ample to c.spar=c(-1.5, 2.5). Use this option if you have received thewarning ’The output df are different from the input, change the control.spar’.c.spar can take both vectors or lists of length 2, for example c.spar=c(-1.5, 2.5) or c.spar=list(-1.5, 2.5) would have the same effect.
r for the function vc, r represent the vector of the explanatory variable whicheffects the coefficients of x i.e. beta(r)*x. Both the x and r vectors should beadjusted by subtracting the their mean
Details
Note that cs itself does no smoothing; it simply sets things up for the function gamlss() whichin turn uses the function additive.fit() for backfitting which in turn uses gamlss.cs()
Value
the vector x is returned, endowed with a number of attributes. The vector itself is used in theconstruction of the model matrix, while the attributes are needed for the backfitting algorithmsadditive.fit(). Since smoothing splines includes linear fits, the linear part will be efficientlycomputed with the other parametric linear parts of the model.
Warning
For a user who wishes to compare the gamlss() results with the equivalent gam() resultsin S-plus: make sure when using S-plus that the convergence criteria epsilon and bf.epsilon incontrol.gam() are decreased sufficiently to ensure proper convergence in S-plus. Also notethat the degrees of freedom are defined on top of the linear term in gamlss, but on top of theconstant term in S-plus, (so use an extra degrees of freedom in S-plus in order to obtain comparableresults to those in galmss).
Change the upper limit of spar if you received the warning ’The output df are different from theinput, change the control.spar’.
For large data sets do not use expressions, e.g. cs(x^0.5) inside the gamlss function commandbut evaluate the expression, e.g. nx=x0.5, first and then use cs(nx).
Note
The degrees of freedom df are defined differently from that of the gam() function in S-plus. Here dfare the additional degrees of freedom excluding the constant and the linear part of x. For exampledf=4 in gamlss() is equivalent to df=5 in gam() in S-plus
deviance.gamlss 87
Author(s)
Mikis Stasinopoulos and Bob Rigby
References
Hastie, T. J. and Tibshirani, R. J. (1993), Varying coefficient models (with discussion),J. R. Statist.Soc. B., 55, 757-796.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.cs, lo
Examples
# cubic splines exampledata(aids)attach(aids)# fitting a smoothing cubic spline with 7 degrees of freedom# plus the a quarterly effectaids1<-gamlss(y~cs(x,df=7)+qrt,data=aids,family=PO) #plot(x,y)lines(x,fitted(aids1))rm(aids1)detach(aids)# varying-coefficient exampledata(rent)attach(rent)# adjusting the variablesFlbar<-Fl-mean(Fl)Abar<-A-mean(A)# additive modelm1<-gamlss(R~cs(Flbar, df=3)+cs(Abar))# varying-coefficient modelm2<-gamlss(R~cs(Flbar, df=3)+cs(Abar)+vc(r=Abar,x=Flbar))AIC(m1,m2)detach(rent)
deviance.gamlss Global Deviance of a GAMLSS model
Description
Returns the global, -2*log(likelihood), or the penalized, -2*log(likelihood)+ penalties, deviance ofa fitted GAMLSS model object.
88 deviance.gamlss
Usage
## S3 method for class 'gamlss':deviance(object, what = c("G", "P"), ...)
Arguments
object a GAMLSS fitted model
what put "G" for Global or "P" for Penalized deviance
... for extra arguments
Details
deviance is a generic function which can be used to extract deviances for fitted models. deviance.gamlssis the method for a GAMLSS object.
Value
The value of the global or the penalized deviance extracted from a GAMLSS object.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss.family, coef.gamlss, fitted.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #deviance(h)rm(h)
fabric 89
fabric The Fabric Data
Description
The data are 32 observations on faults in rolls of fabric
Usage
data(fabric)
Format
A data frame with 32 observations on the following 3 variables.
leng the length of the roll : a numeric vector
y the number of faults in the roll of fabric : a discrete vector
x the log of the length of the roll : a numeric vector
Details
The data are 32 observations on faults in rolls of fabric taken from Hinde (1982) who used the EMalgorithm to fit a Poisson-normal model. The response variable is the number of faults in the roll offabric and the explanatory variable is the log of the length of the roll.
Source
John Hinde
References
Hinde, J. (1982) Compound Poisson regression models: in GLIM 82, Proceedings of the Inter-national Conference on Generalized Linear Models, ed. Gilchrist, R., 109–121, Springer: NewYork.
Examples
data(fabric)attach(fabric)plot(x,y)detach(fabric)
90 find.hyper
find.hyper A function to select values of hyperparameters in a GAMLSS model
Description
This function selects the values of hyper parameters and/or non-linear parameters in a GAMLSSmodel. It uses the R function optim which then minimised the generalized Akaike informationcriterion (GAIC) with a user defined penalty.
Usage
find.hyper(model = NULL, parameters = NULL, other = NULL, penalty = 2.5,steps = c(0.1), lower = -Inf, upper = Inf, method = "L-BFGS-B",...)
Arguments
model this is a GAMLSS model. e.g.model=gamlss(y~cs(x,df=p[1]),sigma.fo=~cs(x,df=p[2]),data=abdom)where p[1] and p[2] denore the parametets to be estimated
parameters the starting values in the search of the optimum hyperparameters and/or non-linear parameters e.g. parameters=c(3,3)
other this is used to optimize other non-parameters, for example a transformation ofthe explanatory variable of the kind xp[3], others=quote(nx<-x^p[3])where nx is now in the model formula
penalty specifies the penalty in the GAIC, (the default is 2.5) e.g. penalty=3
steps the steps taken in the optimization procedure [see the ndeps option in optim()],by default is set to 0.1 for all hyper parameters and non-linear parameters
lower the lower permissible level of the parameters i.e. lower=c(1,1) this doesnot apply if a method other than the default method "L-BFGS-B" is used
upper the upper permissible level of the parameters i.e. upper=c(30,10), this isnot apply if a method other than the default method "L-BFGS-B" is used
method the method used in optim() to numerically minimize the GAIC over the hy-perparameters and/or non-linear parameters. By default this is "L-BFGS-B" toallow box-restriction on the parameters
... for extra arguments to be passed to the R function optim() used in the opti-mization
Details
This is an experimental function which appears to work well for the search of the optimum degreesof freedom and non-linear parameters (e.g. power parameter λ used to transform x to xλ). Furtherinvestigation will check whether this function is reliable in general.
find.hyper 91
Value
The function turns the same output as the function optim()
par the optimum hyperparameter values
value the minimized value of the GAIC
counts A two-element integer vector giving the number of calls to ‘fn’ and ‘gr’ respec-tively
convergence An integer code. ‘0’ indicates successful convergence. see the function optim()for other errors
message A character string giving any additional information returned by the optimizer,or ‘NULL’
Warning
It may be slow to find the optimum
Note
Author(s)
Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, plot.gamlss, optim
Examples
data(abdom)attach(abdom)# declare the modelmod1<-quote(gamlss(y~cs(nx,df=p[1]),family=BCT,data=abdom,
control=gamlss.control(trace=FALSE)))# we want also to check for a transformation in x# so we use the other optionop<-find.hyper(model=mod1, other=quote(nx<-x^p[2]), par=c(3,0.5),
lower=c(1,0.001), steps=c(0.1,0.001))# the optimum parameters found are# par=(p[1],p[2]) = (2.944836 0.001000) = (df for mu, lambda)
92 fitted.gamlss
# so it needs df = 3 on top of the constant and linear# in the cubic spline model for mu since p[1] is approximately 3# and log transformation for x since p[2] is approximately 0oprm(op)
fitted.gamlss Extract Fitted Values For A GAMLSS Model
Description
fitted.gamlss is the GAMLSS specific method for the generic function fitted which ex-tracts fitted values for a specified parameter from a GAMLSS objects. fitted.values is analias for it. The function fv() is similar to fitted.gamlls() but allows the argument whatnot to be character
Usage
## S3 method for class 'gamlss':fitted(object, what = c("mu", "sigma", "nu", "tau"), ...)fv(obj, what = "mu", ...)
Arguments
object a GAMLSS fitted model
obj a GAMLSS fitted model
what which parameter fitted values are required, default what="mu"
... for extra arguments
Value
Fitted values extracted from the GAMLSS object for the given parameter.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
fitted.plot 93
See Also
print.gamlss, summary.gamlss, fitted.gamlss, coef.gamlss, residuals.gamlss,update.gamlss, plot.gamlss, deviance.gamlss, formula.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #fitted(h)rm(h)
fitted.plot Plots The Fitted Values of a GAMLSS Model
Description
This function, applicable only to a models with a single explanatory variable, plots the fitted valuesfor all the parameters of a GAMLSS model against the (one) explanatory variable. It is also usefulfor comparing the fits for more than one model.
Usage
fitted.plot(object, ..., x = NULL, color = TRUE, line.type = FALSE)
Arguments
object a fitted GAMLSS model object(with only one explanatory variable)
... optionally more fitted GAMLSS model objects
x The unique explanatory variable
color whether the fitted lines plots are shown in colour, color=TRUE (the default)or not color=FALSE
line.type whether the line type should be different or not. The default is color=FALSE
Value
A plot of the fitted values against the explanatory variable
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
94 formula.gamlss
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, centiles, centiles.split
Examples
data(abdom)h1<-gamlss(y~cs(x,df=3), sigma.formula=~x, family=BCT, data=abdom)h2<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,df=3), family=BCT, data=abdom)fitted.plot(h1,h2,x=abdom$x)rm(h1,h2)
formula.gamlss Extract the Model Formula in a GAMLSS fitted model
Description
formula.gamlss is the GAMLSS specific method for the generic function formula whichextracts the model formula from objects returned by modelling functions.
Usage
## S3 method for class 'gamlss':formula(x, what = c("mu", "sigma", "nu", "tau"), ... )
Arguments
x a GAMLSS fitted model
what which parameter coefficient is required, default what="mu"
... for extra arguments
Details
Value
Returns a model formula
gamlss 95
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, deviance.gamlss, fitted.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #formula(h,"mu")rm(h)
gamlss Generalized Additive Models for Location Scale and Shape
Description
Returns an object of class "gamlss", which is a generalized additive model for location scale andshape (GAMLSS). The function gamlss() is very similar to the gam() function in S-plus (nowalso in R in package gam), but can fit more distributions (not only the ones belonging to the expo-nential family) and can model all the parameters of the distribution as functions of the explanatoryvariables (e.g. using linear, non-linear, smoothing, loess and random effects terms).
This implementation of gamlss() allows modelling of up to four parameters in a distributionfamily, which are conventionally called mu, sigma, nu and tau.
The function gamlssNews() shows what is new in the current implementation.
96 gamlss
Usage
gamlss(formula = formula(data), sigma.formula = ~1,nu.formula = ~1, tau.formula = ~1, family = NO(),data = sys.parent(), weights = NULL,contrasts = NULL, method = RS(), start.from = NULL,mu.start = NULL, sigma.start = NULL,nu.start = NULL, tau.start = NULL,mu.fix = FALSE, sigma.fix = FALSE, nu.fix = FALSE,tau.fix = FALSE, control = gamlss.control(...),i.control = glim.control(...), ...)
is.gamlss(x)gamlssNews()
Arguments
formula a formula object, with the response on the left of an operator, and the terms,separated by + operators, on the right. Nonparametric smoothing terms are in-dicated by cs for smoothing splines, lo for loess smooth terms and random orra for random terms, e.g. y~cs(x,df=5)+x1+x2*x3. Additional smootherscan be added by creating the appropriate interface. Interactions with nonpara-metric smooth terms are not fully supported, but will not produce errors; theywill simply produce the usual parametric interaction
sigma.formulaa formula object for fitting a model to the sigma parameter, as in the formulaabove, e.g. sigma.formula=~cs(x,df=5). It can be abbreviated to sigma.fo=~cs(x,df=5).
nu.formula a formula object for fitting a model to the nu parameter, e.g. nu.fo=~x
tau.formula a formula object for fitting a model to the tau parameter, e.g. tau.fo=~cs(x,df=2)
family a gamlss.family object, which is used to define the distribution and thelink functions of the various parameters. The distribution families supportedby gamlss() can be found in gamlss.family. Functions such as BI()(binomial) produce a family object. Also can be given without the parenthesesi.e. BI. Family functions can take arguments, as in BI(mu.link=probit)
data a data frame containing the variables occurring in the formula. If this is missing,the variables should be on the search list. e.g. data=aids
weights a vector of weights. Note that this is not the same as in the glm() or gam()function. Here weights can be used to weight out observations (like in subset)or for a weighted likelihood analysis where the contribution of the observationsto the likelihood differs according to weights. The length of weights mustbe the same as the number of observations in the data. By default, the weight isset to one. To set weights to vector w use weights=w
contrasts list of contrasts to be used for some or all of the factors appearing as variables inthe model formula. The names of the list should be the names of the correspond-ing variables. The elements should either be contrast-type matrices (matriceswith as many rows as levels of the factor and with columns linearly independentof each other and of a column of ones), or else they should be functions thatcompute such contrast matrices.
gamlss 97
method the current algorithms for GAMLSS are RS(), CG() and mixed(). i.e. method=RS()will use the Rigby and Stasinopoulos algorithm, method=CG() will use theCole and Green algorithm and mixed(2,10) will use the RS algorithm twicebefore switching to the Cole and Green algorithm for up to 10 extra iterations
start.from a fitted GAMLSS model which the fitted values will be used as staring valuesfor the current model
mu.start vector or scalar of initial values for the location parameter mu e.g. mu.start=4
sigma.start vector or scalar of initial values for the scale parameter sigma e.g. sigma.start=1
nu.start vector or scalar of initial values for the parameter nu e.g. nu.start=3
tau.start vector or scalar of initial values for the location parameter tau e.g. tau.start=2
mu.fix whether the mu parameter should be kept fixed in the fitting processes e.g.mu.fix=FALSE
sigma.fix whether the sigma parameter should be kept fixed in the fitting processes e.g.sigma.fix=FALSE
nu.fix whether the nu parameter should be kept fixed in the fitting processes e.g. nu.fix=FALSE
tau.fix whether the tau parameter should be kept fixed in the fitting processes e.g.tau.fix=FALSE
control this sets the control parameters of the outer iterations algorithm. The defaultsetting is the gamlss.control function
i.control this sets the control parameters of the inner iterations of the RS algorithm. Thedefault setting is the glim.control function
... for extra arguments
x an object
Details
The Generalized Additive Model for Location, Scale and Shape is a general class of statistical mod-els for a univariate response variable. The model assumes independent observations of the responsevariable y given the parameters, the explanatory variables and the values of the random effects. Thedistribution for the response variable in the GAMLSS can be selected from a very general fam-ily of distributions including highly skew and/or kurtotic continuous and discrete distributions, seegamlss.family. The systematic part of the model is expanded to allow modelling not only ofthe mean (or location) parameter, but also of the other parameters of the distribution of y, as linearparametric and/or additive nonparametric (smooth) functions of explanatory variables and/or ran-dom effects terms. Maximum (penalized) likelihood estimation is used to fit the (non)parametricmodels. A Newton-Raphson/Fisher scoring algorithm is used to maximize the (penalized) likeli-hood. The additive terms in the model are fitted using a backfitting algorithm.
is.gamlss is a short version is is(object,"gamlss")
Value
Returns a gamlss object with components
family the distribution family of the gamlss object (see gamlss.family)
parameters the name of the fitted parameters i.e. mu, sigma, nu, tau
98 gamlss
call the call of the gamlss functiony the response variablecontrol the gamlss fit control settingsweights the vector of weightsG.deviance the global devianceN the number of observations in the fitrqres a function to calculate the normalized (randomized) quantile residuals of the
objectiter the number of external iterations in the fitting processtype the type of the distribution or the response variable (continuous or discrete)method which algorithm is used for the fit, RS(), CG() or mixed()converged whether the model fitting has have convergedresiduals the normalized (randomized) quantile residuals of the modelmu.fv the fitted values of the mu model, also sigma.fv, nu.fv, tau.fv for the other pa-
rameters if presentmu.lp the linear predictor of the mu model, also sigma.lp, nu.lp, tau.lp for the other
parameters if presentmu.wv the working variable of the mu model, also sigma.wv, nu.wv, tau.wv for the
other parameters if presentmu.wt the working weights of the mu model, also sigma.wt, nu.wt, tau.wt for the other
parameters if presentmu.link the link function for the mu model, also sigma.link, nu.link, tau.link for the other
parameters if presentmu.terms the terms for the mu model, also sigma.terms, nu.terms, tau.terms for the other
parameters if presentmu.x the design matrix for the mu, also sigma.x, nu.x, tau.x for the other parameters
if presentmu.qr the QR decomposition of the mu model, also sigma.qr, nu.qr, tau.qr for the other
parameters if presentmu.coefficients
the linear coefficients of the mu model, also sigma.coefficients, nu.coefficients,tau.coefficients for the other parameters if present
mu.formula the formula for the mu model, also sigma.formula, nu.formula, tau.formula forthe other parameters if present
mu.df the mu degrees of freedom also sigma.df, nu.df, tau.df for the other parametersif present
mu.nl.df the non linear degrees of freedom, also sigma.nl.df, nu.nl.df, tau.nl.df for theother parameters if present
df.fit the total degrees of freedom use by the modeldf.residual the residual degrees of freedom left after the model is fittedaic the Akaike information criterionsbc the Bayesian information criterion
gamlss.control 99
Warning
Respect the parameter hierarchy when you are fitting a model. For example a good model for mushould be fitted before a model for sigma is fitted
Note
The following generic functions can be used with a GAMLSS object: print, summary, fitted,coef, residuals, update, plot, deviance, formula
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.londonmet.ac.uk/gamlss/).
See Also
gamlss.family, pdf.plot, find.hyper
Examples
data(abdom)mod<-gamlss(y~cs(x,df=3),sigma.fo=~cs(x,df=1),family=BCT, data=abdom, method=mixed(1,20))plot(mod)rm(mod)
gamlss.control Auxiliary for Controlling GAMLSS Fitting
Description
Auxiliary function as user interface for gamlss fitting. Typically only used when calling gamlssfunction with the option control.
Usage
gamlss.control(c.crit = 0.001, n.cyc = 20, mu.step = 1, sigma.step = 1, nu.step = 1,tau.step = 1, gd.tol = 5, iter = 0, trace = TRUE, autostep = TRUE,save = TRUE, ...)
100 gamlss.control
Arguments
c.crit the convergence criterion for the algorithm
n.cyc the number of cycles of the algorithm
mu.step the step length for the parameter mu
sigma.step the step length for the parameter sigma
nu.step the step length for the parameter nu
tau.step the step length for the parameter tau
gd.tol global deviance tolerance level
iter starting value for the number of iterations, typically set to 0 unless the functionrefit is used
trace whether to print at each iteration (TRUE) or not (FALSE)
autostep whether the steps should be halved automatically if the new global deviance isgreater that the old one, the default is autostep=TRUE
save save=TRUE, (the default), saves all the information on exit. save=FALSEsaves only limited information as the global deviance and AIC. For examplefitted values, design matrices and additive terms are not saved. The latest isuseful when gamlss() is called several times within a procedure.
... for extra arguments
Details
The step length for each of the parameters mu, sigma, nu or tau is very useful to aid convergenceif the parameter has a fully parametric model. However using a step length is not theoreticallyjustified if the model for the parameter includes one or more smoothing terms, (even thought it maygive a very approximate result).
The c.crit can be increased to speed up the convergence especially for a large set of data whichtakes longer to fit. When ‘trace’ is TRUE, calls to the function cat produce the output for eachouter iteration.
Value
A list with the arguments as components.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
gamlss.cs 101
See Also
codegamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #con<-gamlss.control(mu.step=0.1)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids, control=con) #rm(h,con)
gamlss.cs Support for Function cs()
Description
This is support for the function cs(). It is not intended to be called directly by users. The functiongamlss.cs is based on the R function smooth.spline
Usage
gamlss.cs(x, y = NULL, w = NULL, df = 5, spar = NULL, cv = FALSE, all.knots = TRUE,df.offset = 0, penalty = 1, control.spar = list(low = -1.5, high = 2), xeval = NULL)
Arguments
x the design matrix
y the response variable
w prior weights
df effective degrees of freedom
spar spar the smoothing parameter
cv options for the smooth.spline function not to use here
all.knots options for the smooth.spline function not to use here
df.offset options for the smooth.spline function not to use here
penalty options for the smooth.spline function not to use here
control.spar control for spar. It can be changed through cs
xeval used in prediction
102 gamlss.family
Value
Returns a class "smooth.spline" object with
residuals The residuals of the fitfitted.values
The smoothing values
var the variance for the fitted smoother
lambda the final value for spar
nl.df the smoothing degrees of freedom excluding the constant and linear terms, i.e.(df-2)
coefSmo this is a list containing among others the knots and the coefficients
...
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
See Also
gamlss, cs
gamlss.family Family Objects for fitting a GAMLSS model
Description
GAMLSS families are the current available distributions that can be fitted using the gamlss()function.
Usage
gamlss.family(object,...)as.gamlss.family(object)as.family(object)## S3 method for class 'gamlss.family':print(x,...)gamlss.family.default(object,...)
Arguments
object a gamlss family object e.g. BCT
x a gamlss family object e.g. BCT
... further arguments passed to or from other methods.
gamlss.family 103
Details
There are several distributions available for the response variable in the gamlss function. Thefollowing table display their names and their abbreviations in R. Note that the different distributionscan be fitted using their R abbreviations (and optionally excluding the brackets) i.e. family=BI(),family=BI are equivalent.
Distributions R names No of parametersBeta BE() 2Beta Binomial BB() 2Beta one inflated BEOI() 3Beta zero inflated BEZI() 3Beta inflated BEINF() 4Binomial BI() 1Box-Cox Cole and Green BCCG() 3Box-Cox Power Exponential BCPE() 4Box-Cox-t BCT() 4Delaport DEL() 3Exponential EXP() 1Exponential Gaussian exGAUS() 3Gamma GA() 2Generalized Gamma GG() 3Generalized Inverse Gaussian GIG() 3Gumbel GU() 2Inverse Gaussian IG() 2Johnson’s SU JSU() 4Logistic LO() 2log-Normal LOGNO() 2log-Normal (Box-Cox) LNO() 3 (1 fixed)Negative Binomial type I NBI() 2Negative Binomial type II NBII() 2Normal Exponential t NET() 4 (2 fixed)Normal NO() 2Normal Family NOF() 3 (1 fixed)Power Exponential PE() 3Poison PO() 1Poisson inverse Gaussian PIG() 2Reverse generalized extreme RGE() 3Reverse Gumbel RG() 2Skew Power Exponential SEP() 4Shash SHASH() 4Sichel (original) SI() 3Sichel (mu as the maen) SICHEL() 3Skew t type 3 ST3() 3t-distribution TF() 3Weibull WEI() 2Weibull(PH parameterization) WEI2() 2Weibull (mu as mean) WEI3() 2Zero inflated poisson ZIP() 2
104 gamlss.family
Zero inf. poiss.(mu as mean) ZIP2() 2Zero adjusted IG ZAIG() 2
Note that some of the distributions are in the package gamlss.dist. The parameters of the dis-tributions are in order, mu for location, sigma for scale (or dispersion), and nu and tau for shape.More specifically for the BCCG family mu is the median, sigma approximately the coefficient ofvariation, and nu the skewness parameter. The parameters for BCPE distribution have the sameinterpretation with the extra fourth parameter tau modelling the kurtosis of the distribution. Theparameters for BCT have the same interpretation except that σ[(τ/(τ −2))0.5] is approximately thecoefficient of variation.
All of the distribution in the above list are also provided with the corresponding d, p, q and rfunctions for density (pdf), distribution function (cdf), quantile function and random generationfunction respectively, (see individual distribution for details).
Value
The above GAMLSS families return an object which is of type gamlss.family. This object isused to define the family in the gamlss() fit.
Note
More distributions will be documented in later GAMLSS releases. Further user defined distributionscan be incorporate relatively easy, see, for example, the help documentation accompanying thegamlss library.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss,BE,BB,BEINF, BI,LNO,BCT,BCPE,BCCG, GA,GU,JSU,IG,LO,NBI,NBII,NO,PE ,PO,RG,PIG,TF,WEI,WEI2,ZIP
Examples
normal<-NO(mu.link="log", sigma.link="log")normalrm(normal)
gamlss.fp 105
gamlss.fp Support for Function fp()
Description
This is support for the function fp(). It is not intended to be called directly by users.
Usage
gamlss.fp(x, y, w, npoly = 2, xeval = NULL)
Arguments
x the x for function gamlss.fp is referred to the design matric of the specificparameter model (not to be used by the user)
y the y for function gamlss.fp is referred to the working variable of the specificparameter model (not to be used by the user)
w the w for function gamlss.fp is referred to the iterative weight variable of thespecific parameter model (not to be used by the user)
npoly a positive indicating how many fractional polynomials should be considered inthe fit. Can take the values 1, 2 or 3 with 2 as default
xeval used in prediction
Value
Returns a list withfitted.values
residuals residualsvar
nl.df the trace of the smoothing matrixlambda the value of the smoothing parametercoefSmo the coefficients from the smoothing fitvarcoeff the variance of the coefficients
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
106 gamlss.lo
See Also
gamlss, fp
gamlss.lo Support for Function lo()
Description
This is support for the loess function lo(). It is not intended to be called directly by users. Thefunction gamlss.lo is based on the R function loess
Usage
gamlss.lo(x, y, w = NULL, span, df = NULL, degree = 1, ncols =FALSE, wspan = TRUE, parametric = FALSE, drop.square= FALSE, normalize = FALSE, family = "gaussian",method = "loess", control = loess.control(...), xeval= NULL, ...)
Arguments
x the design matrix
y the response variable
w prior weights
span the smoothing parameter
df effective degrees of freedom
degree the order of the polynomial
ncols the number of columns of the x matrix
wspan argument for the loess function not to use here
parametric argument for the loess function not to use here
drop.square argument for the loess function not to use here
normalize argument for the loess function not to use here
family argument for the loess function not to use here
method argument for the loess function not to use here
control argument for the loess function not to use here
xeval used in prediction
... further arguments passed to or from other methods.
gamlss-package 107
Value
Returns an object with
fitted the smooth values
residuals the residuals
var the variance of the smoother
nl.df the non-linear degrees of freedom
coefSmo with value NULL
lambda the value of span
Author(s)
Mikis Stasinopoulos based on Brian Ripley loess function in R
See Also
gamlss, lo
gamlss-package The GAMLSS library and datasets
Description
This a collection of functions to fit Generalized Additive Models for Location Scale and Shape(GAMLSS)and handled gamlss objects.
GAMLSS were introduced by Rigby and Stasinopoulos (2005). GAMLSS is a general frameworkfor univariate regression type statistical problems using new ways of dealing with overdispersion,skewness and kurtosis in the response variable. In GAMLSS the exponential family distributionassumption used in Generalized Linear Model (GLM) and Generalized Additive Model (GAM),(seeNelder and Wedderburn, 1972 and Hastie and Tibshirani, 1990, respectively) is relaxed and replacedby a very general distribution family including highly skew and kurtotic discrete and continuousdistributions. The systematic part of the model is expanded to allow modelling not only the mean(or location) but other parameters of the distribution of the response variable as linear parametric,nonlinear parametric or additive non-parametric functions of explanatory variables and/or randomeffects terms. Maximum (penalized) likelihood estimation is used to fit the models.
Details
Package: gamlssType: PackageVersion: 1.5-0Date: 2006-12-13License: GPL (version 2 or later) See file LICENSE
108 gamlss.ps
This package allow the user to model the distribution of the response variable using a variety ofone, two, three and four parameter families of distributions. The distributions implemented cur-rently can be found in gamlss.family. Other distributions can be easily added. In the currentimplementation of GAMLSS several additive terms have been implemented including regressionsplines, smoothing splines, penalized splines, varying coefficients, fractional polynomials and ran-dom effects. Other additive terms can be easily added.
Author(s)
Mikis Stasinopoulos <[email protected]>, Bob Rigby <[email protected]>with contributions from Calliope Akantziliotou.
Maintainer: Mikis Stasinopoulos <[email protected]>
References
Nelder, J. A. and Wedderburn, R. W. M. (1972). Generalized linear models. J. R. Statist. Soc. A.,135 370-384.
Hastie, T. J. and Tibshirani, R. J. (1990). Generalized Additive Models. Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
Examples
data(abdom)mod<-gamlss(y~cs(x,df=3),sigma.fo=~cs(x,df=1),family=BCT, data=abdom, method=mixed(1,20))plot(mod)rm(mod)
gamlss.ps upport for Function ps()
Description
This is support for the function ps(). It is not intended to be called directly by users.
Usage
gamlss.ps(x, y, w, xeval = NULL, ...)
gamlss.ps 109
Arguments
x the x for function gamlss.fp is referred to the design matric of the specificparameter model (not to be used by the user)
y the y for function gamlss.fp is referred to the working variable of the specificparameter model (not to be used by the user)
w the w for function gamlss.fp is referred to the iterative weight variable of thespecific parameter model (not to be used by the user)
xeval used in prediction
... further arguments passed to or from other methods.
Details
Value
comp1 Description of ’comp1’
comp2 Description of ’comp2’
...
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2003) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, ps
110 gamlss.ra
gamlss.ra Support for Function ra()
Description
This is support for the random effect smoother function ra() . It is not intended to be called directlyby users. The function gamlss.ra is similar to the GAMLSS function gamlss.random. Bothfunctions can be used with the same effect.
Usage
gamlss.ra(x, y, w, df = sum(non.zero))
Arguments
x the explanatory design matrix
y the response variable
w iterative weights
df effective degrees of freedom
Details
Value
Returns an list with
fitted.valuesfitted values
residuals residuals
var variances of the fitted values
nl.df the trace of the smoothing matrix
lambda the value of the smoothing parameter
coefSmo the coefficients from the smoothing fit
varcoeff the variance of the coefficients
Note
This is an experimental function and should be used with care
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
gamlss.random 111
References
RRigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, ra, random
gamlss.random Support for Function random()
Description
This is support for the function random(). It is not intended to be called directly by users. Thefunction gamlss.radom is similar to the GAMLSS function gamlss.ra.
Usage
gamlss.random(x, y, w, df = sum(non.zero), lambda = 0)
Arguments
x the explanatory design matrix
y the response variable
w iterative weights
df effective degrees of freedom
lambda the smoothing parameter
Value
Returns a list with
y the fitted values
residuals the residuals
var the variance of the fitted values
lambda the final lambda, the smoothing parameter
coefSmo with value NULL
Author(s)
Mikis Stasinopoulos, based on Trevor Hastie function gam.random
112 gamlss.rc
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, random, ra
gamlss.rc Support for Function rc()
Description
This is support for the function rc(). It is not intended to be called directly by users.
Usage
gamlss.rc(x, y, w, df = sum(non.zero))
Arguments
x the explanatory design matrix
y the response variable
w iterative weights
df effective degrees of freedom
Value
Returns a list with
fitted.values
residuals residuals
var
nl.df the trace of the smoothing matrix
lambda the value of the smoothing parameter
coefSmo the coefficients from the smoothing fit
varcoeff the variance of the coefficients
gamlss.scope 113
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, rc
gamlss.scope Generate a Scope Argument for Stepwise GAMLSS
Description
Generates a scope argument for a stepwise GAMLSS.
Usage
gamlss.scope(frame, response = 1, smoother = "cs", arg = NULL, form = TRUE)
Arguments
frame a data or model frame
response which variable is the response; the default is the first
smoother what smoother to use; default is cs
arg any additional arguments required by the smoother
form should a formula be returned (default), or else a character version of the formula
Details
Each formula describes an ordered regimen of terms, each of which is eligible on their own forinclusion in the gam model. One of the terms is selected from each formula by step.gam. If a 1 isselected, that term is omitted.
Value
a list of formulas is returned, one for each column in frame (excluding the response). For a numericvariable, say x1, the formula is
1 + x1 + cs(x1)
If x1 is a factor, the last smooth term is omitted.
114 glim.control
Author(s)
Mikis Stasinopoulos: a modified function from Statistical Models in S
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
stepGAIC
Examples
data(usair)gs1<-gamlss.scope(model.frame(y~x1+x2+x3+x4+x5+x6, data=usair))gs2<-gamlss.scope(model.frame(usair))gs1gs2gs3<-gamlss.scope(model.frame(usair), smooth="fp", arg="3")gs3
glim.control Auxiliary for Controlling the inner algorithm in a GAMLSS Fitting
Description
Auxiliary function used for the inner iteration of gamlss algorithm. Typically only used whencalling gamlss function through the option i.control.
Usage
glim.control(cc = 0.001, cyc = 50, glm.trace = FALSE,bf.cyc = 30, bf.tol = 0.001, bf.trace = FALSE,...)
Arguments
cc the convergence criterion for the algorithm
cyc the number of cycles of the algorithm
glm.trace whether to print at each iteration (TRUE) or not (FALSE)
bf.cyc the number of cycles of the backfitting algorithm
histDist 115
bf.tol the convergence criterion (tolerance level) for the backfitting algorithm
bf.trace whether to print at each iteration (TRUE) or not (FALSE, the default)
... for extra arguments
Value
A list with the arguments as components
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape, (with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
Examples
data(aids)con<-glim.control(glm.trace=TRUE)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids, i.control=con) #rm(h,con)
histDist This function plots the histogram and a fitted (GAMLSS family) distri-bution to a variable
Description
This function fits constants to the parameters of a GAMLSS family distribution and them plot thehistogram and the fitted distribution.
Usage
histDist(y, family = NO, freq = NULL, xmin = NULL,xmax = NULL, g.control = gamlss.control(),density = FALSE, main = NULL, ...)
116 histDist
Arguments
y a vector
family a continuous GAMLSS family distribution
freq the frequencies of the data in y if exist. freq is used as weights in thegamlss fit
xmin the minimum x-variable value (if the default values are out of range)
xmax the maximum x-variable value (if the default values are out of range)
g.control this is similar to gamlss.control in case that some of the control parametershave to be changed
density default value is FALSE. Change to TRUE if you would like a non-parametricdensity plot together with the parametric fitted distribution plot (for continuousvariable only)
main the main title for the plot
... for extra arguments to be passed to the truehist() or the gamlss function
Details
This function first fits constants for each parameters of a GAMLSS distribution family using thegamlss function and them plots the fitted distribution together with the appropriate plot accordingto whether the y variable is of a continuous or discrete type. Histogram is plotted for continuous andbarplot for discrete variables. The function truehist of Venables and Ripley’s MASS packageis used for the histogram plotting.
Value
returns a plot
Author(s)
Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
hodges 117
Examples
data(abdom)attach(abdom)histDist(y,family="NO")# use the ymax argument of the of the truehist()histDist(y,family="NO",ymax=0.005)# bad fit use PEhistDist(y,family="PE",ymax=0.005)detach(abdom)# discere data counts# Hand at al. p150 Leptinotarsa decemlineatay <- c(0,1,2,3,4,6,7,8,10,11)freq <- c(33,12,5,6,5,2,2,2,1,2)histDist(y, "NBI", freq=freq)# the same ashistDist(rep(y,freq), "NBI")
hodges Hodges data
Description
There two data sets contain data used in Hodges (1998). In addition to the data used in thatmanuscript, it contains other data items.
The original data consists of two matrices of dimensions of 341x6 and a 45x4 respectively.
The first matrix hodges describes plans. The information for each plan is: the state, a two-character code that identifies plans within state, the total premium for an individual, the total pre-mium for a family, the total enrollment of federal employees as individuals, and the total enrollmentof federal employees as families.
The second matrix, hodges, describes states. The information for each state is: its two-letterabbreviation, the state average expenses per admission (from American Medical Association 1991Annual Survey of Hospitals), population (1990 Census), and the region (from the Marion MerrillDow Managed Care Digest 1991).
The Hodges manuscript used these variables: Plan level: individual premium, individual enroll-ment. State level: expenses per admission, region.
Usage
data(hodges)
Format
Two data frames the first with 341 observations on the following 6 variables.
state a factor with 45 levels AL AZ CA CO CT DC DE FL GA GU HI IA ID IL IN KS KY LA MAMD ME MI MN MO NC ND NE NH NJ NM NV NY OH OK OR PA PR RI SC TN TX UT VA WA WI
plan a two-character code that identifies plans within state declared here as factor with 325 levals.
118 lo
prind a numeric vector showing the total premium for an individual
prfam a numeric vector showing the total premium for a family
enind a numeric vector showing the total enrollment of federal employees as individuals
enfam a numeric vector showing the total enrollment of federal employees as families.
and the second with 45 observations on the following 4 variables
State a factor with levels same as state above
expe a numeric vector showing the state average expenses per admission (from American MedicalAssociation 1991 Annual Survey of Hospitals)
pop a numeric vector shoing the population (1990 Census)
region the region (from the Marion Merrill Dow Managed Care Digest 1991), a factor with levelsMA MT NC NE PA SA SC
Details
Source
http://www.biostat.umn.edu/~hodges/
References
Hodges, J. S. (1998). Some algebra and geometry for hierarchical models, applied to diadnostics.J. R. Statist. Soc. B., 60 pp 497:536.
Examples
data(hodges)attach(hodges)plot(prind~state, cex=1, cex.lab=1.5, cex.axis=1, cex.main=1.2)str(hodges)data(hodges1)str(hodges1)
lo Specify a loess fit in a GAMLSS formula
Description
Allows the user to specify a loess fit in a GAMLSS formula. This function is similar to the lofunction in the gam implementation of S-plus
Usage
lo(..., span = 0.5, df = NULL, degree = 1)
lo 119
Arguments
... the unspecified ... can be a comma-separated list of numeric vectors, numericmatrix, or expressions that evaluate to either of these. If it is a list of vectors,they must all have the same length.
span the number of observations in a neighborhood. This is the smoothing parameterfor a loess fit.
df the effective degrees of freedom can be specified instead of span, e.g. df=5
degree the degree of local polynomial to be fit; can be 1 or 2.
Details
Note that lo itself does no smoothing; it simply sets things up for the function gamlss.lo()which is used by the backfitting function gamlss.add().
Value
a numeric matrix is returned. The simplest case is when there is a single argument to lo anddegree=1; a one-column matrix is returned, consisting of a normalized version of the vector. Ifdegree=2 in this case, a two-column matrix is returned, consisting of a 2d-degree orthogonal-polynomial basis. Similarly, if there are two arguments, or the single argument is a two-columnmatrix, either a two-column matrix is returned if degree=1, or a five-column matrix consisting ofpowers and products up to degree 2. Any dimensional argument is allowed, but typically one or twovectors are used in practice. The matrix is endowed with a number of attributes; the matrix itselfis used in the construction of the model matrix, while the attributes are needed for the backfittingalgorithms all.wam or lo.wam (weighted additive model). Local-linear curve or surface fits repro-duce linear responses, while local-quadratic fits reproduce quadratic curves or surfaces. These partsof the loess fit are computed exactly together with the other parametric linear parts of the model.
Warning
For user wanted to compare the gamlss() results with the equivalent gam() results in S-plus:make sure that the convergence criteria epsilon and bf.epsilon in S-plus are decreased sufficientlyto ensure proper convergence in S-plus
Note
Note that lo itself does no smoothing; it simply sets things up for gamlss.lo() to do the back-fitting.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉,based on the Trevor Hastie S-plus lo function
120 lpred
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
cs, random,
Examples
data(aids)attach(aids)# fitting a loess curve with span=0.4 plus the a quarterly effectaids1<-gamlss(y~lo(x,span=0.4)+qrt,data=aids,family=PO) #plot(x,y)lines(x,fitted(aids1))rm(aids1)detach(aids)
lpred Extract Linear Predictor Values and Standard Errors For A GAMLSSModel
Description
lpred is the GAMLSS specific method which extracts the linear predictor and its (approximate)standard errors for a specified parameter from a GAMLSS objects. The lpred can be also used toextract the fitted values (with its approximate standard errors) or specific terms in the model (withits approximate standard errors) in the same way that the predict.lm() and predict.glm()functions can be used for lm or glm objects. The function lp extract only the linear predictor. Ifprediction is required for new data values then use the function predict.gamlss().
Usage
lpred(obj, what = c("mu", "sigma", "nu", "tau"),type = c("link", "response", "terms"),terms = NULL, se.fit = FALSE, ...)
lp(obj, what = "mu", ...)
lpred 121
Arguments
obj a GAMLSS fitted model
what which distribution parameter is required, default what="mu"
type type="link" (the default) gets the linear predictor for the specified distribu-tion parameter. type="response" gets the fitted values for the parameterwhile type="terms" gets the fitted terms contribution
terms if type="terms", which terms to be selected (default is all terms)
se.fit if TRUE the approximate standard errors of the appropriate type are extracted
... for extra arguments
Value
If se.fit=FALSE a vector (or a matrix) of the appropriate type is extracted from the GAMLSSobject for the given parameter in what. If se.fit=TRUE a list containing the appropriate type,fit, and its (approximate) standard errors, se.fit.
Author(s)
Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
predict.gamlss
Examples
data(aids)mod<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #mod.t <- lpred(mod, type = "terms", terms= "qrt")mod.tmod.lp <- lp(mod)mod.lprm(mod, mod.t,mod.lp)
122 make.link.gamlss
make.link.gamlss Create a Link for GAMLSS families
Description
This function is used with the ’family’ functions in gamlss(). Given a link, it returns a linkfunction, an inverse link function, the derivative dpar/deta where par is the appropriate distributionparameter and a function for domain checking. It differs from the usual make.link of glm()by having extra links as the logshifted, the logitshifted and the own. For the use of theown link see the example bellow.
show.link provides a way in which the user can identify the link functions available for eachgamlss distribution. If your required link function is not available for any of the gamlss distributionsyou can add it in.
Usage
make.link.gamlss(link, par = 1)show.link(family = "NO")
Arguments
link character or numeric; one of "logit", "probit", "cloglog", "identity","log", "sqrt", "1/mu^2", "inverse", "logshifted", "logitshifted",or number, say lambda resulting in power link µλ).
par The shifted parameter(s) for logshifted and "logitshifted" i.e par=1for logshifted or par=c(0,2) for logitshifted
family a gamlss distribution family
Details
The own link function is added to allow the user greater flexibility. In order to used the own linkfunction for any of the parameters of the distribution the own link should appear in the availablelinks for this parameter. You can check this using the function show.link. If the own do notappear in the list you can create a new function for the distribution in which own is added in thelist. For example the first line of the code of the binomial distribution, BI, has change from
"mstats <- checklink("mu.link", "Binomial", substitute(mu.link), c("logit", "probit", "cloglog", "log")),in version 1.0-0 of gamlss, to
"mstats <- checklink("mu.link", "Binomial", substitute(mu.link), c("logit", "probit", "cloglog", "log","own"))
in version 1.0-1. Given that the parameter has own as an option the user needs also to define thefollowing four new functions in order to used an own link.
i) own.linkfun
ii) own.linkinv
iii) own.mu.eta and
make.link.gamlss 123
iv) own.valideta.
An example is given below.
Only one parameter of the distribution at a time is allowed to have its code link, (unless the samefour own functions above are suitable for more that one parameter of the distribution).
Value
For the make.link.gamlss a list with components
linkfun: Link function function(parameter)
linkinv: Inverse link function function(eta)
mu.eta: Derivative function(eta) dparameter/deta
valideta: function(eta) ’TRUE’ if all of ’eta’ is in the domain of linkinv .
For the show.link a list with components the available links for the distribution parameters
Note
For the links involving parameters as in logshifted and logitshifted the parameters canbe passed in the definition of the distribution by calling the checklink function, for example inthe definition of the tau parameter in BCPE distribution the following call is made: tstats <-checklink( "tau.link", "Box Cox Power Exponential", substitute(tau.link),c("logshifted", "log", "identity"), par.link = c(1))
Author(s)
Mikis Stasinopoulos and Bob Rigby
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, ((seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.family
Examples
str(make.link.gamlss("logitshifted"), par=c(-1,1))l2<-make.link.gamlss("logitshifted", par=c(-1,1))l2$linkfun(0) # should be zerol2$linkfun(1) # should be Infl2$linkinv(-5:5)# now use the own link function# first if the distribution allows youshow.link(BI)
124 model.frame.gamlss
# seems OK now define the four own functions# First try the probit link using the own link function# 1: the linkfun functionown.linkfun <- function(mu) eta <- qNO(p=mu)# 2: the inverse link functionown.linkinv <- function(eta)
thresh <- -qNO(.Machine$double.eps)eta <- pmin(thresh, pmax(eta, -thresh))pNO(eta)
# 3: the dmu/deta functionown.mu.eta <- function(eta) pmax(dNO(eta), .Machine$double.eps)own.valideta <- function(eta) TRUE# bring the datadata(aep)# fitting the model using "own"h1<-gamlss(y~ward+loglos+year, family=BI(mu.link="own"), data=aep)# model h1 should be identical toh2<-gamlss(y~ward+loglos+year, family=BI(mu.link="probit"), data=aep)# Second try the complementary log-log# using the Gumbel distributionown.linkfun <- function(mu) eta <- qGU(p=mu)own.linkinv <- function(eta)
thresh <- -qGU(.Machine$double.eps)eta <- pmin(thresh, pmax(eta, -thresh))pGU(eta)
own.mu.eta <- function(eta) pmax(dGU(eta), .Machine$double.eps)own.valideta <- function(eta) TRUE# h1 and h2 should be identicalh1<-gamlss(y~ward+loglos+year, family=BI(mu.link="own"), data=aep)h2<-gamlss(y~ward+loglos+year, family=BI(mu.link="cloglog"), data=aep)# note that the Gumbel distribution is negatively skew# for a positively skew link function we can used the Reverse Gumbelown.linkfun <- function(mu) eta <- qRG(p=mu)own.linkinv <- function(eta)
thresh <- -qRG(.Machine$double.eps)eta <- pmin(thresh, pmax(eta, -thresh))pRG(eta)
# third the dmu/deta functionown.mu.eta <- function(eta) pmax(dRG(eta), .Machine$double.eps)own.valideta <- function(eta) TRUEdata(aep)h1<-gamlss(y~ward+loglos+year, family=BI(mu.link="own"), data=aep)# a considerable improvement in the deviance
model.frame.gamlss Extract a model.frame, a model matrix or terms from a GAMLSS ob-ject for a given distributional parameter
model.frame.gamlss 125
Description
model.frame.gamlss, model.matrix.gamlss and terms.gamlss are the gamlss ver-sions of the generic functions model.frame, model.matrix and terms respectively.
Usage
## S3 method for class 'gamlss':model.frame(formula, what = c("mu", "sigma", "nu", "tau"), ...)## S3 method for class 'gamlss':terms(x, what = c("mu", "sigma", "nu", "tau"), ...)## S3 method for class 'gamlss':model.matrix(object, what = c("mu", "sigma", "nu", "tau"), ...)
Arguments
formula a gamlss object
x a gamlss object
object a gamlss object
what for which parameter to extract the model.frame, terms or model.frame
... for extra arguments
Details
Value
a model.frame, a model.matrix or terms
Note
Author(s)
Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
126 par.plot
Examples
data(aids)mod<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #model.frame(mod)model.matrix(mod)terms(mod, "mu")rm(mod)
par.plot A function to plot parallel plot for repeated measurement data
Description
This function can be used to plot parallel plots for each individual in a repeated measurement study.It is based on the coplot() function of R.
Usage
par.plot(formula = NULL, data = NULL, subjects = NULL,color = TRUE, show.given = TRUE, ...)
Arguments
formula a formula describing the form of conditioning plot. A formula of the form y ~x | a indicates that plots of y versus x should be produced conditional on thevariable a. A formula of the form y ~ x| a * b indicates that plots of yversus x should be produced conditional on the two variables a and b.
data a data frame containing values for any variables in the formula. By default theenvironment where par.plot was called from is used.
subjects a factor which distinguish between the individual participants
color whether the parallel plot are shown in colour, color=TRUE (the default) or notcolor=FALSE
show.given logical (possibly of length 2 for 2 conditioning variables): should conditioningplots be shown for the corresponding conditioning variables (default ’TRUE’)
... for extra arguments
Details
Value
It returns a plot.
Note
Note that similar plot can be fount in the library nlme by Pinheiro and Bates
pdf.plot 127
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
Examples
library(nlme)data(Orthodont)par.plot(distance~age,data=Orthodont,sub=Subject)par.plot(distance~age|Sex,data=Orthodont,sub=Subject)par.plot(distance~age|Subject,data=Orthodont,sub=Subject,show.given=FALSE)
pdf.plot Plots Probability Distribution Functions for GAMLSS Family
Description
A function to plot probability distribution functions (pdf) belonging to the gamlss family of distri-butions. This function allows either plotting of the fitted distributions for up to eight observationsor plotting specified distributions belonging in the gamlss family
Usage
pdf.plot(obj = NULL, obs = c(1), family = NO(), mu = NULL,sigma = NULL, nu = NULL, tau = NULL, min = NULL,max = NULL, step = NULL, allinone = FALSE,no.title = FALSE, ...)
Arguments
obj An gamlss object e.g. obj=model1 where model1 is a fitted gamlss object
obs A number or vector of up to length eight indicating the case numbers of the ob-servations for which fitted distributions are to be displayed, e.g. obs=c(23,58)will display the fitted distribution for the 23th and 58th observations
128 pdf.plot
family This must be a gamlss family i.e. family=NO
mu The value(s) of the location parameter mu for which the distribution has to beevaluated e.g mu=c(3,7)
sigma The value(s) the scale parameter sigma for which the distribution has to be eval-uated e.g sigma=c(3,7)
nu The value(s) the parameter nu for which the distribution has to be evaluated e.g.nu=3
tau The value(s) the parameter tau for which the distribution has be evaluated e.g.tau=5
min Minimum value of the random variable y e.g. min=0
max Maximum value of y e.g. max=10
step Steps for the evaluation of y e.g. step=0.5
allinone This will go
no.title Whether you need title in the plot, default is no.title=FALSE
... for extra arguments
Details
This function can be used to plot distributions of the GAMLSS family. If the first argument objis specified and it is a GAMLSS fitted object, then the fitted distribution of this model at specifiedobservation values (given by the second argument obs) is plotted for a specified y-variable range(arguments min, max, and step).
If the first argument is not given then the family argument has to be specified and the pdf is plottedat specified values of the parameters mu, sigma, nu, tau. Again the range of the y-variable hasto be given.
Value
plot(s) of the required pdf(s) are returned
Warning
The range of some distributions depends on the fitted parameters
Note
The range of the y values given by min, max and step are very important in the plot
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Calliope Akantziliotou
plot.gamlss 129
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
Examples
pdf.plot(family=BCT, min=1, max=20, step=.05, mu=10, sigma=0.15, nu=-1, tau=c(4,10,20,40) )# now using an gamlss objectdata(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom) # fitspdf.plot(obj=h , obs=c(23,67), min=50, max=150, step=.5)rm(h)
plot.gamlss Plot Residual Diagnostics for an GAMLSS Object
Description
This function provides four plots for checking the normalized (randomized for a discrete responsedistribution) quantile residuals of a fitted GAMLSS object, referred to as residuals below : a plotof residuals against fitted values, a plot of the residuals against an index or a specific explana-tory variable, a density plot of the residuals and a normal Q-Q plot of the residuals. If argumentts=TRUE then the first two plots are replaced by the autocorrelation function (ACF) and partialautocorrelation function (PACF) of the residuals
Usage
## S3 method for class 'gamlss':plot(x, xvar = NULL, parameters = NULL, ts = FALSE,
summaries = TRUE, ...)
Arguments
x a GAMLSS fitted object
xvar an explanatory variable to plot the residuals against
parameters plotting parameters can be specified here
ts set this to TRUE if ACF and PACF plots of the residuals are required
summaries set this to FALSE if no summary statistics of the residuals are required
... further arguments passed to or from other methods.
130 plot.gamlss
Details
This function provides four plots for checking the normalized (randomized) quantile residuals(called residuals) of a fitted GAMLSS object. Randomization is only performed for discreteresponse variables. The four plots are
• residuals against the fitted values (or ACF of the residuals if ts=TRUE)
• residuals against an index or specified x-variable (or PACF of the residuals if ts=TRUE)
• kernel density estimate of the residuals
• QQ-normal plot of the residuals
For time series response variables option ts=TRUE can be used to plot the ACF and PACF functionsof the residuals.
Value
Returns four plots related to the residuals of the fitted GAMLSS model and prints summary statisticsfor the residuals if the summary=T
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Kalliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss
Examples
data(aids)a<-gamlss(y~cs(x,df=7)+qrt,family=PO,data=aids)plot(a)rm(a)
polyS 131
polyS Auxiliary support for the GAMLSS
Description
These two functions are similar to the poly and polym in R. Are needed for the gamlss.lofunction of GAMLSS and should not be used on their own.
Usage
polyS(x, ...)poly.matrix(m, degree = 1)
Arguments
x a variable
m a variable
degree the degree of the polynomial
... for extra arguments
Value
Returns a matrix of orthogonal polynomials
Warning
Not be use by the user
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, ((seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.lo
132 predict.gamlss
predict.gamlss Extract Predictor Values and Standard Errors For New Data In AGAMLSS Model
Description
predict.gamlss is the GAMLSS specific method which produce predictors for a new dataset for a specified parameter from a GAMLSS objects. The predict.gamlss can be used toextract the linear predictors, fitted values and specific terms in the model at new data values in thesame way that the predict.lm() and predict.glm() functions can be used for lm or glmobjects. Note that linear predictors, fitted values and specific terms in the model at the current datavalues can also be extracted using the function lpred() (which is called from predict if new datais NULL).
Usage
## S3 method for class 'gamlss':predict(object, what = c("mu", "sigma", "nu", "tau"),
newdata = NULL, type = c("link", "response", "terms"),terms = NULL, se.fit = FALSE, data = NULL, ...)
Arguments
object a GAMLSS fitted model
what which distribution parameter is required, default what="mu"
newdata a data frame containing new values for the explanatory variables used in themodel
type the default, gets the linear predictor for the specified distribution parameter.type="response" gets the fitted values for the parameter while type="terms"gets the fitted terms contribution
terms if type="terms", which terms to be selected (default is all terms)
se.fit if TRUE the approximate standard errors of the appropriate type are extracted ifexist
data the data frame used in the original fit if is not defined in the call
... for extra arguments
Details
The predict function assumes that the object given in newdata is a data frame containing theright x-variables used in the model. This could possible cause problems if transformed vari-ables are used in the fitting of the original model. For example, let us assume that a transfor-mation of age is needed in the model i.e. nage<-age^.5. This could be fitted as mod<-gamlss(y~cs(age^.5),data=mydata) or as nage<-age^.5; mod<-gamlss(y~cs(nage),data=mydata). The later could more efficient if the data are in thousands rather in hundreds. Inthe first case, the code predict(mod,newdata=data.frame(age=c(34,56))) would
predict.gamlss 133
produce the right results. In the second case a new data frame has to be created containing the olddata plus any new transform data. This data frame has to be declared in the data option. Theoption newdata should contain a data.frame with the new names and the transformed values inwhich prediction is required, (see the last example).
Value
A vector or a matrix depending on the options.
Note
This function is under development
Author(s)
Mikis Stasinopoulos
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
lp, lpred
Examples
data(aids)a<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #newaids<-data.frame(x=c(45,46,47), qrt=c(2,3,4))ap <- predict(a, newdata=newaids, type = "response")aprm(a, ap)data(abdom)# transform xaa<-gamlss(y~cs(x^.5),data=abdom)# predict at old valuespredict(aa)[610]# predict at new valuespredict(aa,newdata=data.frame(x=42.43))# now transform x firstnx<-abdom$x^.5aaa<-gamlss(y~cs(nx),data=abdom)# create a new data framenewd<-data.frame( abdom, nx=abdom$x^0.5)# predict at old valuespredict(aaa)[610]
134 print.gamlss
# predict at new valuespredict(aaa,newdata=data.frame(nx=42.43^.5), data=newd)
print.gamlss Prints a GAMLSS fitted model
Description
print.gamlss is the GAMLSS specific method for the generic function print which printsobjects returned by modelling functions.
Usage
## S3 method for class 'gamlss':print(x, digits = max(3, getOption("digits") - 3), ...)
Arguments
x a GAMLSS fitted model
digits the number of significant digits to use when printing
... for extra arguments
Details
Value
Prints a gamlss object
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files,(seealso http://www.gamlss.com/).
See Also
gamlss, deviance.gamlss, fitted.gamlss
prof.dev 135
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids)print(h) # or just hrm(h)
prof.dev Plotting the Profile Deviance for one of the Parameters in a GAMLSSmodel
Description
This functions plots the profile deviance of one of the (four) parameters in a GAMLSS model. It canbe used if one of the parameters mu, sigma, nu or tau is a constant (not a function of explanatoryvariables) to obtain a profile confidence intervals.
Usage
prof.dev(object, which = NULL, min = NULL, max = NULL, step = NULL,startlastfit = TRUE, type = "o", plot = TRUE, perc = 95,...)
Arguments
object A fitted GAMLSS modelwhich which parameter to get the profile deviance e.g. which="tau"min the minimum value for the parameter e.g. min=1max the maximum value for the parameter e.g. max=20step how often to evaluate the global deviance (defines the step length of the grid for
the parameter) e.g. step=1startlastfit whether to start fitting from the last fit or not, default value is startlastfit=TRUEtype what type of plot required. This is the same as in type for plot, default value
is type="o", that is, both line and pointsplot whether to plot, plot=TRUE or save the results, plot=FALSEperc what % confidence interval is required... for extra arguments
Details
This function can be use to provide likelihood based confidence intervals for a parameter for whicha constant model (i.e. no explanatory model) is fitted and consequently for checking the adequacy ofa particular values of the parameter. This can be used to check the adequacy of one distribution (e.g.Box-Cox Cole and Green) nested within another (e.g. Box-Cox power exponential). For exampleone can test whether a Box-Cox Cole and Green (Box-Cox-normal) distribution or a Box-Coxpower exponential is appropriate by plotting the profile of the parameter tau. A profile devianceshowing support for tau=2 indicates adequacy of the Box-Cox Cole and Green (i.e. Box-Coxnormal) distribution.
136 prof.term
Value
A plot of profile global deviance
Warning
A dense grid (i.e. small step) evaluation of the global deviance can take a long time, so start with asparse grid (i.e. large step) and decrease gradually the step length for more accuracy.
Author(s)
Calliope Akantziliotou, Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, prof.term
Examples
data(abdom)h<-gamlss(y~cs(x,df=3), sigma.formula=~cs(x,1), family=BCT, data=abdom)prof.dev(h,"nu",min=-2.000,max=2,step=0.25,type="l")rm(h)
prof.term Plotting the Profile: deviance or information criterion for one of theterms (or hyper-parameters) in a GAMLSS model
Description
This functions plots the profile deviance for a chosen parameter included in the linear predictor ofany of the mu, sigma, nu or tau models so profile confidence intervals can be obtained. In canalso be used to plot the profile of a specified information criterion for any hyperparameter.
Usage
prof.term(model = NULL, criterion = "GD", penalty = 2.5, other = NULL,min = NULL, max = NULL, step = NULL, type = "o", xlabel = NULL,plot = TRUE, term = TRUE, perc = 95, ... )
prof.term 137
Arguments
model this is a GAMLSS model, e.g.model=gamlss(y~cs(x,df=this),sigma.fo=~cs(x,df=3),data=abdom),where this indicates the (hyper)parameter to be profiled
criterion whether global deviance ("GD") or information criterion ("IC") is profiled. Thedefault is criterion="GD"
penalty The penalty value if information criterion is used in criterion, default penalty=2.5
other this can be used to evaluate an expression before the actual fitting of the model
min the minimum value for the parameter e.g. min=1
max the maximum value for the parameter e.g. max=20
step how often to evaluate the global deviance (defines the step length of the grid forthe parameter) e.g. step=1
type what type of plot required. This is the same as in type for plot, default valueis type="o", that is, both line and points
xlabel if a label for the axis is required
plot whether to plot, plot=TRUE or save the results, plot=FALSE
term this has the value TRUE and it should be changed to FALSE if a profile globaldeviance is required for a hyperparameter so the IC are suppressed
perc what % confidence interval is required
... for extra arguments
Details
This function can be use to provide likelihood based confidence intervals for a parameter involved interms in the linear predictor(s). These confidence intervals are more accurate than the ones obtainedfrom the parameters’ standard errors. The function can also be used to plot a profile informationcriterion (with a given penalty) against a hyperparameter. This can be used to check the uniquenessin hyperparameter determination using for example find.df.
Value
Return a profile plot (if the argument plot=TRUE) or the values of the parameters and the IC orGD values otherwise
Warning
A dense grid (i.e. small step) evaluation of the global deviance can take a long time, so start with asparse grid (i.e. large step) and decrease gradually the step length for more accuracy.
Author(s)
Mikis Stasinopoulos 〈[email protected]〉 and Bob Rigby 〈[email protected]〉
138 ps
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, prof.dev
Examples
data(aids)gamlss(y~x+qrt,family=NBI,data=aids)mod<-quote(gamlss(y ~ offset(this * x) + qrt, data = aids, family = NBI))prof.term(mod, min=0.06, max=0.11, step=0.001)mod1<-quote(gamlss(y ~ cs(x,df=this) + qrt, data = aids, family = NBI))prof.term(mod1, min=1, max=15, step=1, criterion="IC")mod2 <- quote(gamlss(y ~ x+I((x>this)*(x-this))+qrt,family=NBI,data=aids))prof.term(mod2, min=1, max=45, step=1, criterion="GD")rm(mod,mod1,mod2)
ps Specify a Penalised Spline Fit in a GAMLSS Formula
Description
The function takes a vector and returns it with several attributes. The vector is used in the con-struction of the model matrix. The function ps() does no smoothing, but assigns the attributes tothe vector to aid gamlss in the smoothing. The function doing the smoothing is gamlss.cs() (amodified version of the R function smooth.spline()) which is used at the backfitting functionadditive.fit .
Usage
ps(x, df = 3, lambda = NULL, ps.intervals = 20, degree = 3, order = 3)
Arguments
x the univariate predictor, (or expression, that evaluates to a numeric vector).
df the desired equivalent number of degrees of freedom (trace of the smoother ma-trix minus two for the constant and linear fit
lambda the smoothing parameter,
ps.intervals the no of break points in the x-axis
degree the degree of the piecewise polynomial
order the difference in the coefficients
ps 139
Details
The ps() function is based on Brian Marx function which can be found in http://www.stat.lsu.edu/faculty/marx/
Value
the vector x is returned, endowed with a number of attributes. The vector itself is used in theconstruction of the model matrix, while the attributes are needed for the backfitting algorithmsadditive.fit().
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected] 〉
References
http://www.stat.lsu.edu/faculty/marx/
Eilers, P. H. C. and Marx, B. D. (1996). Flexible smoothing with B-splines and penalties (withcomments and rejoinder). Statist. Sci, 11, 89-121.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
See Also
gamlss, gamlss.ps, cs
Examples
data(aids)attach(aids)# fitting a smoothing cubic spline with 7 degrees of freedom# plus the a quarterly effectaids1<-gamlss(y~ps(x,df=7)+qrt,data=aids,family=PO) #plot(x,y)lines(x,fitted(aids1))rm(aids1)detach(aids)
140 ra
ra Specify Simple Random Effect In A GAMLSS Formula
Description
This is an experimental smoother for use with factors in gamlss(). It allows the fitted values fora factor predictor to be shrunk towards the overall mean, where the amount of shrinking dependseither on lambda, or on the equivalent degrees of freedom (df).
This function is slightly more general, but considerably slower than the random function .
Usage
ra(xfactor, xvector = NULL, df = NULL, lambda = NULL, order = 0,estimate = FALSE, expl = NULL, data1 = NULL)
Arguments
xfactor a factor defining the subjects grouping in a one factor random effect model terme.g. xfactor=Subjects
xvector a variable if interaction with the xfactor is required xvector (experimental)
df required equivalent degrees of freedom e.g. df=10
lambda the smoothing parameter which is the reciprocal (i.e. inverse) of the variance ofthe random effect
order the order of the difference in the matrix D, order=1 is for simple randomeffects, order=2 is for random walk order 1 and order=3 is for randomwalk order 2
estimate whether to estimate the lambda parameter within the backfitting iterations (veryunreliable). Set by default to estimate=FALSE. [The lambda parameter canbe more accurately estimated by selecting the corresponding smoothing degreesof freedom using find.hyper]
expl this allows an explanatory variable at the subject level to be fitted e.g. expl=~x1+x2
data1 the data frame for the subject level variables data1
Details
Value
xfactor is returned with class "smooth", with an attribute named "call" which is to be evaluated inthe backfitting additive.fit() called by gamlss()
Warning
This is experimental and likely to change soon
random 141
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
random, gamlss
Examples
data(aids)attach(aids)# fitting a loess curve with span=0.4 plus the a quarterly effectaids1<-gamlss(y~lo(x,span=0.4)+qrt,data=aids,family=PO) ## now we string the quarterly effect using randomaids2<-gamlss(y~lo(x,span=0.4)+ra(qrt,df=2),data=aids,family=PO) #plot(x,y)lines(x,fitted(aids1),col="red")lines(x,fitted(aids2),col="purple")rm(aids1,aids2)detach(aids)
random Specify a simple random effect in a GAMLSS Formula
Description
Includes random effect terms in an GAMLSS model.
Usage
random(xvar, df = NULL, lambda = 0)
Arguments
xvar a factordf the target degrees of freedomlambda the smoothing parameter lambda which can be viewed as a shrinkage parameter.
142 random
Details
This is an experimental smoother for use with factors in gamlss(). It allows the fitted values fora factor predictor to be shrunk towards the overall mean, where the amount of shrinking dependseither on lambda, or on the equivalent degrees of freedom. Similar in spirit to smoothing splines,this fitting method can be justified on Bayesian grounds or by a random effects model.
Since factors are coded by model.matrix() into a set of contrasts, care has been taken to add anappropriate "contrast" attribute to the output of random(). This zero contrast results in a column ofzeros in the model matrix, which is aliased with any column and is hence ignored
Value
x is returned with class "smooth", with an attribute named "call" which is to be evaluated in thebackfitting additive.fit() called by gamlss()
Author(s)
Trevor Hastie (amended by Mikis Stasinopoulos)
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, gamlss.random
Examples
data(aids)attach(aids)# fitting a loess curve with span=0.4 plus the a quarterly effectaids1<-gamlss(y~lo(x,span=0.4)+qrt,data=aids,family=PO) ## now we string the quarterly effect using randomaids2<-gamlss(y~lo(x,span=0.4)+random(qrt,df=2),data=aids,family=PO) #plot(x,y)lines(x,fitted(aids1),col="red")lines(x,fitted(aids2),col="purple")rm(aids1,aids2)detach(aids)
rc 143
rc Specify Random Coefficients In A GAMLSS Formula
Description
Fits Random Coefficients In A GAMLSS Model.
Usage
rc(formula, lambda = NULL)
Arguments
formula a model formula to specify the explanatory variable and the subject groupingfactor e.g. formula=~x1|Subjects will fit random constant and slopes forx1 for each level of Subjects
lambda a matrix specifying the variance-covariance matrix for the random coefficientse.g. lambda=diag2,5
Details
This is an experimental function and it is likely to change in the near future. For a chosen fixedvariance-covariance matrix for the random coefficients, this function finds the MAP estimates forthe constant and slope random effects for the different subjects
Value
The variables in the left side of the formula are returned with class "smooth", and attribute named"call" which is to be evaluated in the backfitting additive.fit() called by gamlss()
Warning
This is experimental
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
144 refit
See Also
random, ra, gamlss
Examples
refit Refit a GAMLSS model
Description
This function refits a GAMLSS model. It is useful when the algorithm has not converged after 20outer iteration (the default value)
Usage
refit(object, ...)
Arguments
object a GAMLSS fitted model which has not converged
... for extra arguments
Details
This function is useful when the iterations have reach the maximum value set by the code(n.cyc) ofthe gamlss.control function and the model has not converged yet
Value
Returns a GAMLSS fitted model
Note
The function update does a very similar job
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
rent 145
See Also
codegamlss, update.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #refit(h)rm(h)
rent Rent data
Description
A survey was conducted in April 1993 by Infratest Sozialforschung. A random sample of accommo-dation with new tenancy agreements or increases of rents within the last four years in Munich wasselected including: i) single rooms, ii) small apartments, iii) flats, iv) two-family houses. Accom-modation subject to price control rents, one family houses and special houses, such as penthouses,were excluded because they are rather different from the rest and are considered a separate market.For the purpose of this study, 1967 observations of the variables listed below were used, i.e. the rentresponse variable R followed by the explanatory variables found to be appropriate for a regressionanalysis approach by Fahrmeir et al. (1994, 1995):
Usage
data(rent)
Format
A data frame with 1969 observations on the following 9 variables.
R : rent response variable, the monthly net rent in DM, i.e. the monthly rent minus calculated orestimated utility cost
Fl : floor space in square metersA : year of constructionSp : a variable indicating whether the location is above average, 1, (550 observations) or not, 0,
(1419 observations)Sm : a variable indicating whether the location is below, 1, average (172 obs.) or not, 0, (1797
obs.)B : a factor with levels indicating whether there is a bathroom, 1, (1925 obs.) or not, 0, (44 obs.)H : a factor with levels indicating whether there is central heating, 1, (1580 obs.) or not, 0, (389
obs.)L : a factor with levels indicating whether the kitchen equipment is above average, 1, (161 obs.)
or not, 0, (1808 obs.)loc : a factor (combination of Sp and Sm) indicating whether the location is below, 1, average, 2,
or above average 3
146 residuals.gamlss
Details
This set of data were used by Stasinopoulos et al. (2000) to fit a model where both the mean andthe dispersion parameter of a Gamma distribution were modelled using the explanatory variables.
Source
Provide by Prof. L. Fahrmeir
References
Fahrmeir L., Gieger C., Mathes H. and Schneeweiss H. (1994) Gutachten zur Erstellung des Miet-spiegels fur Munchen 1994, Teil B: Statistiche Analyse der Nettomieten. Hrsg: LandeshaupttstadtMunchen, Sozialreferat-Amt fur Wohnungswesen.
Fahrmeir L., Gieger C., and Klinger, A. (1995) Additive, dynamic and multiplicative regression. InApplied Statistics: Recent Developments, Vandenhoeck and Ruprecht, Gottingen.
Stasinopoulos, D. M., Rigby, R. A. and Fahrmeir, L., (2000), Modelling rental guide data usingmean and dispersion additive models, Statistician, 49 , 479-493.
Examples
data(rent)attach(rent)plot(Fl,R)
residuals.gamlss Extract Residuals from GAMLSS model
Description
residuals.gamlss is the GAMLSS specific method for the generic function residualswhich extracts the residuals for a fitted model. The abbreviated form resid is an alias for residuals.
Usage
## S3 method for class 'gamlss':residuals(object, what = c("z-scores", "mu", "sigma", "nu", "tau"),
type = c("simple", "weighted", "partial"),terms=NULL, ...)
Arguments
object a GAMLSS fitted modelwhat specify whether the standardized residuals are required, called here the "z-scores",
or residuals for a specific parametertype the type of residual if residuals for a parameter are requiredterms if type is "partial" this specifies which term is required... for extra arguments
residuals.gamlss 147
Details
The "z-scores" residuals saved in a GAMLSS object are the normalized (randomized) quantile resid-uals (see Dunn and Smyth, 1996). Randomization is only needed for the discrete family distribu-tions, see also rqres.plot. Residuals for a specific parameter can be "simple" = (working vari-able - linear predictor), "weighted"= sqrt(working weights)*(working variable - linear predictor) or"partial"= (working variable - linear predictor)+contribution of specific terms.
Value
a vector or a matrix of the appropriate residuals of a GAMLSS model. Note that when weights areused in the fitting the length of the residuals can be different from N the length of the fitted values.Observations with weights equal to zero are not appearing in the residuals. Also observations withfrequencies as weights will appear more than once according to their frequencies.
Note
The "weighted" residuals of a specified parameter can be zero and one if the square of first derivativehave been used in the fitting of this parameter
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
print.gamlss, summary.gamlss, fitted.gamlss, coef.gamlss, residuals.gamlss,update.gamlss, plot.gamlss, deviance.gamlss, formula.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=NBI, data=aids) #plot(aids$x,resid(h))plot(aids$x,resid(h,"sigma") )rm(h)
148 rqres.plot
rqres.plot Plotting Randomized Quantile Residuals
Description
This function plots QQ-plots of the normalized randomized quantile residuals (see Dunn and Smyth,1996) for a model using a discrete GAMLSS family distribution.
Usage
rqres.plot(obj = NULL, howmany = 6, all = TRUE, save = FALSE, ...)
Arguments
obj a fitted GAMLSS model object from a "discrete" type of family
howmany The number of QQ-plots required up to ten i.e. howmany=6
all if TRUE QQ-plots from howmany realizations are plotted. If FALSE then asingle qq-plot of the median of the howmany realizations is plotted
save If TRUE the median residuals can be saved
... for extra arguments
Details
For discrete family distributions, the gamlss() function saves on exit one realization of ran-domized quantile residuals which can be plotted using the generic function plot which calls theplot.gamlss. Looking at only one realization can be misleading, so the current function createsQQ-plots for several realizations. The function allows up to 10 QQ-plots to be plotted. Occasion-ally one wishes to create a lot of realizations and then take a median of them (separately for eachordered value) to create a single median realization. The option all in combinations with the op-tion howmany creates a QQ-plot of the medians of the normalized randomized quantile residuals.These ’median’ randomized quantile residuals can be saved using the option (save=TRUE).
Value
If save it is TRUE then the vector of the median residuals is saved.
Warning
....
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉
stepGAIC 149
References
Dunn, P. K. and Smyth, G. K. (1996) Randomised quantile residuals, J. Comput. Graph. Statist., 5,236–244
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
plot.gamlss, gamlss
Examples
data(aids) # fitting a model from a discrete distributionh<-gamlss(y~cs(x,df=7)+qrt, family=NBI, data=aids) #plot(h)# plot qq- plots from 6 realization of the randomized quantile residualsrqres.plot(h)# a qq-plot from the medians from 40 realizationsrqres.plot(h,howmany=40,all=FALSE) #
stepGAIC Choose a model by GAIC in a Stepwise Algorithm
Description
The function stepGAIC() performs stepwise model selection using a Generalized Akaike Infor-mation Criterion. The function stepGAIC() calls one of the two functions stepGAIC.VR()or stepGAIC.CH() depending on the argument additive. The function stepGAIC.VR()is based on the function stepAIC() given in the library MASS of Venables and Ripley (2002).The function stepGAIC.CH is based on the S function step.gam() (see Chambers and Hastie(1991)) and it is more suited for model with smoothing additive terms. Both functions havebeen adapted to work with gamlss objects. The main difference for the user is the scope argu-ment, see below. If the stepGAIC() is called with the argument additive=FALSE then thestepGAIC.VR() is called else the stepGAIC.CH().
Usage
stepGAIC.VR(object, scope, direction = c("both", "backward", "forward"),trace = T, keep = NULL, steps = 1000, scale = 0,what = c("mu", "sigma", "nu", "tau"), k = 2, ...)
stepGAIC.CH(object, scope = gamlss.scope(model.frame(object)),direction = c("both", "backward", "forward"), trace = T, keep = NULL,
150 stepGAIC
steps = 1000, what = c("mu", "sigma", "nu", "tau"), k = 2, ...)
stepGAIC(object, scope = gamlss.scope(model.frame(object)),direction = c("both", "backward", "forward"),trace = T, keep = NULL, steps = 1000,what = c("mu", "sigma", "nu", "tau"), k = 2,additive = FALSE, ...)
Arguments
object an gamlss object. This is used as the initial model in the stepwise search.
scope defines the range of models examined in the stepwise search. For the functionstepAIC() this should be either a single formula, or a list containing compo-nents upper and lower, both formulae. See the details for how to specify theformulae and how they are used. For the function stepGAIC the scope definesthe range of models examined in the step-wise search. It is a list of formulas,with each formula corresponding to a term in the model. A 1 in the formulaallows the additional option of leaving the term out of the model entirely. +
direction the mode of stepwise search, can be one of both, backward, or forward,with a default of both. If the scope argument is missing the default fordirection is backward
trace if positive, information is printed during the running of stepAIC. Larger valuesmay give more information on the fitting process.
keep a filter function whose input is a fitted model object and the associated ’AIC’statistic, and whose output is arbitrary. Typically ’keep’ will select a subsetof the components of the object and return them. The default is not to keepanything.
steps the maximum number of steps to be considered. The default is 1000 (essentiallyas many as required). It is typically used to stop the process early.
scale scale is nor used in gamlss
what which distribution parameter is required, default what="mu"
k the multiple of the number of degrees of freedom used for the penalty. Only ’k =2’ gives the genuine AIC: ’k = log(n)’ is sometimes referred to as BIC or SBC.
additive if additive=TRUE then stepGAIC.CH is used else stepGAIC.CH, de-fault value is FALSE
... any additional arguments to ’extractAIC’. (None are currently used.)
Details
The set of models searched is determined by the scope argument.
For the function stepGAIC.VR() the right-hand-side of its lower component is always includedin the model, and right-hand-side of the model is included in the upper component. If scope isa single formula, it specifies the upper component, and the lower model is empty. If scope ismissing, the initial model is used as the upper model.
stepGAIC 151
Models specified by scope can be templates to update object as used by update.formula.
For the function stepGAIC.CH() each of the formulas in scope specifies a "regimen" of candidateforms in which the particular term may enter the model. For example, a term formula might be
x1 + log(x1) + cs(x1, df=3)
This means that x1 could either appear linearly, linearly in its logarithm, or as a smooth functionestimated non-parametrically. Every term in the model is described by such a term formula, and thefinal model is built up by selecting a component from each formula.
The function gamlss.scope similar to the S gam.scope() in Chambers and Hastie (1991)can be used to create automatically term formulae from specified data or model frames.
The supplied model object is used as the starting model, and hence there is the requirement that oneterm from each of the term formulas of the parameters be present in the formula of the distributionparameter. This also implies that any terms in formula of the distribution parameter not containedin any of the term formulas will be forced to be present in every model considered.
Value
the stepwise-selected model is returned, with up to two additional components. There is an ’"anova"’component corresponding to the steps taken in the search, as well as a ’"keep"’ component if the’keep=’ argument was supplied in the call. The ’"Resid. Dev"’ column of the analysis of deviancetable refers to a constant minus twice the maximized log likelihood
Note
Author(s)
Mikis Stasinopoulos based on functions in MASS library and in Statistical Models in S
References
Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
See Also
gamlss.scope
152 summary.gamlss
Examples
data(usair)# Note default of additive=FALSE# fitting all variables linearlymod1<-gamlss(y~., data=usair, family=GA)# find the best subset for the mumod2<-stepGAIC(mod1)mod2$anova# find the best subset for sigmamod3<-stepGAIC(mod2, what="sigma", scope=~x1+x2+x3+x4+x5+x6)mod3$anova# now use the stepGAIC.CH function# creating a scope from the usair model framegs<-gamlss.scope(model.frame(y~x1+x2+x3+x4+x5+x6, data=usair))gsmod4<-gamlss(y~1, data=usair, family=GA)mod5<-stepGAIC(mod4,gs, additive=TRUE)mod5$anovamod6<-stepGAIC(mod5, what="sigma", scope=~x1+x2+x3+x4+x5+x6)mod6$anovamod6
summary.gamlss Summarizes a GAMLSS fitted model
Description
summary.gamlss is the GAMLSS specific method for the generic function summary whichsummarize objects returned by modelling functions.
Usage
## S3 method for class 'gamlss':summary(object, type = c("vcov", "qr"), ...)
Arguments
object a GAMLSS fitted model
type the default value vcov uses the vcov() method for gamlss to get the variance-covariance matrix of the estimated beta coefficients, see details below. The alter-native qr is the original method used in gamlss to estimated the standard errorsbut it is not reliable since it do not take into the account the inter-correlationbetween the distributional parameters mu, sigma, nu and tau.
... for extra arguments
summary.gamlss 153
Details
Using the default value type="vcov", the vcov() method for gamlss is used to get the variancecovariance matrix (and consequently the standard errors)of the beta parameters. The variance co-variance matrix is calculated using the inverse of the numerical second derivatives of the observedinformation matrix. This is a more reliable method since it take into the account the inter-correlationbetween the all the parameters. The type="qr" assumes that the parameters are fixed at the es-timated values. Note that both methods are not appropriate and should be used with caution ifsmoothing terms are used in the fitting.
Value
Print summary of a GAMLSS object
Note
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉and Calliope Akantziliotou
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2003) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
gamlss, deviance.gamlss, fitted.gamlss
Examples
data(aids)h<-gamlss(y~poly(x,3)+qrt, family=PO, data=aids) #summary(h)rm(h)
154 term.plot
term.plot Plot regression terms for a specified parameter of a GAMLSS object
Description
Plots regression terms against their predictors, optionally with standard errors and partial residualsadded. It is almost identical to the R function termplot suitable changed to apply to GAMLSSobjects.
Usage
term.plot(object, what = c("mu", "sigma", "nu", "tau"), data = NULL,envir = environment(formula(object)),partial.resid = FALSE, rug = FALSE,terms = NULL, se = FALSE, xlabs = NULL, ylabs = NULL,main = NULL, col.term = 2, lwd.term = 1.5,col.se = "orange", lty.se = 2, lwd.se = 1,col.res = "gray", cex = 1, pch = par("pch"),col.smth = "darkred", lty.smth = 2,span.smth = 2/3,ask = interactive() && nb.fig < n.tms && .Device != "postscript",use.factor.levels = TRUE, smooth = NULL, ...)
Arguments
object a GAMLSS object
what the required parameter of the GAMLSS distribution
data data frame in which variables in object can be found
envir environment in which variables in object can be foundpartial.resid
logical; should partial residuals be plotted?
rug add rugplots (jittered 1-d histograms) to the axes?
terms which terms to plot (default ’NULL’ means all terms)
se plot pointwise standard errors?
xlabs vector of labels for the x axes
ylabs vector of labels for the y axes
main logical, or vector of main titles; if ’TRUE’, the model’s call is taken as maintitle, ’NULL’ or ’FALSE’ mean no titles.
col.term, lwd.termcolor and width for the "term curve", see ’lines’.
col.se, lty.se, lwd.secolor, line type and line width for the "twice-standard-error curve" when ’se =TRUE’.
term.plot 155
col.res, cex, pchcolor, plotting character expansion and type for partial residuals, when ’par-tial.resid = TRUE’, see ’points’.
lty.smth,col.smth, span.smthPassed to ’smooth’
ask logical; if ’TRUE’, the user is asked before each plot, see ’par(ask=.)’.use.factor.levels
Should x-axis ticks use factor levels or numbers for factor terms?
smooth ’NULL’ or a function with the same arguments as ’panel.smooth’ to draw asmooth through the partial residuals for non-factor terms
... other graphical parameters
Details
The function uses the lpred function of GAMLSS. The ’data’ argument should rarely be needed,but in some cases ’termplot’ may be unable to reconstruct the original data frame. Using ’na.action=na.exclude’makes these problems less likely. Nothing sensible happens for interaction terms.
Value
a plot of fitted terms.
Note
Author(s)
Mikis Stasinopoulos based on the existing termplot() function
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
termplot
Examples
data(aids)a<-gamlss(y~cs(x,df=8)+qrt,data=aids,family=NBI)term.plot(a, se=TRUE)rm(a)
156 update.gamlss
update.gamlss Update and Re-fit a GAMLSS Model
Description
update.gamlss is the GAMLSS specific method for the generic function update which up-dates and (by default) refits a GAMLSS model.
Usage
## S3 method for class 'gamlss':update(object, formula., ..., what = c("mu", "sigma", "nu", "tau"),
evaluate = TRUE)
Arguments
object a GAMLSS fitted model
formula. the formula to update
... for updating argument in gamlss()
what the parameter in which the formula needs updating
evaluate whether to evaluate the call or not
Value
Returns a GAMLSS object
Author(s)
Mikis Stasinopoulos 〈[email protected]〉, Bob Rigby 〈[email protected]〉
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
See Also
print.gamlss, summary.gamlss, fitted.gamlss, coef.gamlss, residuals.gamlss,plot.gamlss, deviance.gamlss, formula.gamlss
usair 157
Examples
data(aids)# fit a poisson modelh.po <-gamlss(y~cs(x,2)+qrt, family=PO, data=aids)# update with a negative binomialh.nb <-update(h.po, family=NBI)# update the smoothingh.nb1 <-update(h.nb,~cs(x,8)+qrt)# remove qrth.nb2 <-update(h.nb1,~.-qrt)# put back qrt take log of y and fit a normal distributionh.nb3 <-update(h.nb1,log(.)~.+qrt, family=NO)# verify that it is the sameh.no<-gamlss(log(y)~cs(x,8)+qrt,data=aids )
usair US air pollution data set
Description
US air pollution data set taken from Hand et al. (1994) data set 26, USAIR.DAT, originally fromSokal and Rohlf (1981).
Usage
data(usair)
Format
A data frame with 41 observations on the following 7 variables.
y a numeric vector: sulpher dioxide concentration in air mgs. per cubic metre in 41 cities in theUSA
x1 a numeric vector: average annual temperature in degrees F
x2 a numeric vector: number of manufacturers employing >20 workers
x3 a numeric vector: population size in thousands
x4 a numeric vector: average annual wind speed in miles per hour
x5 a numeric vector: average annual rainfall in inches
x6 a numeric vector: average number of days rainfall per year
Details
Source
Hand et al. (1994) data set 26, USAIR.DAT, originally from Sokal and Rohlf (1981)
158 wp
References
Hand, D. J., Daly, F., Lunn, A. D., McConway, K. J. and Ostrowski, E. (1994), A handbook of smalldata sets, Chapman and Hall, London.
Examples
data(usair)str(usair)plot(usair)# a possible gamlss modelap<-gamlss(y~cs(x1,2)+x2+x3+cs(x4,2)+x5+cs(x6,3)+x4:x5,
data=usair, family=GA(mu.link="inverse"))
wp Worm plot
Description
Provides single or multiple worm plots for GAMLSS fitted objects. This is a diagnostic tool forchecking the residuals within different ranges (by default not overlapping) of the explanatory vari-able
Usage
wp(object, xvar = NULL, n.inter = 4, xcut.points = NULL,overlap = 0, xlim.all = 4, xlim.worm = 3.5,show.given = TRUE, line = TRUE,ylim.all = 12 * sqrt(1/length(fitted(object))),ylim.worm = 12 * sqrt(n.inter/length(fitted(object))),cex = 1, pch = 21, ...)
Arguments
object a GAMLSS fitted object
xvar the explanatory variable against which the worm plots will be plotted
n.inter the number of intervals in which the explanatory variable xvar will be cut
xcut.points the x-axis cut off points e.g. c(20,30). If xcut.points=NULL then then.inter argument is activated
overlap how much overlapping in the xvar intervals. Default value is overlap=0 fornon overlapping intervals
xlim.all for the single plot, this value is the x-variable limit, default is xlim.all=4
xlim.worm for multiple plots, this value is the x-variable limit, default is xlim.worm=3.5
show.given whether to show the x-variable intervals in the top of the graph, default isshow.given=TRUE
wp 159
line whether to plot the polynomial line in the worm plot, default value is line=TRUE
ylim.all for the single plot, this value is the y-variable limit, default value is ylim.all=12*sqrt(1/length(fitted(object)))
ylim.worm for multiple plots, this values is the y-variable limit, default value is ylim.worm=12*sqrt(n.inter/length(fitted(object)))
cex the cex plotting parameter with default cex=1
pch the pch plotting parameter with default pch=21
... for extra arguments
Details
If the xvar argument is not specified then a single worm plot is used. In this case a worm plot isa detrended normal QQ-plot so departure from normality is highlighted. If the xvar is specifiedthen we have as many worm plot as n.iter. In this case the x-variable is cut into n.iterintervals with an equal number observations and detrended normal QQ (i.e. worm) plots for eachinterval are plotted. This is a way of highlighting failures of the model within different ranges of theexplanatory variable. The fitted coefficients from fitting cubic polynomials to the residuals (withineach x-variable interval) can be obtain by e.g. coeffs<-wp(model1,xvar=x,n.iner=9).van Buuren et al. (2001) used these residuals to identify regions (intervals) of the explanatoryvariable within which the model does not fit adequately the data (called "model violation")
Value
For multiple plots the xvar intervals and the coefficients of the fitted cubic polynomials to theresiduals (within each xvar interval) are returned.
Note
Author(s)
Mikis Stasinopoulos and Bob Rigby
References
Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale andshape,(with discussion), Appl. Statist., 54, part 3, 1-38.
Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use theGAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (seealso http://www.gamlss.com/).
van Buuren and Fredriks M. (2001) Worm plot: simple diagnostic device for modelling growthreference curves. Statistics in Medicine, 20, 1259–1277
See Also
gamlss, plot.gamlss
160 wp
Examples
data(abdom)a<-gamlss(y~cs(x,df=3),sigma.fo=~cs(x,1),family=LO,data=abdom)wp(a)coeff1<-wp(a,abdom$x)coeff1rm(a,a1)
Index
∗Topic datasetsabdom, 66aep, 68aids, 69db, 70fabric, 87hodges, 115Mums, 32rent, 143usair, 155
∗Topic distributionBB, 1BCCG, 4BCPE, 6BCT, 9BE, 11BEINF, 13BI, 15GA, 17GU, 18IG, 21JSU, 23JSUo, 25LNO, 27LO, 30NBI, 33NBII, 35NET, 36NO, 38NO.var, 40PE, 41PIG, 43PO, 45RG, 48SEP, 50SI, 52TF, 54WEI, 58WEI2, 60
ZAIG, 61ZIP, 64
∗Topic packagegamlss-package, 105
∗Topic regressionadditive.fit, 67BB, 1BCCG, 4BCPE, 6BCT, 9BE, 11BEINF, 13bfp, 71BI, 15centiles, 73centiles.com, 75centiles.pred, 77centiles.split, 79checklink, 81coef.gamlss, 82cs, 83deviance.gamlss, 85find.hyper, 88fitted.gamlss, 90fitted.plot, 91formula.gamlss, 92GA, 17gamlss, 93gamlss.control, 97gamlss.cs, 99gamlss.family, 100gamlss.fp, 103gamlss.lo, 104gamlss.ps, 106gamlss.ra, 108gamlss.random, 109gamlss.rc, 110gamlss.scope, 111glim.control, 112
161
162 INDEX
GU, 18histDist, 113IC, 20IG, 21JSU, 23JSUo, 25LNO, 27LO, 30lo, 116lpred, 118make.link.gamlss, 120model.frame.gamlss, 122NBI, 33NBII, 35NET, 36NO, 38NO.var, 40par.plot, 124pdf.plot, 125PE, 41PIG, 43plot.gamlss, 127PO, 45polyS, 129predict.gamlss, 130print.gamlss, 132prof.dev, 133prof.term, 134ps, 136Q.stats, 47ra, 138random, 139rc, 141refit, 142residuals.gamlss, 144RG, 48rqres.plot, 146SEP, 50SI, 52stepGAIC, 147summary.gamlss, 150term.plot, 152TF, 54update.gamlss, 154VGD, 56WEI, 58WEI2, 60wp, 156
ZAIG, 61ZIP, 64
abdom, 66additive.fit, 67, 71, 83, 136aep, 68AIC.gamlss (IC), 20aids, 69as.family (gamlss.family), 100as.gamlss.family (gamlss.family),
100
BB, 1, 101, 102BCCG, 4, 28, 29, 101, 102BCCGuntr (BCCG), 4BCPE, 6, 38, 101, 102BCPEuntr (BCPE), 6BCT, 8, 9, 25, 27, 52, 101, 102BCTuntr (BCT), 9BE, 11, 14, 101, 102BEINF, 12, 13, 101, 102bfp, 71BI, 15, 101, 102
centiles, 73, 76, 78–80, 92centiles.com, 75, 75, 80centiles.pred, 77centiles.split, 48, 75, 76, 78, 79, 92checkBCPE (BCPE), 6checklink, 81coef.gamlss, 82, 86, 91, 145, 154cs, 83, 99, 100, 118, 137
db, 70dBB (BB), 1dBCCG (BCCG), 4dBCPE (BCPE), 6dBCT (BCT), 9dBE (BE), 11dBEINF (BEINF), 13dBI (BI), 15deviance.gamlss, 57, 83, 85, 91, 93, 132,
145, 151, 154dGA (GA), 17dGU (GU), 18dIG (IG), 21dJSU (JSU), 23dJSUo (JSUo), 25dLNO (LNO), 27
INDEX 163
dLO (LO), 30dLOGNO (LNO), 27dNBI (NBI), 33dNBII (NBII), 35dNET (NET), 36dNO (NO), 38dNO.var (NO.var), 40dPE (PE), 41dPIG (PIG), 43dPO (PO), 45dRG (RG), 48dSEP (SEP), 50dSI (SI), 52dTF (TF), 54dWEI (WEI), 58dWEI2 (WEI2), 60dZAIG (ZAIG), 61dZIP (ZIP), 64
extractAIC.gamlss (IC), 20
fabric, 87find.hyper, 88, 97, 138fitted.gamlss, 83, 86, 90, 91, 93, 132,
145, 151, 154fitted.plot, 91formula.gamlss, 91, 92, 145, 154fp, 104fp (bfp), 71fv (fitted.gamlss), 90
GA, 17, 101, 102GAIC (IC), 20gamlss, 3, 6, 8, 10, 12, 14, 16, 18, 20, 21, 23,
25, 27, 29, 31, 34, 36, 38, 39, 41, 43,45, 46, 48, 50, 52, 54, 56, 57, 59, 61,63, 65, 68, 73, 75, 76, 78, 80, 82, 83,85, 89, 92, 93, 93, 99, 100, 102, 104,105, 107, 109–111, 113, 114, 121,123, 125, 127–129, 132, 134, 136,137, 139, 140, 142, 143, 146, 147,151, 157
gamlss-package, 105gamlss.control, 95, 97gamlss.cs, 83, 85, 99, 136gamlss.family, 3, 6, 8, 10, 12, 14, 16, 18,
20, 23, 25, 27–29, 31, 34, 36, 38, 39,41, 43, 45, 46, 50, 52, 54, 56, 57, 59,
61, 63, 65, 73, 82, 86, 94, 95, 97,100, 106, 114, 121
gamlss.fp, 71, 103gamlss.lo, 104, 129gamlss.ps, 106, 137gamlss.ra, 108gamlss.random, 109, 140gamlss.rc, 110gamlss.scope, 111, 149gamlssNews (gamlss), 93glim.control, 95, 112GU, 18, 101, 102
histDist, 113hodges, 115hodges1 (hodges), 115
IC, 20IG, 21, 63, 101, 102is.gamlss (gamlss), 93
JSU, 23, 25, 27, 52, 101, 102JSUo, 25
LNO, 27, 101, 102LO, 30, 101, 102lo, 85, 105, 116LOGNO, 101LOGNO (LNO), 27lp, 131lp (lpred), 118lpred, 118, 131
make.link.gamlss, 120meanBEINF (BEINF), 13meanZAIG (ZAIG), 61model.frame.gamlss, 122model.matrix.gamlss
(model.frame.gamlss), 122Mums, 32
NBI, 33, 45, 54, 101, 102NBII, 34, 35, 36, 45, 54, 101, 102NET, 36, 101NO, 38, 101, 102NO.var, 39, 40
optim, 89
par.plot, 124
164 INDEX
pBB (BB), 1pBCCG (BCCG), 4pBCPE (BCPE), 6pBCT (BCT), 9pBE (BE), 11pBEINF (BEINF), 13pBI (BI), 15pdf.plot, 97, 125PE, 41, 101, 102pGA (GA), 17pGU (GU), 18PIG, 34, 36, 43, 54, 101, 102pIG (IG), 21pJSU (JSU), 23pJSUo (JSUo), 25pLNO (LNO), 27pLO (LO), 30pLOGNO (LNO), 27plot.gamlss, 89, 91, 127, 145, 147, 154,
157plotBEINF (BEINF), 13plotZAIG (ZAIG), 61pNBI (NBI), 33pNBII (NBII), 35pNET (NET), 36pNO (NO), 38pNO.var (NO.var), 40PO, 45, 65, 101, 102poly.matrix (polyS), 129polyS, 129pp (bfp), 71pPE (PE), 41pPIG (PIG), 43pPO (PO), 45predict.gamlss, 119, 130pRG (RG), 48print.gamlss, 91, 132, 145, 154print.gamlss.family
(gamlss.family), 100prof.dev, 133, 136prof.term, 134, 134ps, 107, 136pSEP (SEP), 50pSI (SI), 52pTF (TF), 54pWEI (WEI), 58pWEI2 (WEI2), 60pZAIG (ZAIG), 61
pZIP (ZIP), 64
Q.stats, 47qBB (BB), 1qBCCG (BCCG), 4qBCPE (BCPE), 6qBCT (BCT), 9qBE (BE), 11qBEINF (BEINF), 13qBI (BI), 15qGA (GA), 17qGU (GU), 18qIG (IG), 21qJSU (JSU), 23qJSUo (JSUo), 25qLNO (LNO), 27qLO (LO), 30qLOGNO (LNO), 27qNBI (NBI), 33qNBII (NBII), 35qNO (NO), 38qNO.var (NO.var), 40qPE (PE), 41qPIG (PIG), 43qPO (PO), 45qRG (RG), 48qSEP (SEP), 50qSI (SI), 52qTF (TF), 54qWEI (WEI), 58qWEI2 (WEI2), 60qZAIG (ZAIG), 61qZIP (ZIP), 64
ra, 109, 110, 138, 142random, 109, 110, 118, 138, 139, 139, 142rBB (BB), 1rBCCG (BCCG), 4rBCPE (BCPE), 6rBCT (BCT), 9rBE (BE), 11rBEINF (BEINF), 13rBI (BI), 15rc, 111, 141refit, 98, 142rent, 143residuals.gamlss, 91, 144, 145, 154RG, 48, 101, 102rGA (GA), 17
INDEX 165
rGU (GU), 18rIG (IG), 21rJSU (JSU), 23rJSUo (JSUo), 25rLNO (LNO), 27rLO (LO), 30rLOGNO (LNO), 27rNBI (NBI), 33rNBII (NBII), 35rNO (NO), 38rNO.var (NO.var), 40rPE (PE), 41rPIG (PIG), 43rPO (PO), 45rqres.plot, 145, 146rRG (RG), 48rSEP (SEP), 50rSI (SI), 52rTF (TF), 54rWEI (WEI), 58rWEI2 (WEI2), 60rZAIG (ZAIG), 61rZIP (ZIP), 64
SEP, 50show.link (make.link.gamlss), 120SI, 34, 36, 45, 52, 101stepGAIC, 112, 147summary.gamlss, 91, 145, 150, 154
term.plot, 152termplot, 153terms.gamlss
(model.frame.gamlss), 122TF, 54, 101, 102
update, 142update.gamlss, 91, 143, 145, 154usair, 155
vc (cs), 83VGD, 56
WEI, 58, 61, 101, 102WEI2, 59, 60, 101, 102wp, 48, 156
ZAIG, 61, 102ZIP, 64, 101, 102