sgplm1 {KernGPLM}R Documentation

Generalized partial linear model

Description

Fits a generalized partial linear model (based on smoothing spline) using the (generalized) Speckman estimator or backfitting (in the generalized case combined with local scoring) for two additive component functions. In contrast to kgplm, this function can be used only for a 1-dimensional nonparametric function. (Note that as for kgplm currently only the PLM as well as partial linear Logit and Probit models are implemented.)

Usage

sgplm1(x, t, y, spar, family, link,
       b.start=NULL, m.start=NULL, grid = NULL, offset = 0, 
       method = "speckman", sort = TRUE, weights = 1, weights.trim = 1, 
       weights.conv = 1, max.iter = 25, eps.conv = 1e-8,
       verbose = FALSE, ...)

Arguments

x n x p matrix, data for linear part
y n x 1 vector, responses
t n x 1 matrix, data for nonparametric part
spar scalar smoothing parameter, as in smooth.spline
family text string (currently "gaussian", "bernoulli")
link text string (currently "identity" for "gaussian", "logit" or "probit" for "bernoulli")
b.start p x 1 vector, start values for linear part
m.start n x 1 vector, start values for nonparametric part
grid m x q matrix, where to calculate the nonparametric function (default = t)
offset offset
method "speckman" or "backfit"
sort sort data (default=TRUE)
weights binomial weights
weights.trim trimming weights for fitting the linear part
weights.conv weights for convergence criterion
max.iter maximal number of iterations
eps.conv convergence criterion
verbose print additional convergence information
... further parameters to be passed to smooth.spline

Value

List with components:

b p x 1 vector, linear coefficients
b.cov p x p matrix, linear coefficients
m n x 1 vector, nonparametric function estimate
m.grid m x 1 vector, nonparametric function estimate on grid
it number of iterations
deviance deviance
df.residual approximate degrees of freedom (residuals)
aic Akaike's information criterion

Note

This function is mainly implemented for comparison. It is not really optimized for performance, however since it is spline-based, it should be sufficiently fast. Nevertheless, there might be several possibilities to improve for speed, in particular I guess that the sorting that smooth.spline performs in every iteration is slowing down the procedure quite a bit.

Author(s)

Marlene Mueller

References

Mueller, M. (2001) Estimation and testing in generalized partial linear models – A comparative study. Statistics and Computing, 11:299–309.

Hastie, T. and Tibshirani, R. (1990) Generalized Additive Models. London: Chapman and Hall.

See Also

kgplm

Examples

  ## partial linear model (PLM)
  n <- 1000; b <- c(1,-1); rho <- 0.7
  mm <- function(t){ 1.5*sin(pi*t) }
  x1 <- runif(n,min=-1,max=1); u  <- runif(n,min=-1,max=1)
  t  <- runif(n,min=-1,max=1); x2 <- round(mm(rho*t + (1-rho)*u))
  x  <- cbind(x1,x2)
  y  <- x1*b[1]+x2*b[2] + mm(t) + rnorm(n)

  ## fit partial linear model (PLM)
  k.plm <- kgplm(x,t,y,h=0.35,family="gaussian",link="identity")
  s.plm <- sgplm1(x,t,y,spar=0.5,family="gaussian",link="identity")

  o <- order(t)
  ylim <- range(c(mm(t[o]),k.plm$m,s.plm$m),na.rm=TRUE)
  plot(t[o],mm(t[o]),type="l",ylim=ylim)
  lines(t[o],k.plm$m[o], col="green")
  lines(t[o],s.plm$m[o], col="blue")
  rug(t); title("Kern PLM vs. Spline PLM")

  ## fit partial linear probit model (GPLM)
  y <- (y>0)
  k.gplm <- kgplm(x,t,y,h=0.35,family="bernoulli",link="probit")
  s.gplm <- sgplm1(x,t,y,spar=0.95,family="bernoulli",link="probit")

  o <- order(t)
  ylim <- range(c(mm(t[o]),k.gplm$m,s.gplm$m),na.rm=TRUE)
  plot(t[o],mm(t[o]),type="l",ylim=ylim)
  lines(t[o],k.gplm$m[o], col="green")
  lines(t[o],s.gplm$m[o], col="blue")
  rug(t); title("Kern GPLM vs. Spline GPLM (Probit)")

[Package KernGPLM version 0.65 Index]