The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The...

53
The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing Splines Author Chong Gu <[email protected]> Maintainer Chong Gu <[email protected]> Description A comprehensive package for structural multivariate function estimation using smoothing splines. License GPL R topics documented: LakeAcidity ......................................... 2 aids ............................................. 3 bacteriuria .......................................... 4 buffalo ............................................ 4 cdssden ........................................... 5 drkpk ............................................ 6 dssden ............................................ 7 family ............................................ 8 fitted.ssanova ........................................ 10 gastric ............................................ 10 gauss.quad .......................................... 11 gssanova ........................................... 11 gssanova0 .......................................... 14 hzdrate.sshzd ........................................ 17 mkfun.poly ......................................... 18 mkfun.tp ........................................... 19 mkran ............................................ 20 mkrk.nominal ........................................ 22 mkterm ........................................... 23 nlm0 ............................................. 25 1

Transcript of The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The...

Page 1: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

The gss PackageAugust 9, 2007

Version 1.0-0

Depends R (>= 1.7.0)

Title General Smoothing Splines

Author Chong Gu <[email protected]>

Maintainer Chong Gu <[email protected]>

Description A comprehensive package for structural multivariate function estimation using smoothingsplines.

License GPL

R topics documented:LakeAcidity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2aids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3bacteriuria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4buffalo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4cdssden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5drkpk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6dssden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7family . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8fitted.ssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10gastric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10gauss.quad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11gssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11gssanova0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14hzdrate.sshzd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17mkfun.poly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18mkfun.tp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19mkran . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20mkrk.nominal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22mkterm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23nlm0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

1

Page 2: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

2 LakeAcidity

nox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26ozone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26predict.ssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28print . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31rkpk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32rkpk0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33smolyak . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34ssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35ssanova0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37ssden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40sshzd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42stan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45summary.gssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45summary.gssanova0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47summary.ssanova . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48wesdr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Index 51

LakeAcidity Water Acidity in Lakes

Description

Data extracted from the Eastern Lake Survey of 1984 conducted by the United States EnvironmentalProtection Agency, concerning 112 lakes in the Blue Ridge.

Usage

data(LakeAcidity)

Format

A list containing 112 observations on the following variables.

ph Surface ph.cal Calcium concentration.lat Latitude.lon Longitude.geog Geographic location, derived from lat and lon

Details

geog was generated from lat and lon using the code given in the Example section.

Page 3: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

aids 3

Source

Douglas, A. and Delampady, M. (1990), Eastern Lake Survey – Phase I: Documentation for theData Base and the Derived Data sets. Tech Report 160 (SIMS), Dept. Statistics, University ofBritish Columbia.

References

Gu, C. and Wahba, G. (1993), Semiparametric analysis of variance with tensor product thin platesplines. Journal of the Royal Statistical Society Ser. B, 55, 353–368.

Examples

## Converting latitude and longitude to x-y coordinates## Not run:convert <- function(lat, lon) {

lat <- lat/180*pilon <- lon/180*pim.lat <- (max(lat)+min(lat))/2m.lon <- (max(lon)+min(lon))/2x <- cos(m.lat)*sin(m.lon-lon)y <- sin(lat-m.lat)cbind(x,y)

}data(LakeAcidity)convert(LakeAcidity$lat,LakeAcidity$lon)## Clean uprm(LakeAcidity,convert)## End(Not run)

aids AIDS Incubation

Description

A data set collected by Centers for Disease Control and Prevention concerning AIDS patients whowere infected with the HIV virus through blood transfusion.

Usage

data(aids)

Format

A data frame containing 295 observations on the following variables.

incu Time from HIV infection to AIDS diagnosis.infe Time from HIV infection to end of data collection (July 1986).age Age at time of blood transfusion.

Page 4: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

4 buffalo

Source

Wang, M.-C. (1989), A semiparametric model for randomly truncated data. Journal of the AmericanStatistical Association, 84, 742–748.

bacteriuria Treatment of Bacteriuria

Description

Bacteriuria patients were randomly assigned to two treatment groups. Weekly binary indicator ofbacteriuria was recorded for every patient over 4 to 16 weeks. A total of 72 patients were representedin the data, with 36 each in the two treatment groups.

Usage

data(bacteriuria)

Format

A data frame containing 820 observations on the following variables.

id Identification of patients, a factor.trt Treatments 1 or 2, a factor.time Weeks after randomization.infect Binary indicator of bacteriuria (bacteria in urine).

Source

Joe, H. (1997), Multivariate Models and Dependence Concepts. London: Chapman and Hall.

References

Gu, C. and Ma, P. (2005), Generalized nonparametric mixed-effect models: computation andsmoothing parameter selection. Journal of Computational and Graphical Statistics, 14, 485–504.

buffalo Buffalo Annual Snowfall

Description

Annual snowfall accumulations in Buffalo, NY from 1910 to 1973.

Usage

data(buffalo)

Page 5: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

cdssden 5

Format

A vector of 64 numerical values.

Source

Scott, D. W. (1985), Average shifted histograms: Effective nonparametric density estimators inseveral dimensions. The Annals of Statistics, 13, 1024–1040.

cdssden Evaluating Conditional PDF, CDF, and Quantiles of Smoothing SplineDensity Estimates

Description

Evaluate conditional pdf, cdf, and quantiles for smoothing spline density estimates.

Usage

cdssden(object, x, cond, int=NULL)cpssden(object, q, cond, int=NULL)cqssden(object, p, cond, int=NULL)

Arguments

object Object of class "ssden".

x Data frame or vector of points on which conditional density is to be evaluated.

cond One row data frame of conditioning variables.

int Normalizing constant.

q Vector of points on which conditional cdf is to be evaluated.

p Vector of probabilities for which conditional quantiles are to be calculated.

Details

The argument x in cdssden is of the same form as the argument newdata in predict.lm, butcan take a vector for 1-D conditional densities.

cpssden and cqssden naturally only work for 1-D conditional densities of a numerical variable.

Value

cdssden returns a list object with the following components.

pdf Vector of conditional pdf.

int Normalizing constant.

cpssden and cpssden return a vector of conditional cdf or quantiles.

Page 6: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

6 drkpk

Note

If variables other than factors or numerical vectors are involved in x, the normalizing constant cannot be computed.

cpssden and cqssden can be very slow.

See Also

Fitting function ssden and dssden.

drkpk Numerical Engine for ssden and sshzd

Description

Perform numerical calculations for the ssden and sshzd suites.

Usage

sspdsty(s, r, q, cnt, qd.s, qd.r, qd.wt, prec, maxiter, alpha)mspdsty(s, r, q, cnt, qd.s, qd.r, qd.wt, prec, maxiter, alpha)

msphzd(s, r, q, Nobs, cnt, qd.s, qd.r, qd.wt, prec, maxiter, alpha)

Arguments

s Unpenalized terms evaluated at data points.

r Basis of penalized terms evaluated at data points.

q Penalty matrix.

Nobs Total number of lifetime observations.

cnt Bin-counts for histogram data.

qd.s Unpenalized terms evaluated at quadrature nodes.

qd.r Basis of penalized terms evaluated at quadrature nodes.

qd.wt Quadrature weights.

prec Precision requirement for internal iterations.

maxiter Maximum number of iterations allowed for internal iterations.

alpha Parameter defining cross-validation score for smoothing parameter selection.

Details

sspdsty is used by ssden to compute cross-validated density estimate with a single smoothingparameter. mspdsty is used by ssden to compute cross-validated density estimate with multiplesmoothing parameters.

msphzd is used by sshzd to compute cross-validated hazard estimate with single or multiplesmoothing parameters.

Page 7: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

dssden 7

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Gu, C. and Wang, J. (2003), Penalized likelihood density estimation: Direct cross-validation andscalable approximation. Statistica Sinica, 13, 811–826.

dssden Evaluating PDF, CDF, and Quantiles of Smoothing Spline Density Es-timates

Description

Evaluate pdf, cdf, and quantiles for smoothing spline density estimates.

Usage

dssden(object, x)pssden(object, q)qssden(object, p)

Arguments

object Object of class "ssden".

x Data frame or vector of points on which density is to be evaluated.

q Vector of points on which cdf is to be evaluated.

p Vector of probabilities for which quantiles are to be calculated.

Details

The argument x in dssden is of the same form as the argument newdata in predict.lm, butcan take a vector for 1-D densities.

pssden and qssden naturally only work for 1-D densities.

Value

A vector of pdf, cdf, or quantiles.

See Also

Fitting function ssden and cdssden.

Page 8: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

8 family

family Utility Functions for Error Families

Description

Utility functions for fitting Smoothing Spline ANOVA models with non-Gaussian responses.

Usage

mkdata.binomial(y, eta, wt, offset)dev.resid.binomial(y, eta, wt)dev.null.binomial(y, wt, offset)cv.binomial(y, eta, wt, hat, alpha)y0.binomial(y, eta0, wt)proj0.binomial(y0, eta, offset)kl.binomial(eta0, eta1, wt)cfit.binomial(y, wt, offset)

mkdata.poisson(y, eta, wt, offset)dev.resid.poisson(y, eta, wt)dev.null.poisson(y, wt, offset)cv.poisson(y, eta, wt, hat, alpha, sr, q)y0.poisson(eta0)proj0.poisson(y0, eta, wt, offset)kl.poisson(eta0, eta1, wt)cfit.poisson(y, wt, offset)

mkdata.Gamma(y, eta, wt, offset)dev.resid.Gamma(y, eta, wt)dev.null.Gamma(y, wt, offset)cv.Gamma(y, eta, wt, hat, rss, alpha)y0.Gamma(eta0)proj0.Gamma(y0, eta, wt, offset)kl.Gamma(eta0, eta1, wt)cfit.Gamma(y, wt, offset)

mkdata.inverse.gaussian(y, eta, wt, offset)dev.resid.inverse.gaussian(y, eta, wt)dev.null.inverse.gaussian(y, wt, offset)

mkdata.nbinomial(y, eta, wt, offset, nu)dev.resid.nbinomial(y, eta, wt)dev.null.nbinomial(y, wt, offset)cv.nbinomial(y, eta, wt, hat, alpha)y0.nbinomial(y,eta0,nu)proj0.nbinomial(y0, eta, wt, offset)kl.nbinomial(eta0, eta1, wt, nu)

Page 9: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

family 9

cfit.nbinomial(y, wt, offset, nu)

