makess(x, y, xfun, yfun)
x
prior to fitting.y
prior to fitting.smooth.spline
with the extra component apv
, a length-2 vector containing the age at peak velocity and peak velocity. If no peak is identified (based on the 2nd derivative changing sign) the values are for maximum rather than peak velocity.## create smooth.spline mean height curve
data(heights)
ss <- with(heights, makess(age, height))
## and plot it
plot(ss, type='l', xlab='age', ylab='height')
## age at peak velocity, and peak velocity
print(ss$apv)
Run the code above in your browser using DataLab