Library: | gam |
See also: | intestpl gintest gintestpl pcad gamfit |
Quantlet: | intest2d | |
Description: | estimation of a bivariate joint influence function and its derivatives in a model with possible interaction. When loc.lin.smoother is chosen you get the function estimate and the first derivatives in the first and second direction, when loc.quadr.smoother is chosen you get the function and the mixed derivative estimate. |
Usage: | gest = intest2d(t,y,h,g,loc{,opt}) | |
Input: | ||
t | n x p matrix of observed explanatory variables where the directions of interest have to be written in the first and second column | |
y | n x q matrix, of the observed response variables | |
h | 2 x 1 or 1 x 1 matrix containing the chosen bandwidths for the directions of interest | |
g | p x 1 or 1 x 1 matrix of chosen bandwidths for the directions not of interest | |
loc | dummy, for loc=0 the local constant (Nad. Wats.) will be used, for loc=1 the local linear estimator will be taken, for loc=2 the local quadratic estimator will be applied | |
opt.tg | (optional), ng x 2 vector, a grid for the direction of interest. If tg is given, the nonparametric function will be computed on this grid. | |
opt.shf | (optional) integer, (show-how-far) if exists and equals 1, an output is produced which indicates how the iteration is going on (additive function / point of estimation / number of iteration). | |
Output: | ||
gest | n(ng) x pp x q matrix containing the marginal integration estimates |
library("gam") randomize(12345) t = grid(#(-0.9,-0.9),#(0.2,0.2),#(10,10)) n = rows(t) t = t~(uniform(n)*2-1) g3 = sin(2*t[,3]) g12 = t[,1].*t[,2]^2 y = g3 + g12 + normal(n)*sqrt(0.5) h = #(1.0, 1.0) g = #(1.1, 1.1, 1.2) loc = 1 gest = intest2d(t,y,h,g,loc) library("graphic") pic = createdisplay(1,2) dat11 = grsurface(t[,1:2]~g12) dat12 = grsurface(t[,1:2]~gest[,1]) gc = grcube( dat11|dat12 ) show(pic,1,1,dat11,gc.box,gc.x,gc.y,gc.z,gc.c) show(pic,1,2,dat12,gc.box,gc.x,gc.y,gc.z,gc.c) setgopt(pic, 1, 1,"title", "Original function") setgopt(pic, 1, 2,"title", "Estimated function")
the marginal integration estimates of the joint influences using local polynomials is shown.