mkdata.weibull(y, eta, wt, offset, nu)dev.resid.weibull(y, eta, wt, nu)dev.null.weibull(y, wt, offset, nu)cv.weibull(y, eta, wt, hat, nu, alpha)y0.weibull(y, eta0, nu)proj0.weibull(y0, eta, wt, offset, nu)kl.weibull(eta0, eta1, wt, nu, int)cfit.weibull(y, wt, offset, nu)

mkdata.lognorm(y, eta, wt, offset, nu)dev.resid.lognorm(y, eta, wt, nu)dev0.resid.lognorm(y, eta, wt, nu)dev.null.lognorm(y, wt, offset, nu)cv.lognorm(y, eta, wt, hat, nu, alpha)y0.lognorm(y, eta0, nu)proj0.lognorm(y0, eta, wt, offset, nu)kl.lognorm(eta0, eta1, wt, nu, y0)cfit.lognorm(y, wt, offset, nu)

mkdata.loglogis(y, eta, wt, offset, nu)dev.resid.loglogis(y, eta, wt, nu)dev0.resid.loglogis(y, eta, wt, nu)dev.null.loglogis(y, wt, offset, nu)cv.loglogis(y, eta, wt, hat, nu, alpha)y0.loglogis(y, eta0, nu)proj0.loglogis(y0, eta, wt, offset, nu)kl.loglogis(eta0, eta1, wt, nu, y0)cfit.loglogis(y, wt, offset, nu)

Arguments

y Model response.

eta Fitted values on link scale.

wt Model weights.

offset Model offset.

nu Size for nbinomial. Inverse scale for log life time.

Note

gssanova0 uses mkdata.x, dev.resid.x, and dev.null.x. gssanova uses the aboveplus dev0.resid.x and cv.x.

y0.x, proj0.x, kl.x, and cfit.x are used by project.gssanova.

Page 10: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

10 gastric

fitted.ssanova Fitted Values and Residuals from Smoothing Spline ANOVA Fits

Description

Methods for extracting fitted values and residuals from smoothing spline ANOVA fits.

Usage

fitted.ssanova(object, ...)residuals.ssanova(object, ...)

fitted.gssanova(object, ...)residuals.gssanova(object, type="working", ...)

Arguments

object Object of class "ssanova" or "gssanova".

type Type of residuals desired, with two alternatives "working" (default) or "deviance".

... Ignored.

Details

The fitted values for "gssanova" objects are on the link scale, so are the "working" residuals.

gastric Gastric Cancer Data

Description

Survival of gastric cancer patients under chemotherapy and chemotherapy-radiotherapy combina-tion.

Usage

data(gastric)

Format

A data frame containing 90 observations on the following variables.

futime Follow-up time, in days.status Censoring status.trt Factor indicating the treatments: 1 – chemothrapy, 2 – combination.

Page 11: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

gauss.quad 11

Source

Moreau, T., O’Quigley, J., and Mesbah, M. (1985), A global goodness-of-fit statistic for the propor-tional hazards model. Applied Statistics, 34, 212-218.

gauss.quad Generating Gauss-Legendre Quadrature

Description

Generate Gauss-Legendre quadratures using the FORTRAN routine gaussq.f found on NETLIB.

Usage

gauss.quad(size, interval)

Arguments

size Size of quadrature.

interval Interval to be covered.

Value

gauss.quad returns a list object with the following components.

pt Quadrature nodes.

wt Quadrature weights.

gssanova Fitting Smoothing Spline ANOVA Models with Non-Gaussian Re-sponses

Description

Fit smoothing spline ANOVA models in non-Gaussian regression. The symbolic model specifica-tion via formula follows the same rules as in lm and glm.

Usage

gssanova(formula, family, type=NULL, data=list(), weights, subset,offset, na.action=na.omit, partial=NULL, alpha=NULL, nu=NULL,id.basis=NULL, nbasis=NULL, seed=NULL, random=NULL)

Page 12: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

12 gssanova

Arguments

formula Symbolic description of the model to be fit.family Description of the error distribution. Supported are exponential families "binomial",

"poisson", "Gamma", and "nbinomial". Also supported are acceleratedlife model families "weibull", "lognorm", and "loglogis".

type List specifying the type of spline for each variable. See mkterm for details.data Optional data frame containing the variables in the model.weights Optional vector of weights to be used in the fitting process.subset Optional vector specifying a subset of observations to be used in the fitting pro-

cess.offset Optional offset term with known parameter 1.na.action Function which indicates what should happen when the data contain NAs.partial Optional extra unpenalized terms in partial spline models.alpha Tuning parameter defining cross-validation; larger values yield smoother fits.

Defaults are alpha=1 for family="binomial" and alpha=1.4 other-wise.

nu Inverse scale parameter in accelerated life model families. Ignored for exponen-tial families.

id.basis Index designating selected "knots".nbasis Number of "knots" to be selected. Ignored when id.basis is supplied.seed Seed for reproducible random selection of "knots". Ignored when id.basis

is supplied.random Input for parametric random effects in nonparametric mixed-effect models. See

mkran for details.

Details

The model specification via formula is intuitive. For example, y~x1*x2 yields a model of theform

y = C + f1(x1) + f2(x2) + f12(x1, x2) + e

with the terms denoted by "1", "x1", "x2", and "x1:x2".

The model terms are sums of unpenalized and penalized terms. Attached to every penalized termthere is a smoothing parameter, and the model complexity is largely determined by the number ofsmoothing parameters.

Only one link is implemented for each family. It is the logit link for "binomial", and the loglink for "poisson", and "Gamma". For "nbinomial", the working parameter is the logit ofthe probability p; see NegBinomial. For "weibull", "lognorm", and "loglogis", it isthe location parameter for the log lifetime.

The selection of smoothing parameters is through direct cross-validation. The cross-validation scoreused for family="poisson" is taken from density estimation as in Gu and Wang (2003), andthose used for other families are derived following the lines of Gu and Xiang (2001).

A subset of the observations are selected as "knots." Unless specified via id.basis or nbasis,the number of "knots" q is determined by max(30, 10n2/9), which is appropriate for the defaultcubic splines for numerical vectors.

Page 13: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

gssanova 13

Value

gssanova returns a list object of class c("gssanova","ssanova").

The method summary.gssanova can be used to obtain summaries of the fits. The methodpredict.ssanova can be used to evaluate the fits at arbitrary points along with standard errors,on the link scale. The method project.gssanova can be used to calculate the Kullback-Leiblerprojection for model selection. The methods residuals.gssanova and fitted.gssanovaextract the respective traits from the fits.

Responses

For family="binomial", the response can be specified either as two columns of counts oras a column of sample proportions plus a column of total counts entered through the argumentweights, as in glm.

For family="nbinomial", the response may be specified as two columns with the secondbeing the known sizes, or simply as a single column with the common unknown size to be estimatedthrough the maximum likelihood.

For family="weibull", "lognorm", or "loglogis", the response consists of three columns,with the first giving the follow-up time, the second the censoring status, and the third the left-truncation time. For data with no truncation, the third column can be omitted.

Note

For simpler models and moderate sample sizes, the exact solution of gssanova0 can be faster.

The results may vary from run to run. For consistency, specify id.basis or set seed.

In gss versions earlier than 1.0, gssanova was under the name gssanova1.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. and Xiang, D. (2001), Cross validating non Gaussian data: generalized approximate crossvalidation revisited. Journal of Computational and Graphical Statistics, 10, 581–591.

Gu, C. and Wang, J. (2003), Penalized likelihood density estimation: Direct cross-validation andscalable approximation. Statistica Sinica, 13, 811–826.

Examples

## Fit a cubic smoothing spline logistic regression modeltest <- function(x)

{.3*(1e6*(x^11*(1-x)^6)+1e4*(x^3*(1-x)^10))-2}x <- (0:100)/100p <- 1-1/(1+exp(test(x)))y <- rbinom(x,3,p)logit.fit <- gssanova(cbind(y,3-y)~x,family="binomial")## The same fitlogit.fit1 <- gssanova(y/3~x,"binomial",weights=rep(3,101),

Page 14: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

14 gssanova0

id.basis=logit.fit$id.basis)## Obtain estimates and standard errors on a gridest <- predict(logit.fit,data.frame(x=x),se=TRUE)## Plot the fit and the Bayesian confidence intervalsplot(x,y/3,ylab="p")lines(x,p,col=1)lines(x,1-1/(1+exp(est$fit)),col=2)lines(x,1-1/(1+exp(est$fit+1.96*est$se)),col=3)lines(x,1-1/(1+exp(est$fit-1.96*est$se)),col=3)

## Fit a mixed-effect logistic modeldata(bacteriuria)bact.fit <- gssanova(infect~trt+time,family="binomial",data=bacteriuria,

id.basis=(1:820)[bacteriuria$id%in%c(3,38)],random=~1|id)## Predict fixed effectspredict(bact.fit,data.frame(time=2:16,trt=as.factor(rep(1,15))),se=TRUE)## Estimated random effectsbact.fit$b

## Clean up## Not run:rm(test,x,p,y,logit.fit,logit.fit1,est,bacteriuria,bact.fit)dev.off()## End(Not run)

gssanova0 Fitting Smoothing Spline ANOVA Models with Non-Gaussian Re-sponses

Description

Fit smoothing spline ANOVA models in non-Gaussian regression. The symbolic model specifica-tion via formula follows the same rules as in lm and glm.

Usage

gssanova0(formula, family, type=NULL, data=list(), weights, subset,offset, na.action=na.omit, partial=NULL, method=NULL,varht=1, nu=NULL, prec=1e-7, maxiter=30)

Arguments

formula Symbolic description of the model to be fit.

family Description of the error distribution. Supported are exponential families "binomial","poisson", "Gamma", "inverse.gaussian", and "nbinomial". Alsosupported are accelerated life model families "weibull", "lognorm", and"loglogis".

type List specifying the type of spline for each variable. See mkterm for details.

Page 15: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

gssanova0 15

data Optional data frame containing the variables in the model.

weights Optional vector of weights to be used in the fitting process.

subset Optional vector specifying a subset of observations to be used in the fitting pro-cess.

offset Optional offset term with known parameter 1.

na.action Function which indicates what should happen when the data contain NAs.

partial Optional extra unpenalized terms in partial spline models.

method Score used to drive the performance-oriented iteration. Supported are method="v"for GCV, method="m" for GML, and method="u" for Mallow’s CL.

varht Dispersion parameter needed for method="u". Ignored when method="v"or method="m" are specified.

