## Fit model on oats data
data(oats.data)
## Fit a model with a 1-dimensional spline at the plot level.
LMM1_spline <- LMMsolve(fixed = yield ~ rep + gen,
spline = ~spl1D(x = plot, nseg = 20),
data = oats.data)
## Obtain the smooth trend for the fitted model on a dense grid.
smooth1 <- obtainSmoothTrend(LMM1_spline,
grid = 100)
## Obtain the smooth trend on a new data set - plots 10 to 40.
newdat <- data.frame(plot = 10:40)
smooth2 <- obtainSmoothTrend(LMM1_spline,
newdata = newdat)
## The first derivative of the smooth trend can be obtained by setting deriv = 1.
smooth3 <- obtainSmoothTrend(LMM1_spline,
grid = 100,
deriv = 1)
## For examples of higher order splines see the vignette.
Run the code above in your browser using DataLab