semipar.mp(formula, Y, lsp, data = NULL, range.basis = NULL, knots = "quantile", rm.constr = FALSE, random = NULL, store.reml = FALSE, store.fitted = FALSE)
~ x1 + sf(x2) +sf(x2, effect
= x3)
" where x1
is a linear (parametric) predictor, x2
is a
predictor on which the responses depend smoothly, and x3
is a
predictor whose effect is linear but varies smoothly with x2
(i.e., a
varying-coefficient predictor).NULL
, it will be set as the
range of the variable to be evaluated by the basis."quantile"
, gives knots at equally spaced quantiles of the data. The
alternative, "equispaced"
, gives equally spaced knots.FALSE
by default, as this output
can be very large.FALSE
by default."semipar.mp"
, which is also of class
"qplsc.mp"
but includes the following additional elements:
but includes the following additional elements:semipar.mix.mp
is generally preferable for mixed models with a
single smooth term.Each element of list.all
corresponding to a nonparametric term
of the model is a list with components modmat
, penmat
,
pen.order
, start
, and end
. For each parametric
term, the same five components are included, plus basis
,
argvals
, effect
, k
, and norder
.
n<-32
Ys <- matrix(0, n, 5)
for(i in 1:n) Ys[i,]<--2:2+rnorm(5, i^2, i^0.5)+sin(i)
x1 <- rnorm(n,0,5)
x2 <- 1:n+runif(n, 1, 20)
semipar.obj <- semipar.mp(~x1+sf(x2,k=10),Y=Ys,lsp=seq(5,50,,30))
Run the code above in your browser using DataLab