Skip to main content

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

B-Splines in KANs: How Are They Implemented?

Can someone help me understand how Kolmogorov-Arnold Networks (KANs) make use of B-splines? They talk about spline grids in the paper without explicitly defining what they mean by it AFAIK. For ...
Transcendental's user avatar
0 votes
0 answers
16 views

How do B-splines differ from Fourier transforms?

I read that B-splines can be used as activation functions in KAN neural networks, whereas Fourier transforms are not widely used. Can someone please explain the difference between the two in a simple ...
Hughie Phan's user avatar
2 votes
2 answers
48 views

Compare residuals of B-cubic spline fit of two groups

I have two groups, A and B. I perform multiple measurements of the response, amplitude versus time. For the group A and the group B. The response is non-linear; therefore, I perform a Cubic B-spline ...
JrV's user avatar
  • 21
1 vote
1 answer
73 views

GAM: Smooth and factor interaction

I am currently working on a GAM. It includes a smooth-factor interaction. I am trying to decide which function is the one I need. ...
Laura's user avatar
  • 49
1 vote
1 answer
142 views

Regression spline for time to allow for slope changes

Suppose we have a regression / survival model where we would like to model follow-up time using a regression spline. Follow-up time has two phases (first treatment active, and second treatment ...
user167591's user avatar
1 vote
1 answer
46 views

Can you use a percentage as the dependent variable in general additive models?

This is more a general question about statistical modeling rather than a project specific question. Can the dependent variable be a percentage in a generalized additive model (GAM)? Is there a ...
DaniH's user avatar
  • 45
3 votes
1 answer
60 views

Proving that a natural cubic spline optimizes a smoothing problem

The GAM book by Hastie and Tibshirani 1990 claims that the natural cubic spline is the function $f$ which minimizes the least squares objective $$ \sum_{i=1}^n(y_i-f(x_i))^2 +\lambda\int_a^b f''(t)^...
Maverick Meerkat's user avatar
2 votes
1 answer
27 views

Incorporating site-level random-effects and 2-dimensional spline of coordinates in a GAM in R

When building a Generalized Additive Model model using gam() from the mgcv package in R, one ...
geoscience123's user avatar
5 votes
0 answers
44 views

How to test if change-point in b-spline is statistically significant?

I'm interested in testing if the difference between 2 slopes one either side of a knot is statistically significant. Ignoring the model assumption violations with this example, how would one see if ...
Nate's user avatar
  • 1,653
0 votes
0 answers
14 views

What should I do with RCS after finding non-linearity in a cox model

Hi I am conducting cox regression analysis. I found out with RCS macro on SAS that our variable 'systolic bp' has non-linearity issue. So, in this case how should I report the results? Our main ...
minkim's user avatar
  • 1
0 votes
0 answers
13 views

Cubic splines for Cox models

I have a question about cubic splines. I want to be sure that I understood correctly. When I perform a Cox model with proportional hazards, if I insert continous variables in the model I have to check ...
user99751's user avatar
  • 179
14 votes
4 answers
742 views

Cubic splines in Cox model

I have a question about the cubic splines used in the Cox model to test the linearity for the continuous variables. I read that usually the knots chosen are the quantiles. Can you find different ...
user99751's user avatar
  • 179
1 vote
1 answer
53 views

Visualizing restricted cubic splines in glm.nb

I am trying to visualize the relationship between a continuous variable ("marker") and a count variable ("count") using a negative binomial regression with a restricted cubic ...
Fabian's user avatar
  • 61
1 vote
1 answer
27 views

Different time trends of groups: quadratic vs. linear decline

Suppose we have two groups of individuals A and B that we observe over time on a parameter, say blood pressure. We want to compare the group effect over time in a GLMM using ...
a.henrietty's user avatar
0 votes
0 answers
15 views

How to determine the degrees of freedom and construct the basis functions for natural quadratic spline or other ones except for natural cubic spline?

From the Chapter 5 of ESL (The Elements of Statistical Learning), we know a degree-$d$ spline or an order-$M$ spline ($M=d+1$) with $K$ knots $\xi_i, i=1,2,...,K$ has $K+d+1$ degrees of freedom, ...
John Stone's user avatar
0 votes
0 answers
17 views

splines: uniform knot positions

Suppose we have 8 uniformly distributed interpolation points x = 1 2 3 4 5 6 7 8 and want to define a bspline curve of order k=5, hence the knot vector has 8+5=13 ...
Simon's user avatar
  • 133
0 votes
0 answers
17 views

Non-linear effects (rc splines) in competing risk regression

I use the {tidycmprsk} package to fit competing risk regression models (death/transplantation as competing risk). E.g.: ...
sjg's user avatar
  • 33
0 votes
0 answers
27 views

Formula to inverse a function of integral-splines

I have a function Y = constant + Beta I-Spline(X). All the Beta are > 0, and I use i-splines (integral of M-spline), which guarantees that f(X) = beta*I-Spline(X) is strictly increasing in X. I ...
G. Ander's user avatar
  • 177
0 votes
1 answer
67 views

Reporting of Cox model w/ restr. cubic splines

I'm new in fitting multivariable Cox models w/ restricted cubic splines. This is my code: ...
sjg's user avatar
  • 33
0 votes
1 answer
33 views

Is it possible to model a continuous variable using a linear spline with one knot located at two different place according to a categorical variable?

I’m trying to understand what there is behind an equations currently used to estimate glomerular filtration rate (GFR). This equation was derived using linear regression where ln(GFR) was modelled ...
Paolo Tolomeo's user avatar
1 vote
0 answers
67 views

How to convert B-Spline to piecewise polynomials?

Suppose I have a basis spline $$ S(x) = \sum\limits_i N_{i,k} a_i $$ defined on the interval $x \in [a,b]$ with control points $a_i$, degree $k$. $N_i$ are the basis spline functions. The knot vector ...
Simon's user avatar
  • 133
1 vote
2 answers
44 views

How to find X value for slope of zero from a natural cubic spline in RStudio [closed]

I have a scatter plot that I've fitted with a natural cubic spline with 4 knots using ns(), pictured below: I would like to find the value of x where the slope is zero at the abline pictured below: ...
lilleyb's user avatar
  • 13
0 votes
0 answers
39 views

Fitting a (logistic) generalized additive model with pygam in Python

I am trying to fit a (logistic) Generalized Additive Model with the pygam package. I am given $d$ features $\mathbf{X} \in \mathbb{R}^{3}$ and want to fit a Generalized Additive Model. Question 1: ...
A_Mondial's user avatar
0 votes
0 answers
22 views

How to determine how many knots and where to place them in a data set

I am working with the Boston data set and I want to graph age and medv in this dataset and then determine the number of knots that would best fit between this data and also what they are. I am not too ...
user avatar
1 vote
1 answer
53 views

mgcv GAM identifiability constraints

When fitting GAMs in mgcv package in R using smooth function, an identifiability constraint is typically imposed, such that smooth function should sum to zero (thus, addition of the main effect is ...
NeuroPanda's user avatar
2 votes
1 answer
55 views

How to interpret the plots of smooths from a GAM object

I am reading a text which is trying to demonstrate that enabling the select = TRUE option in the GAM function doesn't get rid of all the non-significant variables ...
Actuarial_student's user avatar
6 votes
3 answers
487 views

Understanding spline transformation and regression coefficients

I do not understand properly what a spline does even in a simple situation of a piecewise regression, and I need some help. Consider the following basic example: ...
denis's user avatar
  • 201
5 votes
1 answer
118 views

Order of derivative for MGCV splines and low EDF

I'm following up on the informative discussion here concerning choice of m (order of derivative) for MGCV splines. Using the default options in MGCV (thin plate spline, REML for optimization, k=10, ...
dean's user avatar
  • 455
0 votes
1 answer
40 views

How to construct an optimal spline model when two continuous independent variables are included

I am interested in evaluating the relationship between age, BMI and lipid level. The lipid level is an outcome in my study. I think that the relationship between lipid level and age and the ...
Totti's user avatar
  • 35
1 vote
0 answers
216 views

How does Multivariate Adaptive Regression Splines (MARS) consider the minimum number of observations between knots in the forward pass?

I try to explain my question with a simple example. Let's say we have two variables $x_1$ and $x_2$. At the first two stages of the forward pass, effects of $x_1$ with a knot at $a_1$ and $x_2$ with a ...
Shahin Roshani's user avatar
0 votes
0 answers
34 views

Determining inflection point/ threshold values from a Cox regression using cubic splines

I am interested in looking at the impact of time to diagnosis of cancer on death. I will be modelling time to dx as a continuous predictor using cubic splines. I am also interested in determining a ...
user405452's user avatar
0 votes
0 answers
19 views

How to numerically fit an adaptive composite bezier curve?

Given a set of points $X$ that define a smoothly varying curve $y$ that describe a highly sampled smoothly varying time series I would like to fit some bezier curve sections to the data to effectively ...
Goods's user avatar
  • 173
4 votes
1 answer
82 views

Test if two curves have the same shape

I have a gene expression measured for 5 humans (7 different layers each: L1, L2, L3, L4, L5, L6, WM) and 4 chimpanzee (7 different layers each: L1, L2, L3, L4, L5, L6, WM). What I want to do is to ...
Claptar's user avatar
  • 169
1 vote
1 answer
124 views

How do interactions between multiple spline terms for different variables work in lme4? Is my approach/syntax valid?

I am currently analyzing a dataset from an experiment I ran in which I investigated the effects of different tone combinations on frog calling responses. Each stimulus presented to the frog was a ...
Larterretral's user avatar
5 votes
2 answers
132 views

Why are linear and spline term estimates so different?

I am working on modelling in an epidemiological setting. I want to estimate the association between an exposure (air pollution) and two event outcomes. To achieve that, I am using a Cox PH model with ...
jmarkov's user avatar
  • 683
5 votes
3 answers
178 views

Proof that quadratic regression splines are continuous at the knots?

The title says it all. For more info: I have a dependent and independent variable $y$ and $X$. I want to fit a square spline on the data given a single knot $k$. I can do that by fitting 2 separate ...
PaulG's user avatar
  • 1,297
3 votes
1 answer
120 views

GAM(M): "Shape" vs "wiggliness"?

I'm currently going over how to interpret certain terms of a generalized additive mixed model (GAMM). I'm having a hard time differentiating between "shape" and "curvature". ...
Nate's user avatar
  • 1,653
0 votes
1 answer
45 views

Functional Data Analysis - minimum points per curve?

I am embarking on a project for which I'd like to use functional Data Analysis (FDA). I have several thousand discrete curves objects on which I'd like to fit continuous time curves. These discrete ...
s5s's user avatar
  • 685
2 votes
1 answer
246 views

2nd derivative of spline

This question has some similarities to a previous related question. How can I fit a spline to data that contains values and 1st/2nd derivatives? I went through the suggestions mentioned in that post, ...
Sundown Brownbear's user avatar
0 votes
1 answer
47 views

What does $(x_i - \xi_k)_+$ mean in this regression spline formula? [duplicate]

I have seen regression models with a continuous predictor fitted as a spline written like this: What is the meaning of the little "addition symbol" subscript that I have circled in red? Is ...
user167591's user avatar
3 votes
2 answers
108 views

Positive Semidefinite Kernel in RKHS

The following shows part of the page 170 of The Element of Statistical Learning that I want to make clear. The solution can be characterized in two equivalent ways $$\min_{c_j}\sum_{i=1}^N(y_i - \...
jason 1's user avatar
  • 311
13 votes
2 answers
1k views

Do fractional polynomials have any advantages over restricted cubic splines?

My understanding is that fractional polynomials and restricted cubic splines serve similar purposes. However, cubic splines are much more widely used outside statistics, and I have a better (...
Mohan's user avatar
  • 939
2 votes
1 answer
85 views

Regularization Problem and Reproducing Kernel Hilbert Space

The following shows part of the page 169 of The Element of Statistical Learning that I want to make clear. We have $$\min_{f \in \mathcal H_K}[\sum_{i = 1}^NL(y_i, f(x_i)) + \lambda\Vert f\Vert_{\...
jason 1's user avatar
  • 311
0 votes
0 answers
17 views

Knots in regression and the dummy variable trap

I am running a knot-like type of regression and have a couple of questions: Imagine that we are working with daily data that spans over $3$ years. Consider the following model: $y_t = \beta_{0, t} + ...
richard baws's user avatar
0 votes
0 answers
75 views

Why does a 1-knot spline regression have 3 coefficients?

I've been learning about spline regressions, and I'm trying out a statsmodels negative binomial spline regression as a changepoint detector for a time series of count data. I'm pretty confused about ...
BlueHarp's user avatar
  • 189
0 votes
0 answers
52 views

splines ns() identifiability

I would like to understand what are the identifiability constraints implemented by ns() in R. I know that common approaches are dropping intercept or some summation ...
GAMer's user avatar
  • 163
1 vote
0 answers
31 views

Hoe to choose a spline for expression data (mRNA and proteins)

I'm using timeOmics to model a time series of expression data on mRNA and proteins data. The amount of samples is rather small (7 groups, 2-7 samples per group) but the features space is rather large (...
Sebastian Hesse's user avatar
1 vote
1 answer
122 views

Knots selection testing for Natural Cubic Splines model in R

I have a dataset of Japan's Mortality rate and want to fit a natural cubic spline to this mortality data. The choice of knots are subjectively chosen at 10, 20, 30,...,90. I want to know whether or ...
JaFranke's user avatar
6 votes
1 answer
172 views

mgcv gam P-value vs plotted confidence intervals

I am trying to figure out how to explain the apparent discrepancy between P-values and plotted confidence intervals in mgcv. See for example the plot below that comes from a model that considers the ...
dean's user avatar
  • 455
3 votes
1 answer
169 views

Splines, logistic regression and sample size considerations

I have around 500 observations with a binary outcome at 25% prevalence and will be building an internally validated prediction model. I want to use splines to model non linearity in my continuous ...
blueberry's user avatar

1
2 3 4 5
13