[R-sig-ME] Natural spline (i.e. ns() ) with glmer()/lmer()
Lenth, Russell V
ru@@e||-|enth @end|ng |rom u|ow@@edu
Sat May 22 14:35:19 CEST 2021
Regardless of what kind of model is used, a natural cubic spline has two end conditions -- that the second derivative is zero at each end. If there are no interior knots, then that forces it to be a straight line. (Consider a cubic polynomial has four parameters, and we have imposed two constraints, reducing it to two parameters, the slope and the intercept).
With one interior knot, you do get two cubic polynomials, but with the condition that each end is an inflection point.
Russell V. Lenth - Professor Emeritus
Department of Statistics and Actuarial Science
The University of Iowa - Iowa City, IA 52242 USA
Voice (319)335-0712 (Dept. office) - FAX (319)335-3017
-----Original Message-----
Just a clarification, when I say "third degree polynomial" I mean, it generates a basis matrix for representing the family of piecewise-cubic splines with the specified sequence of interior knots, and the natural boundary conditions.
-----------
I would like to double check my understanding with the followings:
1 - In a linear mixed model if I use ns() for a continuous variable with for example one knot then I'll have two pieces of natural splines (i.e. third degree polynomial) one before the knot and one after the knot.
2 - But if I run the same ns() in a linear mixed model without any knots, does that mean I am fitting one 3rd degree polynomial between the boundaries (i.e. over the range of my continuous variable)?
Best,
Hedyeh Ahmadi, Ph.D.
Applied Statistician
Keck School of Medicine
Department of Preventive Medicine
University of Southern California
Postdoctoral Scholar
Institute for Interdisciplinary Salivary Bioscience Research (IISBR)
University of California, Irvine
More information about the R-sig-mixed-models
mailing list