nu Inverse scale parameter in accelerated life model families. Ignored for exponen-tial families.

prec Precision requirement for the iterations.

maxiter Maximum number of iterations allowed for performance-oriented iteration, andfor inner-loop multiple smoothing parameter selection when applicable.

Details

The model specification via formula is intuitive. For example, y~x1*x2 yields a model of theform

y = C + f1(x1) + f2(x2) + f12(x1, x2) + e

with the terms denoted by "1", "x1", "x2", and "x1:x2".

The model terms are sums of unpenalized and penalized terms. Attached to every penalized termthere is a smoothing parameter, and the model complexity is largely determined by the number ofsmoothing parameters.

Only one link is implemented for each family. It is the logit link for "binomial", andthe log link for "poisson", "Gamma", and "inverse.gaussian". For "nbinomial",the working parameter is the logit of the probability p; see NegBinomial. For "weibull","lognorm", and "loglogis", it is the location parameter for the log lifetime.

The models are fitted by penalized likelihood method through the performance-oriented iteration asdescribed in the reference; the O(n3) algorithms of RKPACK are used for numerical calculations.For family="binomial", "poisson", "nbinomial", "weibull", "lognorm", and"loglogis", the score driving the performance-oriented iteration defaults to method="u" withvarht=1. For family="Gamma" and "inverse.gaussian", the default is method="v".

Value

gssanova0 returns a list object of class c("gssanova0","ssanova0","gssanova").

The method summary.gssanova0 can be used to obtain summaries of the fits. The methodpredict.ssanova0 can be used to evaluate the fits at arbitrary points along with standard errors,on the link scale. The methods residuals.gssanova and fitted.gssanova extract therespective traits from the fits.

Page 16: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

16 gssanova0

Responses

For family="binomial", the response can be specified either as two columns of counts oras a column of sample proportions plus a column of total counts entered through the argumentweights, as in glm.

For family="nbinomial", the response may be specified as two columns with the secondbeing the known sizes, or simply as a single column with the common unknown size to be estimatedthrough the maximum likelihood.

For family="weibull", "lognorm", or "loglogis", the response consists of three columns,with the first giving the follow-up time, the second the censoring status, and the third the left-truncation time. For data with no truncation, the third column can be omitted.

Note

The direct cross-validation of gssanova can be more effective in general, and more stable forcomplex models.

For large sample sizes, the approximate solution of gssanova can be faster.

The method project is not implemented for gssanova0, nor is the mixed-effect model supportthrough mkran.

In gss versions earlier than 1.0, gssanova0 was under the name gssanova.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (1992), Cross-validating non Gaussian data. Journal of Computational and Graphical Statis-tics, 1, 169-179.

Examples

## Fit a cubic smoothing spline logistic regression modeltest <- function(x)

{.3*(1e6*(x^11*(1-x)^6)+1e4*(x^3*(1-x)^10))-2}x <- (0:100)/100p <- 1-1/(1+exp(test(x)))y <- rbinom(x,3,p)logit.fit <- gssanova0(cbind(y,3-y)~x,family="binomial")## The same fitlogit.fit1 <- gssanova0(y/3~x,"binomial",weights=rep(3,101))## Obtain estimates and standard errors on a gridest <- predict(logit.fit,data.frame(x=x),se=TRUE)## Plot the fit and the Bayesian confidence intervalsplot(x,y/3,ylab="p")lines(x,p,col=1)lines(x,1-1/(1+exp(est$fit)),col=2)lines(x,1-1/(1+exp(est$fit+1.96*est$se)),col=3)lines(x,1-1/(1+exp(est$fit-1.96*est$se)),col=3)## Clean up

Page 17: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

hzdrate.sshzd 17

## Not run:rm(test,x,p,y,logit.fit,logit.fit1,est)dev.off()## End(Not run)

hzdrate.sshzd Evaluating Smoothing Spline Hazard Estimates

Description

Evaluate smoothing spline hazard estimates by sshzd.

Usage

hzdrate.sshzd(object, x, se=FALSE)hzdcurve.sshzd(object, time, covariates=NULL, se=FALSE)survexp.sshzd(object, time, covariates=NULL, start=0)

Arguments

object Object of class "sshzd".

x Data frame or vector of points on which hazard is to be evaluated.

se Flag indicating if standard errors are required.

time Vector of time points.

covariates Vector of covariate values.

start Optional starting times of the intervals.

Value

For se=FALSE, hzdrate.sshzd returns a vector of hazard evaluations, and hzdcurve.sshzdreturns a vector or columns of hazard curve(s) evaluated on time points at the covariates val-ues. For se=TRUE, hzdrate.sshzd and hzdcurve.sshzd return a list consisting of thefollowing components.

fit Vector or columns of hazard.

se.fit Vector or columns of standard errors for log hazard.

survexp.sshzd returns a vector of expected survivals based on the cumulative hazards over(start, time), which in fact are the (conditional) survival probabilities S(time)/S(start).

Note

For left-truncated data, start must be at or after the earliest truncation point.

See Also

Fitting function sshzd.

Page 18: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

18 mkfun.poly

mkfun.poly Crafting Building Blocks for Polynomial Splines

Description

Craft numerical functions to be used by mkterm to assemble model terms.

Usage

mkrk.cubic(range)mkphi.cubic(range)mkrk.cubic.per(range)mkrk.linear(range)mkrk.linear.per(range)

Arguments

range Numerical vector whose minimum and maximum specify the range on whichthe function to be crafted is defined.

Details

mkrk.cubic, mkphi.cubic, and mkrk.linear implement the polynomial spline construc-tion in Gu (2002, Sec. 2.3.3) for m = 2, 1.

mkrk.cubic.per and mkrk.linear.per implement the periodic polynomial spline con-struction in Gu (2002, Sec. 4.2.1) for m = 2, 1.

Value

A list of two components.

fun Function definition.

env Portable local constants derived from the argument.

Note

mkrk.x create a bivariate function fun(x,y,env,outer=FALSE), where x, y are real argu-ments and local constants can be passed in through env.

mkphi.cubic creates a univariate function fun(x,nu,env).

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Page 19: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

mkfun.tp 19

See Also

mkterm, mkfun.tp, and mkrk.nominal.

mkfun.tp Crafting Building Blocks for Thin-Plate and Spherical Splines

Description

Craft numerical functions to be used by mkterm to assemble model terms.

Usage

mkrk.tp(dm, order, mesh, weight)mkphi.tp(dm, order, mesh, weight)mkrk.tp.p(dm, order)mkphi.tp.p(dm, order)

mkrk.sphere(order)

Arguments

dm Dimension of the variable d.

order Order of the differential operator m.

mesh Normalizing mesh.

weight Normalizing weights.

Details

mkrk.tp, mkphi.tp, mkrk.tp.p, and mkphi.tp.p implement the construction in Gu (2002,Sec. 4.4). Thin-plate splines are defined for 2m > d.

mkrk.tp.p generates the pseudo kernel, and mkphi.tp.p generates the (m+d−1)!/d!/(m−1)! lower order polynomials with total order less than m.

mkphi.tp generates normalized lower order polynomials orthonormal w.r.t. a norm specified bymesh and weight, and mkrk.tp conditions the pseudo kernel to generate the reproducing kernelorthogonal to the lower order polynomials w.r.t. the norm.

mkrk.sphere implements the reproducing kernel construction of Wahba (1981) for m = 2, 3, 4.

Value

A list of two components.

fun Function definition.

env Portable local constants derived from the arguments.

Page 20: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

20 mkran

Note

mkrk.tp and mkrk.sphere create a bivariate function fun(x,y,env,outer=FALSE),where x, y are real arguments and local constants can be passed in through env.

mkphi.tp creates a collection of univariate functions fun(x,nu,env), where x is the argumentand nu is the index.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Wahba, G. (1981), Spline interpolation and smoothing on the sphere. SIAM Journal on Scientificand Statistical Computing, 2, 5–16.

See Also

mkterm, mkfun.poly, and mkrk.nominal.

mkran Generating Random Effects in Mixed-Effect Models

Description

Generate entries representing random effects in mixed-effect models.

Usage

mkran(formula, data)

Arguments

formula Symbolic description of the random effects.

data Data frame containing the variables in the model.

Details

This function generates random effect terms from simple grouping variables, for use in nonparamet-ric mixed-effect models as described in Gu and Ma (2005a, b). The syntax of the formula resemblesthat of similar utilities for linear and nonlinear mixed-effect models, as described in Pinheiro andBates (2000).

Currently, mkran takes only two kinds of formulas, ~1|grp2 or ~grp1|grp2. Both grp1 andgrp2 should be factors, and for the second formula, the levels of grp2 should be nested underthose of grp1.

Page 21: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

mkran 21

The Z matrix is determined by grp2. When observations are ordered according to the levels ofgrp2, the Z matrix is block diagonal of 1 vectors.

The Sigma matrix is diagonal. For ~1|grp2, it has one tuning parameter. For ~grp1|grp2,the number of parameters equals the number of levels of grp1, with each parameter shared by thegrp2 levels nested under the same grp1 level.

Value

A list of three components.

z Z matrix.

sigma Sigma matrix to be evaluated through sigma$fun(para,sigma$env).

init Initial parameter values.

Note

One may pass a formula or a list to the argument random in calls to ssanova orgssanova tofit nonparametric mixed-effect models. A formula will be converted to a list using mkran. A listshould be of the same form as the value of mkran.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. and Ma, P. (2005), Optimal smoothing in nonparametric mixed-effect models. The Annalsof Statistics, 33, 1357–1379.

Gu, C. and Ma, P. (2005), Generalized nonparametric mixed-effect models: computation andsmoothing parameter selection. Journal of Computational and Graphical Statistics, 14, 485–504.

Pinheiro and Bates (2000), Mixed-Effects Models in S and S-PLUS. New York: Springer-Verlag.

Examples

## Toy datatest <- data.frame(grp=as.factor(rep(1:2,c(2,3))))## First formularan.test <- mkran(~1|grp,test)ran.test$zran.test$sigma$fun(2,ran.test$sigma$env) # diag(10^(-2),2)## Second formularan.test <- mkran(~grp|grp,test)ran.test$zran.test$sigma$fun(c(1,2),ran.test$sigma$env) # diag(10^(-1),10^(-2))## Clean up## Not run: rm(test,ran.test)

Page 22: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

22 mkrk.nominal

mkrk.nominal Crafting Building Blocks for Discrete Splines

