Closed mclements closed 1 year ago
Thanks for bringing this to my attention! It is a great question.
I reviewed the paper and the code I wrote. In fact, I did the implementation before writing the paper. The arrangement of the H
matrix was purely for ease of coding. The resulting spline basis matrices from the code and the paper are different only in terms of the column arrangement and thus should be equivalent for modeling purposes.
I will update the underlying implementation so that it matches the paper. Thanks again for this issue.
Nice! I perhaps should have seen the column re-arrangement from the example -- although it was less obvious from the code.
Thank you for the prompt reply. You can close the issue:).
Great package.
As a possible bug report, I believe that
splines2::naturalSpline()
does not follow Equation (11) in the Appendix to https://doi.org/10.6339/21-JDS1020. Which is correct - the published formula or the implementation?I wrote some quick R code to re-implement
naturalSpline()
, including a flag to use thepublished
formula or, otherwise, to use the implementation innaturalSpline.h
:As a check,
naturalSpline2
andnaturalSpline
give similar answers whenpublished=FALSE
:However, the H matrix is very different from the form of the published formula and from my implementation of the published formula:
Is this a bug or a feature?
Sincerely, Mark.