# 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).

512 questions
Filter by
Sorted by
Tagged with
6 views

### How to extract the penalty term from the GAMM function in R and what is used to estimate the penalty terms

Good afternoon all, I'm working on some log GDP data and I am testing out a Generalized Additive Mixed Model for it with a penalized cubic regression spline. I am using the GAMM function from the mgcv ...
• 167
1 vote
43 views

### Confirming cubic spline was done on imputed datasets (imputed by mice Package) and the estimate is the pooled based on Rubin's rule

I am performing restricted cubic spline (Cox proportional hazard ratio) after imputing 10 datasets using mice package. My variables as follow: Outcome: DM Exposure: BMI time to events: time Covariates:...
• 25
30 views

### Lspline and bs produce very different coefficients for linear splines - which is preferred?

In the vignette for the lspline package in R it says that the package computes Linear splines with convenient parametrisations ...
344 views

### Motivating use of Bayesian splines in excess mortality estimation

I'm reading this paper estimating excess deaths induced by the pandemic. That is, roughly, it constructs a model to estimate how many deaths (from all causes) would have occurred if the pandemic had ...
1 vote
33 views

### How to fit piecewise linear splines or natural cubic splines in mgcv

How do GAMs generate forecasts that are outside the range of the training data? I often need to use regression models for extrapolated forecasts, where the values of the predictors are outside their ...
• 658
67 views

### Determining spline basis dimension using Wood's statistical test

In Simon Wood's book Generalized Additive Models (2nd ed.) on page 243, he describes the following procedure for checking that the basis dimension is too small: Fortunately informal checking that the ...
• 1,023
35 views

### How to set the number of knots in a regression spline

I want to fit fit a cubic regression spline and select the optimal number of knots via grid search. In other words, I want to find the optimal number of knots that minimizes the average test Mean ...
• 341
1 vote
41 views

### How to create a B-spline basis without intercept and linear trend included?

I want to fit the following model using splines: \begin{align} Y(t) = \beta_0 + \beta_1t + \sum_{j=2}^{d} \beta_jB(t)_j \end{align} where $B_j$ are the basis functions. However, when I run the ...
13 views

### Selecting characteristics for prediction of stock returns (Adaptive Group Lasso in R)

In attempt to find out what drives the predictive power and not the explanatory power of cross sections of expected return. We attempt to split the characteristics of stocks in quadratic splines, ...
1 vote
32 views

### Advice on use of survival vs logistic model

I have a longitudinal dataset from a medical registry where every subject has a certain medical condition. Periodically, each subject is checked for a specific outcome (yes, no) of interest. I have ...
1 vote
33 views

### Interpretion natural spline function ov IV in ordinal regression

I know that this question was already posed several times but I am not sure If I really got the interpretation for spline functions right. I have an ordered model that is regressed on an index ranging ...
• 19
29 views

### GAM - setting K-values before or after testing the different models

I'm working with GAM and I'm testing different models with and without certain variables, and I need to set k-values for the different smoothers. Do I need to use the exact same k-values prior to ...
64 views

### Should you include time as a continuous predictor when estimating incidence or prevalence?

Suppose one has a time series of disease counts and populations (at risk, total etc.) or, equivalently, binary events of disease status. Then suppose one wanted to present estimates of incidence or ...
1 vote
65 views

### What is a GAM; question about sklearn's SplineTransformer

From my understanding, using basis-spline feature expansion/transformation with fixed parameters (number and placement of knots, etc.), then feeding that into a linear/logistic regression is ...
23 views

### Missing Data with Splines

I am modeling data with a gamma response. Two continuous variables in my data set are nonlinear and have a large number of nulls. One option I see is to bin/discretize the variables where the nulls ...
• 185
37 views

### Combining quantile regression with binning

I'm trying to employ a framework where I uncover the marginal effects of the quantiles of one continuous variable on another continuous variable - something analogous to the Quantile-on-quantile (QQR) ...
• 186
99 views

### Splines feature selection

I remember reading that for a certain kind of splines, all basis functions have to be included when using feature selection methods such as stepwise regression or shrinkage. The argument for that was ...
• 43
8 views

### How to understand the center constraint in spline regression?

Assume that I have a basic understanding of the basis spline functions, basis spline regression, natural spline regression. Then, how should I understand the center constraint in the natural spline?
1 vote
38 views

### Spline model with a constant

I'm working on a reproduction of a model and I am running into some issues with the wording of the model and implementing it into R. The model that I am working with is an Additive AutoRegressive ...
• 167
79 views

### How to perform Restricted cubic spline (Cox adjusted) after multiple imputation with mice?

Hello I would like to perform restricted cubic spline (Cox adjusted) after multiple imputation with mice.I use rms package. but after imputation when I use the function ...
• 25
49 views

### How well do Multivariate Adaptive Regression Splines work in high dimensional settings?

I have been reading the Hastie and Tibshirani book again lately, and I noticed in Chapter 9 that the mention the MARS algorithm: Multivariate Adaptive Regression Splines, which is a nonparametric ...
• 1,118
49 views

