If I fit the following model to some data

m_splines <- lm(data$y ~ bs(data$x, df = 6))

how do I know how many knots have been used for the cubic spline?


closed as off-topic by kjetil b halvorsen, Peter Flom Mar 21 at 12:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – kjetil b halvorsen, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Did you look at the documentation for bs? $\endgroup$ – The Laconic Mar 21 at 12:09
  • $\begingroup$ I did, but I can't figure out what's the default value for the number of knots. $\endgroup$ – alessandro Mar 21 at 12:11
  • $\begingroup$ just found out that I can use attr(bs(data$x, df = 6),"knots") for the internal knots and attr(bs(data$x, df = 6),"Boundary.knots") for the boundary knots. $\endgroup$ – alessandro Mar 21 at 17:32

Browse other questions tagged or ask your own question.