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 of and covariates for the fixed effects in on the right side. rk specifies the reproducing kernels of . random specifies the random effects the same way as in nlme. The syntax of random is in the form of a named list of formulae or some pdMat objects. See the help file of lme for more details.
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))