Consider model () with being a function of multivariate variables . Each variable itself could be a vector. Assume that , where is an arbitrary domain. Then is a function of .
Suppose that we want to use the RKHS
to model the effect of variable . Denote as the
projection operator onto in
. Then
() is just the simplest form of the so-called
SS ANOVA decomposition. The classical ANOVA
models are special cases with all variables being discrete.
In general, suppose that we want to use the RKHS
to model the effect of variable where 's are
basis functions for the null space
. Denote as the
projection operator onto
in
. Then
expansion of the following equation
ssr can also be used to fit SS ANOVA models. Basis functions can be specified as before using the formula argument. Reproducing kernels can be specified using the argument rk as a list of expressions.
Example 7 Consider , and . Functional data are a typical example of this case (Ramsay and Silverman, 1997). Suppose that we want to model the effect using a one-way ANOVA effect model with , and the effect using a linear spline . Define two projection operators
ssr(y~1, rk=list(shrink1(t1),linear(t2),rk.prod(shrink1(t1),linear(t2))))where rk.prod is a function in our library calculating the product of two reproducing kernels.
Suppose that instead of a linear spline, we want to model effect
using a cubic spline
ssr(y~I(t2-.5), rk=list(shrink1(t1),cubic(t2), rk.prod(shrink1(t1),kron(t2-.5)), rk.prod(shrink1(t1),cubic(t2))))where the function kron in our library calculates the reproducing kernel for the space .
Example 8 Consider , and , a case with two continuous covariates. If we model both covariates using linear splines
ssr(y~1, rk=list(linear(t1),linear(t2),rk.prod(linear(t1),linear(t2))))If we want to model both variables using cubic splines
ssr(y~I(t1-.5)+I(t2-.5), rk=list(cubic(t1),cubic(t2), rk.prod(kron(t1-.5),cubic(t2)), rk.prod(cubic(t1),kron(t2-.5)), rk.prod(cubic(t1),cubic(t2))))
For the purpose of model building and inference, one may want to construct Bayesian confidence intervals for combinations of components in the model space (). Gu and Wahba (1993b) provided formulae to calculate posterior covariances for any combination of components. Denote as components in the null space , and as the component in space , . Let be a sequence of 0's and 1's. The utility function predict calculates posterior means and standard deviations for the combination . Multiple combinations can be computed simultaneously. For example, after fitting the SS ANOVA model () and saving into an object, say ssrfit, then one may calculate the posterior mean and standard deviations for the smooth-smooth interaction and the total interaction by
predict(ssrfit,terms=c(0,0,0,0,0,0,0,1)) predict(ssrfit,terms=c(0,0,0,0,0,1,1,1))These two statements can be combined into one
predict(ssrfit,terms=matrix(c(0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1), ncol=2,byrow=T))An object of class "bCI" is returned from this predict function, and the generic function plot can be used to plot these combinations with Bayesian confidence intervals. See help file of plot.bCI for details. predict function can also be used to calculate predicted values at any given points.