The S function for fitting a SNM model is snm. A typical call is
snm(formula, func, fixed, start, random, data)The first 4 arguments are required. Arguments formula and func are the same as in nnr. Following syntax in nlme, the fixed and random arguments specify the fixed and random effects models in the second stage model (). The option start specifies initial values for all parameters in the fixed effects.
snm inherits most of the options in nlme. See documents of nlme and the help file of snm for details. Generic functions summary, predict and intervals can be applied to extract further information. intervals provides approximate posterior means and variances which can be used to construct Bayesian confidence intervals for the . Derivatives of with respect to random effects are needed to compute these quantities (Ke and Wang, 2001). In interval.snm, numerical derivatives are to be used.
Example 15. Mixed-effects SIMs.
In the SIM () for repeated measure data, it is
more appropriate to consider parameters as random variables
(Ke and Wang, 2001):
snm(y~b1+exp(b2)*f((t-b3)/exp(b4)), func=list(f(u)~list(u,tp.pseudo(u))), fixed=list(b1~1), random=list(b1+b2+b3+b4~1), start=b10)