I have some code and output, and I would like to construct a model. I don't know how to construct a model using this output:
require("splines")
x <- c(0.2, 0.23, 0.26, 0.29, 0.33, 0.46, 0.53 )
y <- c(0.211, 0.2026, 0.2034, 0.2167, 0.2177, 0.19225, 0.182)
fit <- lm(y ~ ns(x,3))
summary(fit)
Note that ns() generates the B-spline basis matrix for a natural cubic spline. Thus this model regresses y against a B-spline for x using three degrees of freedom. What would the equation for such a model look like?
R-centric way--and therefore belongs on SO--unless you explain whatnsdoes. (It's not even part ofR: what package does it come from?) – whuber Aug 16 '13 at 20:21ns()is part of the splines package. I recognize that this question is couched in R terms, but my opinion is that it's on-topic here. – gung - Reinstate Monica Aug 16 '13 at 20:34