https://github.com/cran/gss
Tip revision: 791aba98b5e6302860a81e2b1c1bfdd3226c05f7 authored by Chong Gu on 08 August 1977, 00:00:00 UTC
version 0.5-3
version 0.5-3
Tip revision: 791aba9
predict.ssanova.Rd
\name{predict.ssanova}
\alias{predict.ssanova}
\title{Predicting from Smoothing Spline ANOVA Fits}
\description{
Evaluate terms in a smoothing spline ANOVA fit at arbitrary points.
Standard errors of the terms can be requested for use in
constructing Bayesian confidence intervals.
}
\usage{
predict[.ssanova](obj, newdata, se.fit=FALSE,
include=obj$terms$labels)
}
\arguments{
\item{obj}{Object of class inheriting from \code{"ssanova"}.}
\item{newdata}{Data frame or model frame in which to predict.}
\item{se.fit}{Flag indicating if standard errors are required.}
\item{include}{List of model terms to be included in the
prediction. The \code{partial} and \code{offset} terms, if
present, are to be specified by \code{"partial"} and
\code{"offset"}, respectively.}
}
\value{
For \code{se.fit=FALSE}, \code{predict.ssanova} returns a vector of
the evaluated fit.
For \code{se.fit=TRUE}, \code{predict.ssanova} returns a list
consisting of the following components.
\item{fit}{Vector of evaluated fit.}
\item{se.fit}{Vector of standard errors.}
}
\seealso{
Fitting functions \code{\link{ssanova}}, \code{\link{ssanova}} and
methods \code{\link{summary.ssanova}}, \code{\link{summary.gssanova}},
\code{\link{fitted.ssanova}}.
}
\author{Chong Gu, \email{chong@stat.purdue.edu}}
\references{
Gu, C. and Wahba, G. (1993), Smoothing spline ANOVA with
component-wise Bayesian "confidence intervals". \emph{Journal
of Computational and Graphical Statistics}, \bold{2}, 97--117.
}
\examples{
## Fit a model with thin-plate marginals, where geog is 2-D
data(LakeAcidity)
fit <- ssanova(ph~log(cal)*geog,"tp",LakeAcidity)
## Obtain estimates and standard errors on a grid
new <- 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 effect
predict(fit,new,se=TRUE,inc="geog")
## Evaluate the sum of the geog main effect and the interaction
predict(fit,new,se=TRUE,inc=c("geog","log(cal):geog"))
## Evaluate the geog main effect on a grid
grid <- seq(-.04,.04,len=21)
new <- model.frame(~geog,list(geog=cbind(rep(grid,21),rep(grid,rep(21,21)))))
est <- predict(fit,new,se=TRUE,inc="geog")
## Plot the fit and standard error
par(pty="s")
contour(grid,grid,matrix(est$fit,21,21),col=1)
contour(grid,grid,matrix(est$se,21,21),add=TRUE,col=2)
}
\keyword{models}
\keyword{regression}
\keyword{smooth}