|
library("gam") randomize(1234) t = uniform(50,2)*2-1 g1 = 2*t[,1] g2 = t[,2]^2 g2 = g2 - mean(g2) y = g1 + g2 + normal(50,1) * sqrt(0.25) gamfit(t,y)
gamfit
provides a convenient interactive tool for the estimation of
additive models.
The inputs t and y are obligatory parameters. All the other variables,
selections and options needed for the estimation will be inquired
interactively.
The Break option ends the dialogue at any level without doing any
calculations.
gamfit
starts with the model selection:
In case of a partially linear model you will be asked to quote the variable name for the linear part (named here the discrete variables). You may, alternatively, leave it out, which means to run the estimation on the linear part only and to switch back to an additive (AM) or a generalized additive model (GAM).
Most quantlets of the quantlib gam allow to use different estimation procedures: local constant, local linear or local quadratic. Hence, they are able to estimate the additive functions and its derivatives.
At least one vector of bandwidths is needed for all estimation procedures. Most of them additionally ask for a second bandwidth for the directions not of interest.
Subsequently a graphical output presents the estimation results for the nonlinear and should the occasion arise also for the linear part. If selected, descriptive statistics are shown additionally.
The following pictures were acquired using the data from
XAGgam10.xpl
.
The resulting output is made globally available as a list object gamfit. It contains:
and if given
Although
gamfit
is an interactive tool, you are free to provide
initially any additional option or parameter needed for the estimation
of your model. The bandwidths h and g, the grid or the discrete
variable x are typical examples. Look up the options corresponding to
your model in Section 7.3. Section 7.5
gives instructions on optional parameters.