Description

Craft numerical functions to be used by mkterm to assemble model terms involving factors.

Usage

mkrk.nominal(levels)mkrk.ordinal(levels)

Arguments

levels Levels of the factor.

Details

For a nominal factor with levels 1, 2, . . . , k, the level means f(i) will be shrunk towards each otherthrough a penalty proportional to

(f(1) − f(.))2 + . . . + (f(k) − f(.))2

where f(.) = (f(1) + . . . + f(k))/k.

For a ordinal factor with levels 1 < 2 < . . . < k, the level means f(i) will be shrunk towards eachother through a penalty proportional to

(f(1) − f(2))2 + . . . + (f(k − 1) − f(k))2

Value

A list of two components.

fun Function definition.

env Portable local constants derived from the arguments.

Note

mkrk.x create a bivariate function fun(x,y,env,outer=FALSE), where x, y are real argu-ments and local constants can be passed in through env.

Author(s)

Chong Gu, 〈[email protected]

See Also

mkterm, mkrk.cubic, and mkrk.tp.

Page 23: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

mkterm 23

mkterm Assembling Model Terms for Smoothing Spline ANOVA Models

Description

Assemble numerical functions for calculating model terms in a smoothing spline ANOVA model.

Usage

mkterm(mf, type)

Arguments

mf Model frame of the model formula.

type List specifying the type of spline for each variable.

Details

For a factor x, type$x is ignored; mkrk.ordinal is used if is.ordered(x)==TRUE andmkrk.nominal is used otherwise. Factors with 3 or more levels are penalized.

For a numerical vector x, type$x is of the form type.x for type.x="cubic", "linear",or of the form list(type.x, range) for type.x="per", "cubic.per", "linear.per","cubic", "linear"; "per" is short for "cubic.per". See mkfun.poly for the functionsused. For type.xmissing, the default is "cubic". For rangemissing with type.x="cubic","linear", the default is c(min(x),max(x))+c(-1,1)*(max(x)-mimn(x))*.05.

For a numerical matrix x, type$x is of the form type.x or list(type.x, order) fortype.x="tp", "sphere", or of the form list("tp",list(order=order,mesh=mesh,weight=weight)).See mkfun.tp for the functions used. For type.x missing, the default is "tp". For ordermissing, the default is 2. For mesh and weight missing with type.x="tp" and order given,the defaults are mesh=x and weight=1.

For a numerical vector or numerical matrix x, one may also use type$x of the form list("custom",list(nphi=nphi,mkphi=mkphi,mkrk=mkrk,env=env));nphi is the null space dimension excluding the constant, and mkphi is ignored if nphi=0. Seeexamples below. This feature allows the use of other marginal constructions; one may modifymkphi.cubic or mkphi.tp.p for mkphi and modify mkrk.cubic or mkrk.sphere formkrk.

Value

A list object with a component labels containing the labels of all model terms. For each of themodel terms, there is a component holding the numerical functions for calculating the unpenalizedand penalized parts within the term.

Page 24: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

24 mkterm

Background

Tensor-product splines are constructed based on the model formula and the marginal reproducingkernels, as described in Gu (2002, Sec. 2.4). The marginal variables can be factors, numericalvectors, and numerical matrices, as specified in the details section.

One-way ANOVA decompositions are built in the supported marginal constructions, in which onehas the constant, a "nonparametric contrast," and possibly also a "parametric contrast." To the "non-parametric contrast" there corresponds a reproducing kernal rk, and to a "parametric contrast"there corresponds a set of null space basis phi. The reproducing kernels and null space basis onthe product domain can be constructed from the marginal rk and phi in a systematic manner.

The marginal one-way ANOVA structures induce a multi-way ANOVA structure on the productdomain, with model terms consisting of unpenalized "parametric contrasts" and/or penalized "non-parametric contrasts." One only needs to construct rk’s and phi’s associated with the model termsimplied by the model formula.

Note

For a numerical vector x in ssden, the default range is domain$x.

For a numerical matrix xwith type.x="sphere", it is assumed that dim(x)[2]==2, x[,1]between [-90,90] the latitude in degrees, and x[,2] between [-180,180] the longitude in degrees.

For backward compatibility, one may set type="cubic", "linear", or "tp", but then thedefault parameters can not be overridden; the type is simply duplicated for each variable.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Examples

## cubic marginalsx1 <- rnorm(100); x2 <- rnorm(100); y <- 3+5*sin(x1-2*x2)+rnorm(x1)fit <- ssanova0(y~x1*x2)## the same fitfit1 <- ssanova0(y~x1*x2,type=list(x1="cubic"))## the same fit one more timepar <- list(nphi=1,mkphi=mkphi.cubic,mkrk=mkrk.cubic,

env=c(min(x2),max(x2))+c(-1,1)*(max(x2)-min(x2))*.05)fit2 <- ssanova0(y~x1*x2,type=list(x2=list("custom",par)))## Clean up## Not run: rm(x1,x2,y,fit,fit1,par,fit2)

## cubic and thin-plate marginalsx1 <- rnorm(100); x2 <- matrix(rnorm(200),100,2)y <- 3+5*sin(x1-2*x2[,1]*x2[,2])+rnorm(x1)fit <- ssanova0(y~x1*x2)## the same fit

Page 25: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

nlm0 25

fit1 <- ssanova0(y~x1*x2,type=list(x2="tp"))## the same fit one more timemkphi.tp1 <- function(x) mkphi.tp(x$dm,x$ord,x$mesh,x$wt)mkrk.tp1 <- function(x) mkrk.tp(x$dm,x$ord,x$mesh,x$wt)env <- list(dm=2,ord=2,mesh=x2,wt=1)par <- list(nphi=2,mkphi=mkphi.tp1,mkrk=mkrk.tp1,env=env)fit2 <- ssanova0(y~x1*x2,type=list(x2=list("custom",par)))## Clean up## Not run: rm(x1,x2,y,fit,fit1,mkphi.tp1,mkrk.tp1,env,par,fit2)

nlm0 Minimizing Univariate Functions on Finite Intervals

Description

Minimize univariate functions on finite intervals using 3-point quadratic fit, with golden-sectionsafe-guard.

Usage

nlm0(fun, range, prec=1e-7)

Arguments

fun Function to be minimized.

range Interval on which the function to be minimized.

prec Desired precision of the solution.

Value

nlm0 returns a list object with the following components.

estimate Minimizer.

minimum Minimum.

evaluations Number of function evaluations.

Page 26: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

26 ozone

nox NOx in Engine Exhaust

Description

Data from an experiment in which a single-cylinder engine was run with ethanol to see how theNOx concentration in the exhaust depended on the compression ratio and the equivalence ratio.

Usage

data(nox)

Format

A data frame containing 88 observations on the following variables.

nox NOx concentration in exhaust.comp Compression ratio.equi Equivalence ratio.

Source

Brinkman, N. D. (1981), Ethanol fuel – a single-cylinder engine study of efficiency and exhaustemissions. SAE Transactions, 90, 1410–1424.

References

Cleveland, W. S. and Devlin, S. J. (1988), Locally weighted regression: An approach to regressionanalysis by local fitting. Journal of the American Statistical Association, 83, 596–610.

Breiman, L. (1991), The pi method for estimating multivariate functions from noisy data. Techno-metrics, 33, 125–160.

ozone Ozone Concentration in Los Angeles Basin

Description

Daily measurements of ozone concentration and eight meteorological quantities in the Los Angelesbasin for 330 days of 1976.

Usage

data(ozone)

Page 27: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

ozone 27

Format

A data frame containing 330 observations on the following variables.

Page 28: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

28 predict.ssanova

upo3 Upland ozone concentration, in ppm.vdht Vandenberg 500 millibar height, in meters.wdsp Wind speed, in miles per hour.hmdt Humidity.sbtp Sandburg Air Base temperature, in Celsius.ibht Inversion base height, in foot.dgpg Dagget pressure gradient, in mmHg.ibtp Inversion base temperature, in Fahrenheit.vsty Visibility, in miles.day Calendar day, between 1 and 366.

Source

Unknown.

References

Breiman, L. and Friedman, J. H. (1985), Estimating optimal transformations for multiple regressionand correlation. Journal of the American Statistical Association, 80, 580–598.

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

predict.ssanova Predicting from Smoothing Spline ANOVA Fits

Description

Evaluate terms in a smoothing spline ANOVA fit at arbitrary points. Standard errors of the termscan be requested for use in constructing Bayesian confidence intervals.

Usage

predict.ssanova(object, newdata, se.fit=FALSE,include=object$terms$labels, ...)

predict.ssanova0(object, newdata, se.fit=FALSE,include=object$terms$labels, ...)

Arguments

object Object of class inheriting from "ssanova".

newdata Data frame or model frame in which to predict.

se.fit Flag indicating if standard errors are required.

include List of model terms to be included in the prediction. The partial and offsetterms, if present, are to be specified by "partial" and "offset", respec-tively.

... Ignored.

Page 29: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

predict.ssanova 29

Value

For se.fit=FALSE, predict.ssanova returns a vector of the evaluated fit.

For se.fit=TRUE, predict.ssanova returns a list consisting of the following components.

fit Vector of evaluated fit.

se.fit Vector of standard errors.

Note

To supply the partial terms for partial spline models, add a component partial=I(...) innewdata; the "as is" function I(...) is necessary when partial has more than one column.

For mixed-effect models through ssanova or gssanova, the Z matrix is set to 0 if not supplied.To supply the Z matrix, add a component random=I(...) in newdata.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (1992), Penalized likelihood regression: a Bayesian analysis. Statistica Sinica, 2, 255–264.

Gu, C. and Wahba, G. (1993), Smoothing spline ANOVA with component-wise Bayesian "confi-dence intervals." Journal of Computational and Graphical Statistics, 2, 97–117.

Kim, Y.-J. and Gu, C. (2004), Smoothing spline Gaussian regression: more scalable computationvia efficient approximation. Journal of the Royal Statistical Society, Ser. B, 66, 337–356.

See Also

Fitting functions ssanova, ssanova0, gssanova, gssanova0 and methods summary.ssanova,summary.gssanova, summary.gssanova0, project.ssanova, fitted.ssanova.

Examples

