Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: gam
See also: gintest intest intestpl gamfit gamopt gamout

Quantlet: gintestpl
Description: gintestpl fits an additive generalized partially linear model E[y|x,t] = G(x*b + m(t)). This quantlet offers a convenient interface for GPLM estimation. A preparation of data is performed (inclusive sorting).

Link:
Usage: {m,b,bv,const} = gintestpl(code,x,t,y,h,g{,opt})
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary PLM), see tutorial.
x n x d matrix, the discrete predictor variables.
t n x p matrix, the continuous predictor variables.
y n x 1 vector, the response variables.
h p x 1 vector or scalar, chosen bandwidth for the directions of interest.
g p x 1 vector or scalar, chosen bandwidth for the directions not of interest.
opt optional, a list with optional input. The quantlet "gamopt" can be used to set up this parameter. The order of the list elements is not important.
opt.tg ng x 1 vector, a grid for continuous part. If tg is given, the nonparametric function will also be computed on this grid.
opt.wx scalar or n x 1 vector, prior weights. For binomial models usually the binomial index vector. If not given, set to 1.
opt.b0 d x 1 vector, the initial coefficients. If not given, all coefficients are set to GLM pre-estimation.
opt.wt n x 1 vector, weights for t (trimming factors). If not given, all set to 1.
opt.shf integer, (show-how-far) if exists and =1, an output is produced which indicates how the iteration is going on (additive function / point of estimation / number of iteration).
opt.nosort integer, if exists and =1, the continuous variables t and the grid tg are assumed to be sorted by the 1st column. Sorting is required by the algorithm, hence you should switch if off only when the data are already sorted.
opt.miter integer, maximal number of iterations. The default is 10.
opt.cnv integer, convergence criterion. The default is 0.0001.
opt.fscor integer, if exists and =1, a Fisher scoring is performed (instead of the default Newton-Raphson procedure). This parameter is ignored for canonical links.
opt.wtc n x 1 vector, weights for convergence criterion, w.r.t. m(t) only. If not given, opt.wt is used.
opt.off scalar or n x 1 vector, offset. Can be used for constrained estimation. If not given, set to 0.
opt.pow scalar, power for power link. If not given, set to 0.
opt.nbk scalar, extra parameter k for negative binomial distribution. If not given, set to 1 (geometric distribution).
Output:
m n x 1 vector, estimated nonparametric part
b d x 1 vector, estimated coefficients
bv d x d matrix, estimated covariance matrix for coeff.
const ng x 1 vector, estimated nonparametric part on grid

Example:
library("gam")
randomize(1235)
n     = 100
p     = 2
d     = 2
b     = 1|2
t     = uniform(n,p)*2-1
x     = 2.*uniform(n,d)-1
g1    = 2*t[,1]
g2    = t[,2]^2
g2    = g2 - mean(g2)
m     = g1 + g2
y     = cdfn(m+x*b) .> uniform(n)    ; probit model
h     = #(1.7, 1.5)
g     = #(1.7, 1.5)
tg    = grid(-0.8,0.1,18)
opt   = gamopt("tg",tg~tg)
opt   = gamopt("shf",1,opt)
code  = "bipro"
{m,b,bv,c} = gintestpl(code,x,t,y,h,g,opt)
gamout(t,y,m,b,c,gamopt("pl",1,"x",x,"bv",bv,opt))

Result:
A generalized partially linear logit fit for E[y|x,t] is
computed. sf.b contains the coefficients for the linear
part. sf.m contains the estimated nonparametric part
evaluated at observations t. The example gives the
true b together with the GPLM estimate sf.b. Also, the
estimated function sf.m is displayed together with the
true fit m. The procedure has been introduced in
   Haerdle, Huet, Mammen and Sperlich (1997)



Author: S. Sperlich, W. Stockmeyer, W. Haerdle, 20001115 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006