Currently six types of distributions are supported by the
gplm
quantlib: Binomial,
Normal (Gaussian), Poisson, Gamma (includes Exponential),
Inverse Gaussian and Negative Binomial (includes Geometric).
Table 2 summarizes the
models which are available.
The quantlet in the gplm
quantlib
which is mainly responsible for GPLM estimation is
gplmest.
|
The quantlet
gplmest
provides a convenient
way to estimate a GPLM.
The standard call is quite simple, for example
g=gplmest("bipro",x,t,y,h)
estimates a probit model (binomial with Gaussian cdf link). For
The result of the estimation is assigned to the variable g which is a list containing the following output:
Recalling our credit scoring example from Subsection 2.2, the estimation--using a logit link--would be done as follows:
t=log(t) ; logs of amount and age
trange=max(t)-min(t)
t=(t-min(t))./trange ; transformation to [0,1]
library("gplm")
h=0.4
g=gplmest("bilo",x,t,y,h)
g.b
Contents of b [1,] 0.96516 [2,] 0.74628 [3,] -0.049835
A graphical output can be created by calling
gplmout("bilo",x,t,y,h,g.b,g.bv,g.m,g.stat)
Optional parameters must be given to
gplmest
in a list
of optional parameters. A detailed description of what
is possible can be found in Section 4, which deals
with the quantlet
gplmopt. Set:
opt=gplmopt("meth",1,"shf",1)
opt=gplmopt("xvars",xvars,opt)
opt=gplmopt("tg",grid(0|0,0.05|0.05,21|21),opt)
We repeat the estimation with these settings:
g=gplmest("bilo",x,t,y,h,opt)
Since the nonparametric function
is estimated
on two-dimensional data, we can display a surface plot
using the estimated function on the grid:
library("plot")
mg=setmask(sort(tg~g.mg),"surface")
The estimated coefficients are slightly different here, since we used the profile likelihood instead of the Speckman algorithm in this case. Figure 3 shows the output window for the second estimation.
|
The following lines show how
gplmcore
could be used in
our running example. Note that all data needs to be sorted by the
first column of t.
n=rows(x)
p=cols(x)
q=cols(t)
tmp=sort(t~y~x) ; sort data by first column of t
t=tmp[,(1:q)]
y=tmp[,(q+1)]
x=tmp[,(q+2):cols(tmp)]
shf = 1 ; show iteration (1="true")
miter = 10 ; maximal number of iterations
cnv = 0.0001 ; convergence criterion
fscor = 0 ; Fisher scoring (1="true")
pow = 0 ; power for power link (if useful)
nbk = 1 ; k for neg. binomial (if useful)
meth = 0 ; algorithm ( -1 = backfitting,
; 0 = Speckman
; 1 = profile likelihood )
ctrl=shf|miter|cnv|fscor|pow|nbk|meth
wx = 1 ; prior or frequency weights
wt = 1 ; trimming weights for estimation of b
wc = 1 ; weights for the convergence criterion
off = 0 ; offset
l=glmcore("bilo",x~t~matrix(n),y,wx,off,ctrl[1:6])
b0=l.b[1:p]
m0=l.b[p+q+1]+t*l.b[(p+1):(p+q)]
h=0.4|0.4
g=gplmcore("bilo",x,t,y,h,wx,wt,wc,b0,m0,off,ctrl)
![]() |
MD*TECH Method and Data Technologies |
| http://www.mdtech.de mdtech@mdtech.de |