## THE FOLLOWING EXAMPLE IS TIME-CONSUMING## Not run:## Fit a model with cubic and thin-plate marginals, where geog is 2-Ddata(LakeAcidity)fit <- ssanova(ph~log(cal)*geog,,LakeAcidity)## Obtain estimates and standard errors on a gridnew <- data.frame(cal=1,geog=I(matrix(0,1,2)))new <- model.frame(~log(cal)+geog,new)predict(fit,new,se=TRUE)## Evaluate the geog main effectpredict(fit,new,se=TRUE,inc="geog")## Evaluate the sum of the geog main effect and the interactionpredict(fit,new,se=TRUE,inc=c("geog","log(cal):geog"))## Evaluate the geog main effect on a gridgrid <- seq(-.04,.04,len=21)new <- model.frame(~geog,list(geog=cbind(rep(grid,21),rep(grid,rep(21,21)))))

Page 30: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

30 print

est <- predict(fit,new,se=TRUE,inc="geog")## Plot the fit and standard errorpar(pty="s")contour(grid,grid,matrix(est$fit,21,21),col=1)contour(grid,grid,matrix(est$se,21,21),add=TRUE,col=2)## Clean uprm(LakeAcidity,fit,new,grid,est)dev.off()## End(Not run)

print Print Functions for Smoothing Spline ANOVA Models

Description

Print functions for Smoothing Spline ANOVA models.

Usage

print.ssanova(x, ...)print.ssanova0(x, ...)print.gssanova(x, ...)print.ssden(x, ...)print.sshzd(x, ...)print.summary.ssanova(x, digits=6, ...)print.summary.gssanova(x, digits=6, ...)print.summary.gssanova0(x, digits=6, ...)

Arguments

x Object of class ssanova, summary.ssanova, summary.gssanova, orssden.

digits Number of significant digits to be printed in values.

... Ignored.

See Also

ssanova, ssanova0, gssanova, gssanova0, ssden, sshzd, summary.ssanova, summary.gssanova,summary.gssanova0.

Page 31: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

project 31

project Projecting Smoothing Spline ANOVA Fits for Model Diagnostics

Description

Calculate Kullback-Leibler projection of smoothing spline ANOVA fits for model diagnostics.

Usage

project(object, ...)project.ssanova(object, include, ...)project.gssanova(object, include, ...)project.ssden(object, include, mesh=FALSE, ...)project.sshzd(object, include, mesh=FALSE, ...)

Arguments

object Object of class "ssanova", "gssanova", "ssden", or "sshzd".

... Additional arguments. Ignored in project.x.

include List of model terms to be included in the reduced model space. The partialand offset terms, if present, are to be specified by "partial" and "offset",respectively.

mesh Flag indicating whether to return evaluations of the projection.

Details

The entropy KL(fit0,null) can be decomposed as the sum of KL(fit0,fit1) and KL(fit1,null), wherefit0 is the fit to be projected, fit1 is the projection in the reduced model space, and null is the constantfit. The ratio KL(fit0,fit1)/KL(fit0,null) serves as a diagnostic of the feasibility of the reduced model.

For regression fits, smoothness safe-guard is used to prevent interpolation, and KL(fit0,fit1)+KL(fit1,null)may not match KL(fit0,null) perfectly.

For mixed-effect models from ssanova and gssanova, the estimated random effects are treatedas offset.

Value

The functions return a list consisting of the following components.

ratio KL(fit0,fit1)/KL(fit0,null); the smaller the value, the more feasible the reducedmodel is.

kl KL(fit0,fit1).

check KL(fit0,fit1)/KL(fit0,null)+KL(fit1,null)/KL(fit0,null); a value closer to 1 is pre-ferred.

mesh The evaluations of the projection.

Page 32: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

32 rkpk

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2004), Model diagnostics for smoothing spline ANOVA models. The Canadian Journal ofStatistics, 32, 347–358.

See Also

Fitting functions ssanova, gssanova, ssden, and sshzd.

rkpk Numerical Engine for ssanova and gssanova

Description

Perform numerical calculations for the ssanova and gssanova suites.

Usage

sspreg1(s, r, q, y, method, alpha, varht, random)mspreg1(s, r, q, y, method, alpha, varht, random)

sspngreg(family, s, r, q, y, wt, offset, alpha, nu, random)mspngreg(family, s, r, q, y, wt, offset, alpha, nu, random)ngreg(dc, family, sr, q, y, wt, offset, nu, alpha)

ngreg.proj(dc, family, sr, q, y0, wt, offset, nu)

Arguments

family Description of the error distribution. Supported are exponential families "binomial","poisson", "Gamma", and "nbinomial". Also supported are acceleratedlife model families "weibull", "lognorm", and "loglogis".

s Unpenalized terms evaluated at data points.

r Basis of penalized terms evaluated at data points.

q Penalty matrix.

y Response vector.

wt Model weights.

offset Model offset.

method "v" for GCV, "m" for GML, or "u" for Mallows’ CL.

alpha Parameter modifying GCV or Mallows’ CL scores for smoothing parameter se-lection.

Page 33: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

rkpk0 33

nu Optional argument for future support of nbinomial, weibull, lognorm, and loglo-gis families.

varht External variance estimate needed for method="u".

random Input for parametric random effects in nonparametric mixed-effect models.

dc Coefficients of fits.

sr cbind(s,r).

y0 Components of the fit to be projected.

Details

sspreg1 is used by ssanova to compute regression estimates with a single smoothing param-eter. mspreg1 is used by ssanova to compute regression estimates with multiple smoothingparameters.

ssngpreg is used by gssanova to compute non-Gaussian regression estimates with a singlesmoothing parameter. mspngreg is used by gssanova to compute non-Gaussian regressionestimates with multiple smoothing parameters. ngreg is used by ssngpreg and mspngreg toperform Newton iteration with fixed smoothing parameters and to calculate cross-validation scoreson return.

ngreg.proj is used by project.gssanova to calculate the Kullback-Leibler projection fornon-Gaussian regression.

References

Kim, Y.-J. and Gu, C. (2004), Smoothing spline Gaussian regression: more scalable computationvia efficient approximation. Journal of the Royal Statistical Society, Ser. B, 66, 337–356.

rkpk0 Interface to RKPACK

Description

Call RKPACK routines for numerical calculations concerning the ssanova0 and gssanova0suites.

Usage

sspreg0(s, q, y, method="v", varht=1)mspreg0(s, q, y, method="v", varht=1, prec=1e-7, maxiter=30)sspregpoi(family, s, q, y, wt, offset, method="u",

varht=1, nu, prec=1e-7, maxiter=30)mspregpoi(family, s, q, y, wt, offset, method="u",

varht=1, nu, prec=1e-7, maxiter=30)getcrdr(obj, r)getsms(obj)

Page 34: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

34 smolyak

Arguments

s Design matrix of unpenalized terms.q Penalty matrices of penalized terms.y Model response.method Method for smoothing parameter selection.varht Assumed dispersion parameter, needed only for method="u".prec Precision requirement for iterations.maxiter Maximum number of iterations allowed.family Error family.wt Model weights.offset Model offset.obj Object returned from a call to sspreg, mspreg, sspregpoi, or mspregpoi.nu Optional argument for nbinomial, weibull, lognorm, and loglogis families.r Inputs for standard error calculation.

Details

sspreg0 is used by ssanova0 to fit Gaussian models with a single smoothing parameter. mspreg0is used to fit Gaussian models with multiple smoothing parameters.

sspregpoi is used by gssanova0 to fit non Gaussian models with a single smoothing parame-ter. mspregpoi is used to fit non Gaussian models with multiple smoothing parameters.

getcrdr and getsms are used by predict.ssanova0 to calculate standard errors of thefitted terms.

References

Gu, C. (1989), RKPACK and its applications: Fitting smoothing spline models. In ASA Proceedingsof Statistical Computing Section, pp. 42–51.

Gu, C. (1992), Cross validating non Gaussian data. Journal of Computational and Graphical Statis-tics, 1, 169–179.

smolyak Generating Smolyak Cubature

Description

Generate delayed Smolyak cubatures using C routines modified from smolyak.c found in KnutPetras’ SMOLPACK.

Usage

smolyak.quad(d, k)

smolyak.size(d, k)

Page 35: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

ssanova 35

Arguments

d Dimension of unit cube.

k Depth of algorithm.

Value

smolyak.quad returns a list object with the following components.

pt Quadrature nodes in rows of matrix.

wt Quadrature weights.

smolyak.size returns an integer.

ssanova Fitting Smoothing Spline ANOVA Models

Description

Fit smoothing spline ANOVA models in Gaussian regression. The symbolic model specification viaformula follows the same rules as in lm.

Usage

ssanova(formula, type=NULL, data=list(), weights, subset, offset,na.action=na.omit, partial=NULL, method="v", alpha=1.4,varht=1, id.basis=NULL, nbasis=NULL, seed=NULL, random=NULL)

Arguments

formula Symbolic description of the model to be fit.

type List specifying the type of spline for each variable. See mkterm for details.

data Optional data frame containing the variables in the model.

weights Optional vector of weights to be used in the fitting process.

subset Optional vector specifying a subset of observations to be used in the fitting pro-cess.

offset Optional offset term with known parameter 1.

na.action Function which indicates what should happen when the data contain NAs.

partial Optional extra unpenalized terms in partial spline models.

method Method for smoothing parameter selection. Supported are method="v" forGCV, method="m" for GML (REML), and method="u" for Mallows’ CL.

alpha Parameter modifying GCV or Mallows’ CL; larger absolute values yield smootherfits; negative value invokes a stable and more accurate GCV/CL evaluation al-gorithm but may take two to five times as long. Ignored when method="m"are specified.

Page 36: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

36 ssanova

varht External variance estimate needed for method="u". Ignored when method="v"or method="m" are specified.

id.basis Index designating selected "knots".

nbasis Number of "knots" to be selected. Ignored when id.basis is supplied.

seed Seed to be used for the random generation of "knots". Ignored when id.basisis supplied.

random Input for parametric random effects in nonparametric mixed-effect models. Seemkran for details.

Details

The model specification via formula is intuitive. For example, y~x1*x2 yields a model of theform

y = C + f1(x1) + f2(x2) + f12(x1, x2) + e

with the terms denoted by "1", "x1", "x2", and "x1:x2".

The model terms are sums of unpenalized and penalized terms. Attached to every penalized termthere is a smoothing parameter, and the model complexity is largely determined by the number ofsmoothing parameters.

A subset of the observations are selected as "knots." Unless specified via id.basis or nbasis,the number of "knots" q is determined by max(30, 10n2/9), which is appropriate for the defaultcubic splines for numerical vectors.

