Library: | gam |
See also: | intestpl gintest gintestpl pcad gamfit |
Quantlet: | intest | |
Description: | estimation of the univariate additive functions in a separable additive model using Nadaraya-Watson, local linear or local quadratic estimation. |
Usage: | gest = intest(t,y,h,g,loc{,opt}) | |
Input: | ||
t | n x p matrix, the observed explanatory variable where the directions of interest must be the first p columns. | |
y | n x q matrix, the observed response variables. | |
h | p(pg) x 1 matrix or scalar, chosen bandwidth for the directions of interest. | |
g | p x 1 matrix or scalar, chosen bandwidth for the directions not of interest. | |
loc | integer, it can take values 0, 1 or 2. For loc=0 local constant (Nadaraya-Watson), for loc=1 local linear and for loc=2 local quadratic estimator will be used. | |
opt | list, composed of the following optional objects: | |
opt.tg | ng x pg vector, a grid for continuous part. If tg is given, the nonparametric function will be computed on this grid. Default = t. | |
opt.shf | integer, (show-how-far) if set to 1, an output is produced which indicates how the iteration is going on (additive function / point of estimation / number of iteration). Default = 0. | |
Output: | ||
gest | n(ng) x pp x q array, containing the marginal integration estimates of the additive components in the first p columns, the derivatives in the followings, so pp = pg*(loc+1). |
library("gam") randomize(0) 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) h = #(1.2, 1.0) g = #(1.4, 1.2) loc = 1 gest = intest(t,y,h,g,loc) gest bild = createdisplay(1,2) dat11 = t[,1]~g1 dat12 = t[,1]~gest[,1] dat21 = t[,2]~g2 dat22 = t[,2]~gest[,2] setmaskp(dat12,4,4,8) setmaskp(dat22,4,4,8) show(bild,1,1,dat11,dat12) show(bild,1,2,dat21,dat22)
The marginal integration estimates of the additive functions and its derivatives, using local polynomials, see Severance-Lossin & Sperlich (1999). Plots of the additive funtions (black circles - true function, red triangles - estimated function) are displayed.