# Questions tagged [splines]

Splines are flexible functions, knit together from polynomial parts, used for approximation or smoothing. This tag is for any kind of spline (eg, B-splines, regression splines, thin-plate splines, etc).

609 questions
Filter by
Sorted by
Tagged with
1 vote
23 views

14 views

75 views

### choice of m (order of derivative) for MGCV splines

I am working on a project that aims to estimate the association between a certain marker in blood and risk of an adverse cardiovascular outcome. Conventionally, a clinical threshold for the marker has ...
1 vote
10 views

### Can you tell me how the recursive computational spline basis functions of Computations for Splines (B-splines) can be used on natural cubic spline?

I'm more confused as to which $N(X)$ of the natural spline the recursively derived basis function corresponds to
13 views

### Doubts about Computations for Splines (B-splines) in The Elements of Statistical Learning

On page 186, the augmented knot $τ$ is used and it says that $τ$ takes all equal values and is equal to $ξ_0$ and $ξ_{K+1}$. Next, the definition of the basis function $B_{i,m}$ says that $x$ takes 1 ...
13 views

### Cubic spline with circular predictor [duplicate]

I have a set of observations $y_i$ for a set of values of the independent variable $x_i$. $x_i$ takes values of angles, so it is a circular variable. Is there some method to perform cubic splines or ...
1 vote
43 views

### Interaction between two splines in regression analysis

I am modelling differences between the risk of getting chronic kidney disease (CKD) between two groups, group A and B. I have very long follow-up time, approx. 30 years. The trouble is that CKD ...
1 vote
23 views