### R: smooth.spline LOOCV-error depends on order?

I wanted to fit a smoothing spline to some data and I noticed that the internally computed LOOCV-error seems to depend on whether the data is unordered or not. Concretely, I only get the expected ...
• 163
115 views

### Can I interpret coefficients for "Year" as differences between years that are not explained by my predictors?

I am doing statistical analysis of a natural experiment that consists of multiple years of measurements. I have two independent variables that are physically related to ...
• 259
49 views

### Splines free of Gibbs phenomenon for smoothing

I'm trying to do 3-dimensional smoothing of some observations we made. To simplify things, here's a visualisation of one slice of the data we have: Note that the observations are gridded and contain ...
• 122
45 views

### Can "Curve Fitting" be seen as an Alternative to Numerical Differentiation?

For a long time, the following point always confused me: If the "Fundamental Theorem of Calculus" tells us that all real and continuous functions are differentiable (i.e. have derivatives) - ...
• 5,728
18 views

### Difference between bspline and thin plate spline?

I am trying to understand the difference between bsplines and thin plate splines but I cannot find enough information after reading several papers and questions on CV. I would really appreciate if ...
• 876
646 views

### Ideal Use Cases for Splines

In general, I have often heard of "splines" being referred to as "old models", criticized for being prone to overfit the data, and being considered to be only better than "...
• 5,728
161 views

### Difference between splines from different packages (mgcv, rms etc.)

I recently came across the mgcv package and the great potentiality of GAM. One - maybe naive - question is what is the overall difference (if there is any which is significant) with the gam() function ...
• 578
35 views

### Convert truncated power basis representation to a B-spline basis representation

Given a cubic spline in a truncated power basis representation: $$f(x)=\beta_0+\beta_1x+\beta_2x^2+\beta_3x^3+\sum_{i=1}^n\beta_{i+3}(x-t_i)_+^3,$$ where $t_1\leq t_2\leq\cdots\leq t_n$ are fixed ...
• 31
78 views

### Is Spline Interpolation suitable for Economic Data

I have GDP data recorded in quarterly and I wish to interpolate it for monthly data. Is the Spline Interpolation suitable for these type of economic data?
• 141
59 views

### Concept Clarification: Logistic Regression Assumption

Here is one of the assumptions under logistic regression: logistic regression assumes linearity of independent variables and log odds. I understand if this assumption is violated, we can then ...
• 311
138 views

### Restricted Cubic Spline Function Summary Intepretation

I am trying to incorporate spline transformation into my logistic regression and finally piece together the following (working) R code (pls see it below). However, I have no idea how to interpret this ...
• 311
101 views

### How to predict ln(odds) with rcs term in mixed effects logistic model?

I am using "lme4" package to fit mixed-effects nonlinear logistic model to access the association of Y and X. As the response variable of my data is binary and nlmer function requires ...
175 views

### Spline-transform regression - concept clarification

I am learning spline transformation and am confused about several concepts. Any guidance is all appreciated! Am I understanding this correctly: I should only spline-transform my continuous predictors ...
• 311
87 views

### Data transformation prior to the logistic/linear regression model

I am currently working on regression models and am unsure whether we should transform the data. From what I learned, it is recommended that we should: transform the continuous predictors (e.g. log-...
• 311
47 views

### What is the best spline smoother to use with spatial data in a GAM?

I am running a GAM and need to account for spatial autocorrelation. I have done this by including "s(easting,northing, bs="gp")". I was wondering if gaussian was the best spline ...
35 views

### Linear mixed models natural splines plotting regression

Eventually I want to use joint modeling. For this, I need to fit a linear mixed model on the biomarker trajectory, with a random slope and intercept for study ID. I want to use natural splines with ...
52 views

### Poor Bspline estimation for variables with short range

I am recently surprised to observe a fact that, in a simple univariate regression model, the Bspline estimator performs NOT well if the range of the variable is narrow. Namely, let's consider ...
• 122
32 views

• 113
122 views

### Spline regression for binary dependent variables

I am trying to analyze the relationship between a discrete quantitative independent variable and a binary qualitative dependent variable. My hypothesis is that higher levels of the predictor promotes ...
• 121
41 views

### How to Interpret Results of Natural Spline Regression in R

I am very new to stats and R, and I'm trying to learn how to do a natural spline multiple regression model. I am using the mpg dataset. My code looks like this: ...
4k views

### Why is the use of high order polynomials for regression discouraged?

I've read many times on this site that high order polynomials (generally more than third) shouldn't be used in linear regression, unless there is a substantial justification to do so. I understand the ...
1 vote
190 views

### GAM Model: how can i fit GAM Model for daily count variable in the time-series dataset?

![enter image description here][1] I am trying to apply GAM Model on one Health Claims Dataset (from 2007 to 2018), trying to find the association between daily hospital admissions of heart diseases) ...
• 37
1 vote
104 views

### Possible non-linearity pspline Cox model

Our working group ran a Cox regression with a p-spline to model the possible non-linearity of continuous variables. However, I'm a bit confused with the interpretation of the linearity or non-...
• 606