oldpar <- par(no.readonly=TRUE)
# This tests the difference between boys and girls heights in the
# Berkeley growth data.
# First set up a basis system to hold the smooths
knots <- growth$age
norder <- 6
nbasis <- length(knots) + norder - 2
hgtbasis <- create.bspline.basis(range(knots), nbasis, norder, knots)
# Now smooth with a fourth-derivative penalty and a very small smoothing
# parameter
Lfdobj <- 4
lambda <- 1e-2
growfdPar <- fdPar(fd(matrix(0,nbasis,1), hgtbasis), Lfdobj, lambda)
hgtmfd <- smooth.basis(growth$age, growth$hgtm, growfdPar)$fd
hgtffd <- smooth.basis(growth$age, growth$hgtf, growfdPar)$fd
# Call tperm.fd
tres <- tperm.fd(hgtmfd,hgtffd)
par(oldpar)
Run the code above in your browser using DataLab