Papers I have read about p splines in multiple dimensions use some variation of the following idea. The spline is a surface $u(x_1, x_2)$ that that minimizes the objective function \sum w(u - u')^2 + ... 1 vote 0 answers 70 views ### Time varying coefficients with splines in Cox model I am wondering whether it is valid to fit spline interactions between time and predictor variables (either categorical or continuous) in a Cox model. I am having difficulties specifying this model, ... 2 votes 1 answer 148 views ### mgcv: Use of s() or te() with interactions in GAMs? I am trying to model CO2 fluxes (fco2) using a number of environmental parameters using a GAM in mgcv. Specifically, I have leaf temperature (tl), vapour pressure deficit (vpd), and soil water content ... 1 vote 1 answer 27 views ### Splines with a knot that varies by factor level I have data that reaches a peak then declines. While I might do this as segmented or spline regression, there is a complication. The position of the knot appears to differ depending on the level of a ... 0 votes 0 answers 7 views ### Selecting sparse number of predictors each derived from a non-sparse b-spline in time I have observations that I would like to model as responses at stations to slowly time-varying inputs at 80 candidate locations, few (perhaps 5-10?) of which are active and significant. I have ... 3 votes 0 answers 130 views ### Longitudinal RCT modeling of continuous time I have data from an intervention study (10 clinics, 5 control, 5 treatment). The outcome is counts, and we have monthly data at baseline, treatment active phase, and post treatment phase. The number ... 0 votes 1 answer 35 views ### How to construct cardinal spline bases I would like to know how to algebraically construct cardinal spline bases, as I would like to make a prediction with a natural cubic spline model which uses them; however, the only source I have found ... 0 votes 0 answers 55 views ### Restricted Cubic Spline-RCSPLINE macro I have to manually create basis functions for a variable but SAS doesn't seem to have a procedure to do it. I am using Frank Harrell's macro RCSPLINE but the basis variables are not identical to ... 0 votes 0 answers 23 views ### Adjusting splines for covariates I consider fitting cubic splines in R. Question: How can I include covariates in my spline model? The first few lines of my toy dataset are as follows ... 0 votes 0 answers 21 views ### What is the basis generally used in software for the natural cubic splines? Of course there are many natural cubic spline bases, but reading through documentation (mgcv, splines in R and patsy, scipy.interpolate and csaps in Python) sheds no light on which ones are used in ... 2 votes 1 answer 44 views ### Recovering nonlinear functional effects (in a GAM framework) using spline design matrices I designed a simulation example to understand how splines can work in modeling non-linear functional effects of covariates in a regression framework. I generated the data from the following model: $$... 1 vote 0 answers 97 views ### Non-linear model where the prediction is computationally fast I am looking for a fast model that can fit several predictors X to a non-linear response y. To show examples of the non-linearity of the response, I have generated the plots below by sampling ... 11 votes 4 answers 1k views ### Use of splines in parameter estimation The question here is about a passage in the very frequently (10,000+) cited paper by Storey and Tibshirani "Statistical significance for genomewide studies" (https://doi.org/10.1073/pnas.... 1 vote 1 answer 181 views ### Restricted Cubic Spline interpretation and missing estimate? I am running a RBS with 5 knots and I have 2 difficulties. I get only 5 estimates: 1 for the intercept, one for the linear term, and 3 for the knots. However, since I have 5 knots I should have 4 ... 0 votes 0 answers 39 views ### How are the TPRS functions estimated in GAM using the mgcv package in R? [duplicate] I have generated a dataset with two covariates x1 and x2 and have fitted a gam model with k=5. The R code is as follows: ... 1 vote 0 answers 158 views ### Reconstruct a natural cubic spline from its fitted coefficients Consider a predictor X that predicts a non-linear response y. A natural cubic spline with K knots can be fit to y. Several different linear basis expansions in X can be used to fit the ... 0 votes 0 answers 19 views ### Equation of a natural spline vs just a spline A spline of order r (with K knots) can be written as:$$f(x) = \sum_{i=0}^{r-1}\beta_i x^{i} + \sum_{j=1}^K b_j(x-\kappa_{j})^{r-1}_+A natural spline is defined as a spline that has order 2r ... 2 votes 0 answers 73 views ### How to compute P-splines penalties with Harville's algorithm? I am trying to understand how to actually implement the Harville-Fellner-Schall algorithm for the estimation of the P-splines penalties presented in Appendix E (Sec. E.2) of Marx and Eilers . Let ... 2 votes 0 answers 40 views ### How to use generalized additive models where all the functions to estimate are the same? I've this kind of equation that I'd like to estimate using R : t_i = \alpha_1 f(x_{1i}, y_{1i})+\alpha_2 f(x_{2i},y_{2i})+\epsilon_i. t_i \in [0,1]. \alpha_1 and \alpha_2 are known. I observe ... 0 votes 1 answer 93 views ### Regression splines- how to use them inside a model? First of all, apologies but my stats knowledge is limited and based on very isolated topics! From what I understand, regression splines are used when the covariates "aren't linear". What ... 1 vote 0 answers 58 views ### Natural Spline Interpolation in R [closed] I am trying to construct a natural cubic spline interpolation using R and test it with a Runge test function. I have implemented the following code; however, the interpolation is not passing through ... 5 votes 1 answer 212 views ### Spline basis explicitly including a linear term; basis functions generated by the default call to "s()" function of mgcv package I'm curious about the basis functions generated by the call to "s()" function with default parameter values, but even more specifically I'm curious about a smoother for a single variable ... 1 vote 0 answers 40 views ### Degrees of freedom in the npreg ss function I am using the ss function from the npreg package in R to fit a smoothing cubic spline to my data, where the smoothing parameter is selected by the REML method. The "equivalent degrees of freedom&... 0 votes 0 answers 33 views ### Interpreting cubic splines graph where plot doesn't go to final knot I have this plot where I found that the best degree of freedom is 8, as it minimizes the SSE when predicted from the training data. However, the graph does not go into the final 8th knot in the spline.... 0 votes 0 answers 56 views ### Optimising a piecewise polynomial model's objective function under constraints Consider a piecewise polynomial model, the model takes the form \begin{align} Y &= g(X)+\epsilon\\ &\approx \begin{cases} \alpha_0+\alpha_1X, & \text{if X<c}\\ \beta_0+\beta_1X, & ... 3 votes 1 answer 213 views ### Functional analysis in R with fda I'm working with time series data for drug response. And, I wanted to as is there are some alternative ways to analyse it since the FDA package in R is not working in my case. The type of my data is ... 1 vote 1 answer 350 views ### Presenting spline terms from a Cox model In the Survival vignette entitled "Spline terms in a Cox model" https://cran.r-project.org/web/packages/survival/vignettes/splines.pdf on page 3 there is this graph: The plot is showing the ... 2 votes 2 answers 312 views ### Linear spline and 'interaction' p value Wondering if someone can help clarify my intuition on this. Say you have a continuous covariate and a binary grouping variable and you introduce an interaction term between the two in a basic ... 1 vote 1 answer 191 views ### How to identify significant variables in a binary logistic regression? I am a beginner in statistics and R. I want to run a binary logistic regression to understanding (modeling) factors affecting nest-site selection in a bird species. I have Presence/Absence(0,1) data ... 2 votes 1 answer 430 views ### Restricted cubic spline looks like a linear curve, but p for nonlinear < 0.001 I am analyzing a association between a frailty index and care needs using the cox model. I use R and use rms package to fit restricted cubic spline. This is my R code. ... 0 votes 0 answers 47 views ### Identifiability of simple varying coefficient model I am working with this simple, bivariate varying coefficient model: d(x_i,y_i) = s(y_i)x_i + c(y_i) + o(x_i) + w_i, \qquad i=1,\ldots m,$where$x$and$y$are covariates,$d(x,y)$is a data ... 0 votes 0 answers 229 views ### Knots in splines method, ns and rcs in R [duplicate] Actually I want to use "ns" method but since I have a problem (Error in visualize splines logistic regression with ns) to visualize log odds with "ns" method I forced to use "... 2 votes 0 answers 33 views ### Approaches to (non-linear) meta-regression to estimate the conditional population distribution of$y\$ based on aggregate data

I want to estimate the distribution of a variable in certain subgroups of the population based on pooling of aggregate data reported in various observational studies. For simplicity, assume there is a ...