VGD {gamlss}R Documentation

Validation (or test) data global deviance

Description

These function are useful for model selection. The function VGD helps to validate a GAMLSS model by randomly splitting the data into training and validation sets. It minimies the global deviance for the training data set and then uses the validation set to calculate the prediction global deviance. The function VGD1 is identical to VGD but the output is a list rather than a values as in VGD. The function VGD2 is identical to VGD1 but it takes as argument the new data, (newdata), rather than a factor which split the combined data in two as in VGD or VGD1. The function TGD takes a fitted gamlss object and produce the test global deviance for the new data. The resulting prediction errors can be used for selecting the distribution of the model, the terms in the model or degrees of freedom for smoothing terms.

Usage

VGD(formula = NULL, sigma.formula = ~1, nu.formula = ~1, tau.formula = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), rand = NULL, ...)
VGD1(formula = NULL, sigma.formula = ~1, nu.formula = ~1, tau.formula = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), rand = NULL, ...)
VGD2(formula = NULL, sigma.formula = ~1, nu.formula = ~1, tau.formula = ~1, 
    data = NULL, family = NO, 
    control = gamlss.control(trace = FALSE), 
    newdata = NULL, ...)
TGD(object, newdata = NULL, ...)

Arguments

object

a gamlss object

formula

a gamlss formula for mu (including the response on the left)

sigma.formula

a formula for sigma

nu.formula

a formula for nu

tau.formula

a formula for tau

data

the data set used for the fitting

newdata

the data set to be used for validation ot test

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 training 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 the length of the data

...

for extra arguments to be passed in the gamlss fit

Value

The function VGD returns a validated global deviance, that is, the global deviance evaluated at the validation data. The functions VGD1, VGD2 and TGD are returning a list with component oldGD, newGD, oldPE, newPE. oldGD is the deviance of the training data, newGD is the deviance for the validation or (test) data. oldPE is the mean prediction error for the old data (oldGD divided by the number of observations in the training data). newPEis the mean prediction error for the new data, (newGD divided by the number of observations in the validation (or test) data).

Author(s)

Mikis Stasinopoulos d.stasinopoulos@londonmet.ac.uk and Bob Rigby r.rigby@londonmet.ac.uk

References

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(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 the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, http://www.jstatsoft.org/v23/i07.

See Also

gamlss.family, gamlss, deviance.gamlss

Examples

data(abdom)
# generate the random split of the data
rand <- sample(2, 610, replace=TRUE, prob=c(0.6,0.4))
# the proportions in the sample
table(rand)/610
# VGD needs a factor
VGD(y~pb(x,df=2),sigma.formula=~pb(x,df=1), data=abdom, family=LO, rand=rand)
# VGD1 needs a factor and has different output
VGD1(y~pb(x,df=2),sigma.formula=~pb(x,df=1), data=abdom, family=LO, rand=rand)
# using VGD2 needs two different sets of data 
VGD2(y~pb(x,df=2),sigma.formula=~pb(x,df=1), data=abdom[rand==1,], family=LO,
      newdata=abdom[rand==2,] )
#fit in the old data
olddata<-abdom[rand==1,]
m1<-gamlss(y~pb(x,df=2),sigma.formula=~pb(x,df=1), data=olddata, family=LO)
# get the global deviance in the new data
newdata<-abdom[rand==2,] 
TGD(m1, newdata=newdata)

[Package gamlss version 4.3-0 Index]