| VGD {gamlss} | R Documentation |
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.
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, ...)
object |
a gamlss object |
formula |
a gamlss formula for |
sigma.formula |
a formula for |
nu.formula |
a formula for |
tau.formula |
a formula for |
data |
the data set used for the fitting |
newdata |
the data set to be used for validation ot test |
family |
a |
control |
|
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
|
... |
for extra arguments to be passed in the |
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).
Mikis Stasinopoulos d.stasinopoulos@londonmet.ac.uk and Bob Rigby r.rigby@londonmet.ac.uk
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.
gamlss.family, gamlss, deviance.gamlss
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)