Using q "knots," ssanova calculates an approximate solution to the penalized least squares prob-lem using algorithms of the order O(nq2), which for q << n scale better than the O(n3) algorithmsof ssanova0. For the exact solution, one may set q = n in ssanova, but ssanova0 would bemuch faster.

Value

ssanova returns a list object of class "ssanova".

The method summary.ssanova can be used to obtain summaries of the fits. The methodpredict.ssanova can be used to evaluate the fits at arbitrary points along with standard er-rors. The method project.ssanova can be used to calculate the Kullback-Leibler projectionfor model selection. The methods residuals.ssanova and fitted.ssanova extract therespective traits from the fits.

Note

To use GCV and Mallows’ CL unmodified, set alpha=1.

For simpler models and moderate sample sizes, the exact solution of ssanova0 can be faster.

The results may vary from run to run. For consistency, specify id.basis or set seed.

In gss versions earlier than 1.0, ssanova was under the name ssanova1.

Author(s)

Chong Gu, 〈[email protected]

Page 37: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

ssanova0 37

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Kim, Y.-J. and Gu, C. (2004), Smoothing spline Gaussian regression: more scalable computationvia efficient approximation. Journal of the Royal Statistical Society, Ser. B, 66, 337–356.

Wahba, G. (1990), Spline Models for Observational Data. Philadelphia: SIAM.

Examples

## Fit a cubic splinex <- runif(100); y <- 5 + 3*sin(2*pi*x) + rnorm(x)cubic.fit <- ssanova(y~x)## Obtain estimates and standard errors on a gridnew <- data.frame(x=seq(min(x),max(x),len=50))est <- predict(cubic.fit,new,se=TRUE)## Plot the fit and the Bayesian confidence intervalsplot(x,y,col=1); lines(new$x,est$fit,col=2)lines(new$x,est$fit+1.96*est$se,col=3)lines(new$x,est$fit-1.96*est$se,col=3)## Clean up## Not run:rm(x,y,cubic.fit,new,est)dev.off()## End(Not run)

## Fit a tensor product cubic splinedata(nox)nox.fit <- ssanova(log10(nox)~comp*equi,data=nox)## Fit a spline with cubic and nominal marginalsnox$comp<-as.factor(nox$comp)nox.fit.n <- ssanova(log10(nox)~comp*equi,data=nox)## Fit a spline with cubic and ordinal marginalsnox$comp<-as.ordered(nox$comp)nox.fit.o <- ssanova(log10(nox)~comp*equi,data=nox)## Clean up## Not run: rm(nox,nox.fit,nox.fit.n,nox.fit.o)

ssanova0 Fitting Smoothing Spline ANOVA Models

Description

Fit smoothing spline ANOVA models in Gaussian regression. The symbolic model specification viaformula follows the same rules as in lm.

Usage

ssanova0(formula, type=NULL, data=list(), weights, subset,offset, na.action=na.omit, partial=NULL, method="v",varht=1, prec=1e-7, maxiter=30)

Page 38: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

38 ssanova0

Arguments

formula Symbolic description of the model to be fit.

type List specifying the type of spline for each variable. See mkterm for details.

data Optional data frame containing the variables in the model.

weights Optional vector of weights to be used in the fitting process.

subset Optional vector specifying a subset of observations to be used in the fitting pro-cess.

offset Optional offset term with known parameter 1.

na.action Function which indicates what should happen when the data contain NAs.

partial Optional extra unpenalized terms in partial spline models.

method Method for smoothing parameter selection. Supported are method="v" forGCV, method="m" for GML (REML), and method="u" for Mallow’s CL.

varht External variance estimate needed for method="u". Ignored when method="v"or method="m" are specified.

prec Precision requirement in the iteration for multiple smoothing parameter selec-tion. Ignored when only one smoothing parameter is involved.

maxiter Maximum number of iterations allowed for multiple smoothing parameter se-lection. Ignored when only one smoothing parameter is involved.

Details

The model specification via formula is intuitive. For example, y~x1*x2 yields a model of theform

y = C + f1(x1) + f2(x2) + f12(x1, x2) + e

with the terms denoted by "1", "x1", "x2", and "x1:x2".

The model terms are sums of unpenalized and penalized terms. Attached to every penalized termthere is a smoothing parameter, and the model complexity is largely determined by the number ofsmoothing parameters.

ssanova0 and the affiliated methods provide a front end to RKPACK, a collection of RATFORroutines for nonparametric regression via the penalized least squares. The algorithms implementedin RKPACK are of the order O(n3).

Value

ssanova0 returns a list object of class c("ssanova0","ssanova").

The method summary.ssanova0 can be used to obtain summaries of the fits. The methodpredict.ssanova0 can be used to evaluate the fits at arbitrary points along with standard errors.The methods residuals.ssanova and fitted.ssanova extract the respective traits fromthe fits.

Page 39: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

ssanova0 39

Note

For complex models and large sample sizes, the approximate solution of ssanova can be faster.

The method project is not implemented for ssanova0, nor is the mixed-effect model supportthrough mkran.

In gss versions earlier than 1.0, ssanova0 was under the name ssanova.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Wahba, G. (1990), Spline Models for Observational Data. Philadelphia: SIAM.

Examples

## Fit a cubic splinex <- runif(100); y <- 5 + 3*sin(2*pi*x) + rnorm(x)cubic.fit <- ssanova0(y~x,method="m")## Obtain estimates and standard errors on a gridnew <- data.frame(x=seq(min(x),max(x),len=50))est <- predict(cubic.fit,new,se=TRUE)## Plot the fit and the Bayesian confidence intervalsplot(x,y,col=1); lines(new$x,est$fit,col=2)lines(new$x,est$fit+1.96*est$se,col=3)lines(new$x,est$fit-1.96*est$se,col=3)## Clean up## Not run:rm(x,y,cubic.fit,new,est)dev.off()## End(Not run)

## Fit a tensor product cubic splinedata(nox)nox.fit <- ssanova0(log10(nox)~comp*equi,data=nox)## Fit a spline with cubic and nominal marginalsnox$comp<-as.factor(nox$comp)nox.fit.n <- ssanova0(log10(nox)~comp*equi,data=nox)## Fit a spline with cubic and ordinal marginalsnox$comp<-as.ordered(nox$comp)nox.fit.o <- ssanova0(log10(nox)~comp*equi,data=nox)## Clean up## Not run: rm(nox,nox.fit,nox.fit.n,nox.fit.o)

Page 40: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

40 ssden

ssden Estimating Probability Density Using Smoothing Splines

Description

Estimate probability densities using smoothing spline ANOVA models. The symbolic model spec-ification via formula follows the same rules as in lm, but with the response missing.

Usage

ssden(formula, type=NULL, data=list(), alpha=1.4, weights=NULL,subset, na.action=na.omit, id.basis=NULL, nbasis=NULL, seed=NULL,domain=as.list(NULL), quadrature=NULL, prec=1e-7, maxiter=30)

Arguments

formula Symbolic description of the model to be fit.

type List specifying the type of spline for each variable. See mkterm for details.

data Optional data frame containing the variables in the model.

alpha Parameter defining cross-validation score for smoothing parameter selection.

weights Optional vector of bin-counts for histogram data.

subset Optional vector specifying a subset of observations to be used in the fitting pro-cess.

na.action Function which indicates what should happen when the data contain NAs.

id.basis Index of observations to be used as "knots."

nbasis Number of "knots" to be used. Ignored when id.basis is specified.

seed Seed to be used for the random generation of "knots." Ignored when id.basisis specified.

domain Data frame specifying marginal support of density.

quadrature Quadrature for calculating integral. Mandatory if variables other than factors ornumerical vectors are involved.

prec Precision requirement for internal iterations.

maxiter Maximum number of iterations allowed for internal iterations.

Details

The model specification via formula is for the log density. For example, ~x1*x2 prescribes amodel of the form

logf(x1, x2) = g1(x1) + g2(x2) + g12(x1, x2) + C

with the terms denoted by "x1", "x2", and "x1:x2"; the constant is determined by the fact thata density integrates to one.

Page 41: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

ssden 41

The selective term elimination may characterize (conditional) independence structures betweenvariables. For example, ~x1*x2+x1*x3 yields the conditional independence of x2 and x3 givenx1.

Parallel to those in a ssanova object, the model terms are sums of unpenalized and penalizedterms. Attached to every penalized term there is a smoothing parameter, and the model complexityis largely determined by the number of smoothing parameters.

The selection of smoothing parameters is through a cross-validation mechanism described in thereferences, with a parameter alpha; alpha=1 is "unbiased" for the minimization of Kullback-Leibler loss but may yield severe undersmoothing, whereas larger alpha yields smoother esti-mates.

A subset of the observations are selected as "knots." Unless specified via id.basis or nbasis,the number of "knots" q is determined by max(30, 10n2/9), which is appropriate for the defaultcubic splines for numerical vectors.

Value

ssden returns a list object of class "ssden".

dssden and cdssden can be used to evaluate the estimated joint density and conditional density;pssden, qssden, cpssden, and cqssden can be used to evaluate (conditional) cdf and quan-tiles. The method project.ssden can be used to calculate the Kullback-Leibler projection formodel selection.

Note

Default quadrature will be constructed for up to 4 numerical vectors on a hyper cube, then outerproduct with factor levels will be taken if factors are involved. The sides of the hyper cubeare specified by domain; for domain$x missing, the default is c(min(x),max(x))+c(-1,1)*(max(x)-mimn(x))*.05.

On a 1-D interval, the quadrature is the 200-point Gauss-Legendre formula returned from gauss.quad.For 2, 3, or 4 numerical vectors, delayed Smolyak cubatures from smolyak.quad with 449,2527, and 13697 points are used on cubes with the marginals properly transformed; see Gu andWang (2003) for the marginal transformations.

The results may vary from run to run. For consistency, specify id.basis or set seed.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Gu, C. and Wang, J. (2003), Penalized likelihood density estimation: Direct cross-validation andscalable approximation. Statistica Sinica, 13, 811–826.

Page 42: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

42 sshzd

Examples

## 1-D estimate: Buffalo snowfalldata(buffalo)buff.fit <- ssden(~buffalo,domain=data.frame(buffalo=c(0,150)))plot(xx<-seq(0,150,len=101),dssden(buff.fit,xx),type="l")plot(xx,pssden(buff.fit,xx),type="l")plot(qq<-seq(0,1,len=51),qssden(buff.fit,qq),type="l")## Clean up## Not run:rm(buffalo,buff.fit,xx,qq)dev.off()## End(Not run)

