The S function for fitting a SLM is slm. A typical call is
slm(formula, rk, random, data)The first three arguments are required. formula and rk serve the same purposes as in ssr. formula, a two-sided formula separated by the operator
~
, lists the response variable on the left side,
and the bases
Other options include correlation, weights and control. They all have the same functions as in ssr.
An object of slm class is returned. Generic functions
summary, predict and intervals
can be applied to extract further information. The
predict function returns predictions at specified points.
The intervals function returns the posterior means and
variances of combinations of components in as an object of
class "bCI". Then the generic function plot can be used
to construct plots. See help files for details.
As a simple example, consider repeated measures over time from multiple subjects. Suppose that we want to fit the following model
slm(y~t, rk=cubic(t), random=list(subject=~1), corr=corGaus(form=~t|subject))