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: gplm
See also: sker dlcall gplmopt gplminit gplmest gplmstat

Quantlet: gplmcore
Description: gplmcore fits a generalized partially linear model E(y|x,t) = G(x*b + m(t)). This is the core routine for GPLM estimation. It assumes that all input variables are given in the right manner. No preparation of data is performed. A more convenient way to estimate a GPLM is to call the function gplmest.

Reference(s):

Link:
Usage: {b,bv,df,m,mg,it} = gplmcore(code,x,t,y,h,wx,wt,wc,b0,m0,ctrl{,upb{,tg,m0g}})
Input:
code text string, the short code for the model (e.g. "bilo" for logit or "noid" for ordinary PLM).
x n x p matrix, the discrete predictor variables.
t n x q matrix, the continuous predictor variables. Needs to be SORTED by the first column.
y n x d vector, the response variables.
h q x 1 vector, the bandwith.
wx n x 1 vector or scalar, prior weights, e.g. the binomial index vector.
wt n x 1 vector or scalar, weights for t (trimming factors). Is ignored, when scalar.
wc n x 1 vector or scalar, weights for convergence criterion, w.r.t. m(t) only. Is ignored, when scalar.
b0 p x 1 vector, the initial coefficients.
m0 n x 1 vector or scalar, the initial values for the nonparametric part. Is ignored and can be set to scalar direct update for nonparametric function is possible (code="noid").
off n x 1 vector or scalar, offset. Is ignored when 0.
ctrl 7 x 1 vector or scalar, contains control parameters shf (default=0), miter (default=10), cnv (default=0.0001), fscor (default=0), pow (default=0, power for power link), nbk (default=1, parameter for negative binomial), meth (default=0, parameter for backfitting/profile). Alternatively, one can give here shf only. Set to 0 to use the defaults. The parameters correspond to the optional parameters which can be given in gplminit. They are all ignored when not applicable.
upb optional, scalar, 0 or 1 (default). If set to 0, the parameter b is not updated in the iteration.
tg optional, ng x 1 vector, a grid for continuous part. Needs to be SORTED by the first column. Is ignored, if set to NaN.
m0g optional, ng x 1 vector or scalar, the initial values for the nonparametric part on the grid. Needs to be given if direct update for nonparametric function is not possible. Is ignored otherwise. Is ignored, if tg set to NaN.
Output:
b p x 1 vector, estimated coefficients
bv p x p matrix, estimated covariance matrix for coeff.
m n x 1 vector, estimated nonparametric part.
df scalar, approximated degrees of freedom.
mg ng x 1 vector, estimated nonparametric part on grid. Only available if tg was given.
it integer, number of iterations needed.
ret scalar, return code: 0 o.k., 1 maximal number of iterations reached (if applicable), -1 missing values have been encountered.

Example:
library("gplm")
;==========================
;  simulate data
;==========================
n=100
b=1|2
p=rows(b)
x=2.*uniform(n,p)-1
t=sort(2.*uniform(n)-1,1)
m=cos(pi.*t)
y=( 1./(1+exp(-x*b-m)).>uniform(n) )
;==========================
;  semiparametric fit
;==========================
h  = 0.6
b0 = 0|0
mu0=(y+0.5)/2
m0 = log(mu0/(1-mu0))
sf = gplmcore("bilo",x,t,y,h,1,1,1,b0,m0,0,1)
b~sf.b
;==========================
;  plot
;==========================
library("plot")
true=setmask(sort(t~m),"line","thin")
estm=setmask(sort(t~sf.m),"line","blue")
plot(true,estm)

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.



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006