## 2-D with triangular domain: AIDS incubationdata(aids)## rectangular quadraturequad.pt <- expand.grid(incu=((1:40)-.5)/40*100,infe=((1:40)-.5)/40*100)quad.pt <- quad.pt[quad.pt$incu<=quad.pt$infe,]quad.wt <- rep(1,nrow(quad.pt))quad.wt[quad.pt$incu==quad.pt$infe] <- .5quad.wt <- quad.wt/sum(quad.wt)*5e3## additive model (pre-truncation independence)aids.fit <- ssden(~incu+infe,data=aids,subset=age>=60,

domain=data.frame(incu=c(0,100),infe=c(0,100)),quad=list(pt=quad.pt,wt=quad.wt))

## conditional (marginal) density of infejk <- cdssden(aids.fit,xx<-seq(0,100,len=51),data.frame(incu=50))plot(xx,jk$pdf,type="l")## conditional (marginal) quantiles of infe (TIME-CONSUMING)## Not run:cqssden(aids.fit,c(.05,.25,.5,.75,.95),data.frame(incu=50),jk$int)## End(Not run)## Clean up## Not run:rm(aids,quad.pt,quad.wt,aids.fit,jk,xx)dev.off()## End(Not run)

## One factor plus one vectordata(gastric)gastric$trtfit <- ssden(~futime*trt,data=gastric)## conditional densitycdssden(fit,c("1","2"),cond=data.frame(futime=150))## conditional quantilescqssden(fit,c(.05,.25,.5,.75,.95),data.frame(trt="1"))## Clean up## Not run: rm(gastric,fit)

sshzd Estimating Hazard Function Using Smoothing Splines

Page 43: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

sshzd 43

Description

Estimate hazard function using smoothing spline ANOVA models. The symbolic model specifica-tion via formula follows the same rules as in lm, but with the response of a special form.

Usage

sshzd(formula, type=NULL, data=list(), alpha=1.4, weights=NULL,subset, na.action=na.omit, id.basis=NULL, nbasis=NULL, seed=NULL,prec=1e-7, maxiter=30)

Arguments

formula Symbolic description of the model to be fit, where the response is of the formSurv(futime,status,start=0).

type List specifying the type of spline for each variable. See mkterm for details.

data Optional data frame containing the variables in the model.

alpha Parameter defining cross-validation score for smoothing parameter selection.

weights Optional vector of counts for duplicated data.

subset Optional vector specifying a subset of observations to be used in the fitting pro-cess.

na.action Function which indicates what should happen when the data contain NAs.

id.basis Index of observations to be used as "knots."

nbasis Number of "knots" to be used. Ignored when id.basis is specified.

seed Seed to be used for the random generation of "knots." Ignored when id.basisis specified.

prec Precision requirement for internal iterations.

maxiter Maximum number of iterations allowed for internal iterations.

Details

The model specification via formula is for the log hazard. For example, Suve(t,d)~t*uprescribes a model of the form

logf(t, u) = C + gt(t) + gu(u) + gt,u(t, u)

with the terms denoted by "1", "t", "u", and "t:u". Replacing t*u by t+u in the formula,one gets a proportional hazard model with gt,u = 0.

sshzd takes standard right-censored lifetime data, with possible left-truncation and covariates;in Surv(futime,status,start=0)~..., futime is the follow-up time, status is thecensoring indicator, and start is the optional left-truncation time. The main effect of futimemust appear in the model terms specified via ....

Parallel to those in a ssanova object, the model terms are sums of unpenalized and penalizedterms. Attached to every penalized term there is a smoothing parameter, and the model complexityis largely determined by the number of smoothing parameters.

Page 44: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

44 sshzd

The selection of smoothing parameters is through a cross-validation mechanism described in Gu(2002, Sec. 7.2), with a parameter alpha; alpha=1 is "unbiased" for the minimization ofKullback-Leibler loss but may yield severe undersmoothing, whereas larger alpha yields smootherestimates.

A subset of the observations are selected as "knots." Unless specified via id.basis or nbasis,the number of "knots" q is determined by max(30, 10n2/9), which is appropriate for the defaultcubic splines for numerical vectors.

Value

sshzd returns a list object of class "sshzd".

hzdrate.sshzd can be used to evaluate the estimated hazard function. hzdcurve.sshzdcan be used to evaluate hazard curves with fixed covariates. survexp.sshzd can be used tocalculated estimated expected survival. The method project.sshzd can be used to calculatethe Kullback-Leibler projection for model selection.

Note

The function Surv(futime,status,start=0) is defined and parsed inside sshzd, notquite the same as the one in the survival package.

Integration on the time axis is done by the 200-point Gauss-Legendre formula on c(min(start),max(futime)),returned from gauss.quad.

The results may vary from run to run. For consistency, specify id.basis or set seed.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (2002), Smoothing Spline ANOVA Models. New York: Springer-Verlag.

Du, P. and Gu, C. (2006), Penalized likelihood hazard estimation: efficient approximation andBayesian confidence intervals. Statistics and Probability Letters, 76, 244–254.

Examples

## Model with interactiondata(gastric)gastric.fit <- sshzd(Surv(futime,status)~futime*trt,data=gastric)## exp(-Lambda(600)), exp(-(Lambda(1200)-Lambda(600))), and exp(-Lambda(1200))survexp.sshzd(gastric.fit,c(600,1200,1200),data.frame(trt=as.factor(1)),c(0,600,0))## Clean up## Not run:rm(gastric,gastric.fit)dev.off()## End(Not run)

## THE FOLLOWING EXAMPLE IS TIME-CONSUMING## Proportional hazard model

Page 45: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

summary.gssanova 45

## Not run:data(stan)stan.fit <- sshzd(Surv(futime,status)~futime+age,data=stan)## Evaluate fitted hazardhzdrate.sshzd(stan.fit,data.frame(futime=c(10,20),age=c(20,30)))## Plot lambda(t,age=20)tt <- seq(0,60,leng=101)hh <- hzdcurve.sshzd(stan.fit,tt,data.frame(age=20))plot(tt,hh,type="l")## Clean uprm(stan,stan.fit,tt,hh)dev.off()## End(Not run)

stan Stanford Heart Transplant Data

Description

Survival of patients from the Stanford heart transplant program.

Usage

data(stan)

Format

A data frame containing 184 observations on the following variables.

time Follow-up time after transplant, in days.status Censoring status.age Age at transplant.futime Square root of time.

Source

Miller, R. G. and Halpern, J. (1982), Regression with censored data. Biometrika, 69, 521–531.

summary.gssanova Assessing Smoothing Spline ANOVA Fits with Non-Gaussian Re-sponses

Description

Calculate various summaries of smoothing spline ANOVA fits with non-Gaussian responses.

Page 46: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

46 summary.gssanova

Usage

summary.gssanova(object, diagnostics=FALSE, ...)

Arguments

object Object of class "gssanova".

diagnostics Flag indicating if diagnostics are required.

... Ignored.

Details

Similar to the iterated weighted least squares fitting of glm, penalized likelihood regression fit canbe calculated through iterated penalized weighted least squares.

The diagnostics are based on the "pseudo" Gaussian response model behind the weighted leastsquares problem at convergence.

Value

summary.gssanova returns a list object of class "summary.gssanova" consisting of thefollowing components. The entries pi, kappa, cosines, and roughness are only calculatedif diagnostics=TRUE.

call Fitting call.

family Error distribution.

alpha Parameter used to define cross-validation in model fitting.

fitted Fitted values on the link scale.

dispersion Assumed or estimated dispersion parameter.

residuals Working residuals on the link scale.

rss Residual sum of squares.

dev.resid Deviance residuals.

deviance Deviance of the fit.

dev.null Deviance of the null model.

penalty Roughness penalty associated with the fit.

pi "Percentage decomposition" of "explained variance" into model terms.

kappa Concurvity diagnostics for model terms. Virtually the square roots of varianceinflation factors of a retrospective linear model.

cosines Cosine diagnostics for practical significance of model terms.

roughness Percentage decomposition of the roughness penalty penalty into model terms.

Author(s)

Chong Gu, 〈[email protected]

Page 47: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

summary.gssanova0 47

References

Gu, C. (1992), Diagnostics for nonparametric regression models with additive terms. Journal of theAmerican Statistical Association, 87, 1051–1058.

See Also

Fitting function gssanova and methods predict.ssanova, project.gssanova, fitted.gssanova.

summary.gssanova0 Assessing Smoothing Spline ANOVA Fits with Non-Gaussian Re-sponses

Description

Calculate various summaries of smoothing spline ANOVA fits with non-Gaussian responses.

Usage

summary.gssanova0(object, diagnostics=FALSE, ...)

Arguments

object Object of class "gssanova".

diagnostics Flag indicating if diagnostics are required.

... Ignored.

Details

Similar to the iterated weighted least squares fitting of glm, penalized likelihood regression fit canbe calculated through iterated penalized weighted least squares.

The diagnostics are based on the "pseudo" Gaussian response model behind the weighted leastsquares problem at convergence.

Value

summary.gssanova0 returns a list object of class "summary.gssanova0" consisting ofthe following components. The entries pi, kappa, cosines, and roughness are only calcu-lated if diagnostics=TRUE.

call Fitting call.

family Error distribution.

method Method for smoothing parameter selection.

dispersion Assumed or estimated dispersion parameter.

iter Number of performance-oriented iterations performed.

fitted Fitted values on the link scale.

Page 48: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

48 summary.ssanova

residuals Working residuals on the link scale.

rss Residual sum of squares.

dev.resid Deviance residuals.

deviance Deviance of the fit.

dev.null Deviance of the null model.

alpha Estimated size for family="nbinomial" with one column responses. Esti-mated inverse scale of log life time for family="nbinomial", "lognorm",or "loglogis".

penalty Roughness penalty associated with the fit.

pi "Percentage decomposition" of "explained variance" into model terms.

kappa Concurvity diagnostics for model terms. Virtually the square roots of varianceinflation factors of a retrospective linear model.

cosines Cosine diagnostics for practical significance of model terms.

roughness Percentage decomposition of the roughness penalty penalty into model terms.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (1992), Diagnostics for nonparametric regression models with additive terms. Journal of theAmerican Statistical Association, 87, 1051–1058.

See Also

Fitting function gssanova0 and methods predict.ssanova0, fitted.gssanova.

