ssanova9 {gss} | R Documentation |
Fit smoothing spline ANOVA models with correlated Gaussian data.
The symbolic model specification via formula
follows the same
rules as in lm
.
ssanova9(formula, type=NULL, data=list(), subset, offset, na.action=na.omit, partial=NULL, method="v", alpha=1.4, varht=1, id.basis=NULL, nbasis=NULL, seed=NULL, cov, skip.iter=FALSE) para.arma(fit)
formula |
Symbolic description of the model to be fit. |
type |
List specifying the type of spline for each variable.
See |
data |
Optional data frame containing the variables in the model. |
subset |
Optional vector specifying a subset of observations to be used in the fitting process. |
offset |
Optional offset term with known parameter 1. |
na.action |
Function which indicates what should happen when the data contain NAs. |
partial |
Optional symbolic description of parametric terms in partial spline models. |
method |
Method for smoothing parameter selection. Supported
are |
alpha |
Parameter modifying V or U; larger absolute values
yield smoother fits. Ignored when |
varht |
External variance estimate needed for
|
id.basis |
Index designating selected "knots". |
nbasis |
Number of "knots" to be selected. Ignored when
|
seed |
Seed to be used for the random generation of "knots".
Ignored when |
cov |
Input for covariance functions. See |
skip.iter |
Flag indicating whether to use initial values of theta and skip theta iteration. See notes on skipping theta iteration. |
fit |
|
The model specification via formula
is intuitive. For
example, y~x1*x2
yields a model of the form
y = C + f_{1}(x1) + f_{2}(x2) + f_{12}(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 term there is a smoothing parameter, and the model complexity is largely determined by the number of smoothing 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,10n^{2/9}), which is
appropriate for the default cubic splines for numerical vectors.
Using q "knots," ssanova
calculates an approximate
solution to the penalized least squares problem using algorithms of
the order O(nq^{2}), which for q<<n scale better than
the O(n^{3}) algorithms of ssanova0
. For the
exact solution, one may set q=n in ssanova
, but
ssanova0
would be much faster.
ssanova9
returns a list object of class
c("ssanova9","ssanova")
.
The method summary.ssanova9
can be used to obtain
summaries of the fits. The method predict.ssanova
can
be used to evaluate the fits at arbitrary points along with standard
errors. The method project.ssanova9
can be used to
calculate the Kullback-Leibler projection for model selection. The
methods residuals.ssanova
and
fitted.ssanova
extract the respective traits from the
fits.
para.arma
returns the fitted ARMA coefficients for
cov=list("arma",c(p,q))
in the call to ssanova9
.
For the selection of multiple smoothing parameters,
nlm
is used to minimize the selection criterion such
as the GCV score. When the number of smoothing parameters is large,
the process can be time-consuming due to the great amount of
function evaluations involved.
The starting values for the nlm
iteration are obtained using
Algorith 3.2 in Gu and Wahba (1991). These starting values usually
yield good estimates themselves, leaving the subsequent quasi-Newton
iteration to pick up the "last 10%" performance with extra effort
many times of the initial one. Thus, it is often a good idea to
skip the iteration by specifying skip.iter=TRUE
, especially
in high-dimensions and/or with multi-way interactions.
skip.iter=TRUE
could be made the default in future releases.
The results may vary from run to run. For consistency, specify
id.basis
or set seed
.
Chong Gu, chong@stat.purdue.edu
Han, C. and Gu, C. (2008), Optimal smoothing with correlated data, Sankhya, 70-A, 38–72.
x <- runif(100); y <- 5 + 3*sin(2*pi*x) + rnorm(x) ## independent fit fit <- ssanova9(y~x,cov=list("known",diag(1,100))) ## AR(1) fit fit <- ssanova9(y~x,cov=list("arma",c(1,0))) para.arma(fit) ## MA(1) fit e <- rnorm(101); e <- e[-1]-.5*e[-101] x <- runif(100); y <- 5 + 3*sin(2*pi*x) + e fit <- ssanova9(y~x,cov=list("arma",c(0,1))) para.arma(fit) ## Clean up ## Not run: rm(x,y,e,fit)