On Tue, 15 Feb 2005, Brian Newquist wrote:
Is anyone familiar with the use of the step.gam function? I am trying to
find the best value for the span parameter for use in the gam function. The
S-Plus help documentation suggests that step.gam will return the best model
(in terms of AIC criteria) from among those that you have defined in the
scope argument.
Rather, it does a very simple stepwise search amongst them.
The example below illustrates what occurred when I used this function. Does
anyone know where I went wrong? Any help will be greatfully appreciated.
fit.gam <- gam( OUTVAR ~ LOGVAR + VAR1 + VAR2 + VAR3, binomial, data =
mydata)
step.gam(fit.gam, scope=list(
"LOGVAR" = ~ lo(LOGVAR, span=0.1) + lo(LOGVAR, span = 0.15) + lo(LOGVAR,
span = 0.20)))
The following message appears after running step.gam :
Problem in untangle.scope(object$terms, scope): regimen 1 does not appear in
the initial model
You have not allowed the current term, nor is this in increasing order of
complexity. Try
"LOGVAR" = ~ 1 + LOGVAR + lo(LOGVAR, span = 0.20) + lo(LOGVAR, span = 0.15)"
and move on from there. All step.gam does is move one step at a time
to the left or right in that formula: see the DETAILS section on the help
page, or section 7.3.1 of `Statistical Models in S'.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|