summary.ssanova Assessing Smoothing Spline ANOVA Fits

Description

Calculate various summaries of smoothing spline ANOVA fits.

Usage

summary.ssanova(object, diagnostics=FALSE, ...)summary.ssanova0(object, diagnostics=FALSE, ...)

Arguments

object Object of class "ssanova".

diagnostics Flag indicating if diagnostics are required.

... Ignored.

Page 49: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

wesdr 49

Value

summary.ssanova returns a list object of class "summary.ssanova" consisting of thefollowing components. The entries pi, kappa, cosines, and roughness are only calculatedif diagnostics=TRUE; see the reference below for details concerning the diagnostics.

call Fitting call.method Method for smoothing parameter selection.fitted Fitted values.residuals Residuals.sigma Assumed or estimated error standard deviation.r.squared Fraction of "explained variance" by the fitted model.rss Residual sum of squares.penalty Roughness penalty associated with the fit.pi "Percentage decomposition" of "explained variance" into model terms.kappa Concurvity diagnostics for model terms. Virtually the square roots of variance

inflation factors of a retrospective linear model.cosines Cosine diagnostics for practical significance of model terms.roughness Percentage decomposition of the roughness penalty penalty into model terms.

Author(s)

Chong Gu, 〈[email protected]

References

Gu, C. (1992), Diagnostics for nonparametric regression models with additive terms. Journal of theAmerican Statistical Association, 87, 1051–1058.

See Also

Fitting functions ssanova, ssanova0 and methods predict.ssanova, project.ssanova,fitted.ssanova.

wesdr Progression of Diabetic Retinopathy

Description

Data derived from the Wisconsin Epidemiological Study of Diabetic Retinopathy.

Usage

data(wesdr)

Format

A data frame containing 669 observations on the following variables.

Page 50: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

50 wesdr

dur Duration of diabetes at baseline, in years.gly Percent of glycosylated hemoglobin at baseline.bmi Body mass index at baseline.ret Binary indicator of retinopathy progression at first follow-up.

Source

Wang, Y. (1997), GRKPACK: Fitting smoothing spline ANOVA models for exponential families.Communications in Statistics – Simulations and Computation, 26, 765–782.

References

Klein, R., Klein, B. E. K., Moss, S. E., Davis, M. D., and DeMets, D. L. (1988), Glycosylatedhemoglobin predicts the incidence and progression of diabetic retinopathy. Journal of the AmericanMedical Association, 260, 2864–2871.

Klein, R., Klein, B. E. K., Moss, S. E., Davis, M. D., and DeMets, D. L. (1989), The Wiscon-sin Epidemiologic Study of Diabetic Retinopathy. X. Four incidence and progression of diabeticretinopathy when age at diagnosis is 30 or more years. Archive Ophthalmology, 107, 244–249.

Wahba, G., Wang, Y., Gu, C., Klein, R., and Klein, B. E. K. (1995), Smoothing spline ANOVAfor exponential families, with application to the Wisconsin Epidemiological Study of DiabeticRetinopathy. The Annals of Statistics, 23, 1865–1895.

Page 51: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

Index

∗Topic datasetsaids, 2bacteriuria, 3buffalo, 3gastric, 9LakeAcidity, 1nox, 25ozone, 25stan, 44wesdr, 48

∗Topic distributioncdssden, 4dssden, 6ssden, 39

∗Topic htestproject, 30

∗Topic internaldrkpk, 5family, 7mkfun.poly, 17mkfun.tp, 18mkran, 19mkrk.nominal, 21mkterm, 22rkpk, 31rkpk0, 32

∗Topic mathgauss.quad, 10nlm0, 24smolyak, 33

∗Topic modelscdssden, 4dssden, 6fitted.ssanova, 9gssanova, 10gssanova0, 13hzdrate.sshzd, 16predict.ssanova, 27print, 29

project, 30ssanova, 34ssanova0, 36ssden, 39sshzd, 41summary.gssanova, 44summary.gssanova0, 46summary.ssanova, 47

∗Topic regressionfitted.ssanova, 9gssanova, 10gssanova0, 13predict.ssanova, 27ssanova, 34ssanova0, 36summary.gssanova, 44summary.gssanova0, 46summary.ssanova, 47

∗Topic smoothcdssden, 4dssden, 6fitted.ssanova, 9gssanova, 10gssanova0, 13hzdrate.sshzd, 16predict.ssanova, 27print, 29project, 30ssanova, 34ssanova0, 36ssden, 39sshzd, 41summary.gssanova, 44summary.gssanova0, 46summary.ssanova, 47

∗Topic survivalhzdrate.sshzd, 16sshzd, 41

aids, 2

51

Page 52: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

52 INDEX

bacteriuria, 3buffalo, 3

cdssden, 4, 6, 40cfit.binomial (family), 7cfit.Gamma (family), 7cfit.loglogis (family), 7cfit.lognorm (family), 7cfit.nbinomial (family), 7cfit.poisson (family), 7cfit.weibull (family), 7class, 40, 43, 45, 46, 48cpssden, 40cpssden (cdssden), 4cqssden, 40cqssden (cdssden), 4cv.binomial (family), 7cv.Gamma (family), 7cv.loglogis (family), 7cv.lognorm (family), 7cv.nbinomial (family), 7cv.poisson (family), 7cv.weibull (family), 7

dev.null.binomial (family), 7dev.null.Gamma (family), 7dev.null.inverse.gaussian

(family), 7dev.null.loglogis (family), 7dev.null.lognorm (family), 7dev.null.nbinomial (family), 7dev.null.poisson (family), 7dev.null.weibull (family), 7dev.resid.binomial (family), 7dev.resid.Gamma (family), 7dev.resid.inverse.gaussian

(family), 7dev.resid.loglogis (family), 7dev.resid.lognorm (family), 7dev.resid.nbinomial (family), 7dev.resid.poisson (family), 7dev.resid.weibull (family), 7dev0.resid.loglogis (family), 7dev0.resid.lognorm (family), 7drkpk, 5dssden, 5, 6, 40

family, 7fitted.gssanova, 12, 14, 46, 47

fitted.gssanova (fitted.ssanova),9

fitted.ssanova, 9, 28, 35, 37, 48

gastric, 9gauss.quad, 10, 40, 43getcrdr (rkpk0), 32getsms (rkpk0), 32glm, 10, 12, 13, 15, 45, 46gssanova, 8, 10, 15, 20, 28, 29, 31, 32, 46gssanova0, 8, 12, 13, 28, 29, 32, 33, 47

hzdcurve.sshzd, 43hzdcurve.sshzd (hzdrate.sshzd), 16hzdrate.sshzd, 16, 43

kl.binomial (family), 7kl.Gamma (family), 7kl.loglogis (family), 7kl.lognorm (family), 7kl.nbinomial (family), 7kl.poisson (family), 7kl.weibull (family), 7

LakeAcidity, 1lm, 10, 13, 34, 36, 39, 42

mkdata.binomial (family), 7mkdata.Gamma (family), 7mkdata.inverse.gaussian (family),

7mkdata.loglogis (family), 7mkdata.lognorm (family), 7mkdata.nbinomial (family), 7mkdata.poisson (family), 7mkdata.weibull (family), 7mkfun.poly, 17, 19, 22mkfun.tp, 18, 18, 22mkphi.cubic, 22mkphi.cubic (mkfun.poly), 17mkphi.tp (mkfun.tp), 18mkphi.tp.p, 22mkran, 11, 15, 19, 35, 38mkrk.cubic, 21, 22mkrk.cubic (mkfun.poly), 17mkrk.linear (mkfun.poly), 17mkrk.nominal, 18, 19, 21, 22mkrk.ordinal, 22mkrk.ordinal (mkrk.nominal), 21

Page 53: The gss Packageftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/gss.pdf · 2007-08-09 · The gss Package August 9, 2007 Version 1.0-0 Depends R (>= 1.7.0) Title General Smoothing

INDEX 53

mkrk.sphere, 22mkrk.sphere (mkfun.tp), 18mkrk.tp, 21mkrk.tp (mkfun.tp), 18mkterm, 11, 13, 17–19, 21, 22, 34, 37, 39, 42mspdsty (drkpk), 5msphzd (drkpk), 5mspngreg (rkpk), 31mspreg0 (rkpk0), 32mspreg1 (rkpk), 31mspregpoi (rkpk0), 32

NegBinomial, 11, 14ngreg (rkpk), 31nlm0, 24nox, 25

ozone, 25

predict.lm, 4, 6predict.ssanova, 12, 27, 35, 46, 48predict.ssanova0, 14, 33, 37, 47predict.ssanova0

(predict.ssanova), 27print, 29print.summary.gssanova (print), 29print.summary.gssanova0 (print),

29print.summary.ssanova (print), 29proj0.binomial (family), 7proj0.Gamma (family), 7proj0.loglogis (family), 7proj0.lognorm (family), 7proj0.nbinomial (family), 7proj0.poisson (family), 7proj0.weibull (family), 7project, 15, 30, 38project.gssanova, 8, 12, 32, 46project.ssanova, 28, 35, 48project.ssden, 40project.sshzd, 43pssden, 40pssden (dssden), 6

qssden, 40qssden (dssden), 6

residuals.gssanova, 12, 14residuals.gssanova

(fitted.ssanova), 9

residuals.ssanova, 35, 37residuals.ssanova

(fitted.ssanova), 9rkpk, 31rkpk0, 32

smolyak, 33smolyak.quad, 40ssanova, 20, 28, 29, 31, 32, 34, 38, 40, 42,

48ssanova0, 28, 29, 32, 33, 35, 36, 48ssden, 5, 6, 23, 29, 31, 39sshzd, 5, 6, 16, 29, 31, 41sspdsty (drkpk), 5sspngreg (rkpk), 31sspreg0 (rkpk0), 32sspreg1 (rkpk), 31sspregpoi (rkpk0), 32stan, 44summary.gssanova, 12, 28, 29, 44summary.gssanova0, 14, 28, 29, 46summary.ssanova, 28, 29, 35, 47summary.ssanova0, 37summary.ssanova0

(summary.ssanova), 47survexp.sshzd, 43survexp.sshzd (hzdrate.sshzd), 16

wesdr, 48

y0.binomial (family), 7y0.Gamma (family), 7y0.loglogis (family), 7y0.lognorm (family), 7y0.nbinomial (family), 7y0.poisson (family), 7y0.weibull (family), 7