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

539 questions
Filter by
Sorted by
Tagged with
90 views

### Introductory material on splines

I am looking for a basic, step-by-step introduction into modelling with splines. (I have encountered splines while teaching another topic. The textbook I am using does not cover splines in sufficient ...
• 57.7k
18 views

### Restricted Cubic Splines with 3 knots

I have started studying cubic splines and I am confused. If I have 3 knots according to the theory I should have K-2 = 3-2 =1 polynomial. When I use the rms package in R there is indeed one polynomial....
• 79
16 views

### Understanding the estimated variance in the GAMM function

I have a small code snippet that I am providing below and I do not understand how the GAMM function from the mgcv package calculates the estimated variance. Here's the code snippet below, ...
• 411
1 vote
39 views

### Robust standard errors with splines

I realize that large changes in model results between using robust and non-robust standard errors can suggest a misspecified model. My case refers to using a Cox regression and I have experimented ...
• 335
15 views

### Hat matrix for penalized spline

Suppose the penalized spline given by equation $$\hat{x}=(W+\lambda_{1}D^{T}D+2\lambda_{2})^{-1}\left[Wy+\lambda_{2}(A+B)\right],$$ where $\lambda_{1},\lambda_{2}$ are positive constants and $A,B$ ...
• 101
1 vote
11 views

• 411
14 views

### How to numerically or manually compute bayesian confidence intervals for cubic spline?

I've been looking for ways to add 95% confidence interval to smoothing splines. There's a lot of packages from R that adds this (mostly based from G. Wahba's work which suggested Bayesian confidence ...
26 views

### Does using bs() to fit splines work with as.factor with geeglm?

I am running analyses of longitudinal health data. Each subject has two health measurements—one at age 60, and one at age 80. Subjects are marked as either "healthy" or "sick" at ...
• 41
66 views

### Logistic regression with GAM smoothing

I'm working through an example of using cubic spline regression for logistic regression classification from Elements of Statistical Learning  (Phoneme classification - Example 5.2.3 on page 148). ...
• 274
69 views

### Interpreting results of likelihood test in cox model comparison

I am utilizing a cox model for time to event analysis. I have a continuous predictor, that appeared to violate the linearity assumption. I then re-did my model with a spline function, and compared my ...
96 views

### Comparing AIC of Tensor Product Smooths versus Thin Plate Splines

I'm comparing the AIC of these two models. Tensor Product Smooth vs. Thin Plate Spline both fit using REML ...
• 540
1 vote
64 views

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

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 package in R and I ...
• 411
1 vote
107 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:...
• 35
57 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 ...
360 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
159 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 ...
• 688
72 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,173
263 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 ...
• 383
1 vote
196 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 ...
30 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
56 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
61 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
37 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 ...
97 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
135 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 ...
1 vote
40 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 ...
• 225
82 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) ...
• 196