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
3
votes
1answer
27 views

One Hot Encoding of ranges of data vs. leaving data as is for Logistic Regression

Recently whilst doing an assignment using the PIMA Diabetes set I ran Logistic Regression using, amongst others: the age predictor as is segmented the age into ranges and applied OHE (with and ...
3
votes
2answers
42 views

Interpretation of Cubic Spline Coefficients in R

I am using the titanic_train data set in R to build a logistic regression model. ...
1
vote
1answer
28 views

Solution in case of violation of the linearity assumption in the logistic regression model? (possibly in R)

I have a problem with my logistic regression that I set up and I hope someone can help me. (I am working with R) My data is based on hourly values. The dependent variable is a dichotomous variable (1 ...
1
vote
0answers
23 views

Reference for spar parameter in R's implementation of the smoothing spline

In the R's implementation of the smoothing spline which is smooth.spline function, there is a parameter, called spar that ...
0
votes
2answers
47 views

How to model survival analysis when proportional hazards assumption is not met and stratification and time-varying are not possible?

I am modelling a survival analysis over a rather long follow-up period (10 years). My exposure is time-invariant and clearly violates the proportional hazards assumptions so Cox Proportional Hazards ...
1
vote
1answer
24 views

Assessing Logistic Regression and Determining if Splines Are Appropriate

I'm working on building a logistic model which will be used to estimate the probability that an account will skip on their monthly payment. My dataset roughly includes 50,000 observations with 15% of ...
0
votes
0answers
9 views

Plot pooled mixed lme model fit using cubic regression splines

I'd like to plot the following model: ...
0
votes
0answers
41 views

Restricted Cubic Splines - Test Non-linearity in SAS

In SAS, I am having a very difficult time performing a formal test of non-linearity for the effect of one continuous variable estimated using restricted cubic splines. Yes, I know this is easy to ...
0
votes
0answers
11 views

Smooth autocorrelation estimator

I have a univariate time series that exhibits what looks like a smooth slowly decaying autocorrelation function. The dataset size is huge (~1bln observations). If I subsample the data taking each ...
0
votes
0answers
49 views

Valid alternative to Box Tidwell method for Linear Regression [duplicate]

I am building a Logistic Regression model (in sklearn) and want to verify that the assumption regarding the linearity between X and the logit function is correct. I am using Python so am looking for ...
0
votes
1answer
39 views

How to interpret p values of a non-linear covariate using pspline in a coxph model

I tested the assumptions for Cox proportional hazards model on my time-to-event data. I found that the assumption of linearity between independent variables and model residuals is violated. After some ...
0
votes
0answers
9 views

Comparing coefficients of interaction terms for spline regression

Let me consider a simple splined model: $$Y=x_{-} +x_+ + q - 0.0001qx_{-} + 100 qx_{+}$$ I know that $q$ changes the slope much less for $x_{-}$ than for $x_{+}$. I want to say that when $q$ increases,...
0
votes
1answer
43 views

Manual Calculation for bs() Matrix in R

I am new in R and learning on constructing spline. I came across for bs() function in R and I understand that it creates matrix for b-spline matrix. I, however, still don't understand how the function ...
2
votes
2answers
39 views

How to estimate mean and variance for rate of change when I only have state data at different ages

I'll give you the intuition behind my problem first. I have data on whether children ($n \approx 200$) can read and their age in integers from 0 to 14. For each age, it is straightforward to ...
0
votes
0answers
26 views

Why would fitted B spline coefficients be better features for logistic regression?

I had this HW assignment for my high dimensional analysis course where we had tabular data of 6000 features and n samples and then there was a target column which was a class. The assignment was to ...
1
vote
1answer
33 views

Meaning of design matrix in context of Bayesian B-Spline regression?

I'm learning about modeling B-Splines using PyMC3. The design matrix of splines (apparently) can become quite complicated, so it's easier to delegate this construction to an API, Patsy. In the context ...
2
votes
1answer
46 views

Spline regression via PyMC3

I've looked through PyMC3 documentation and haven't seen any tutorials/resources on learning to use Splines w/ PyMC3. Could anyone recommend a resource? I see that Stan tutorials are available. I ...
1
vote
1answer
28 views

How to make predictions using smoothing splines

In ordinary least squares regression, for outcome vector $y$ and design matrix $X$ (full rank), the estimated coefficient values are $\hat{\beta} = (X^TX)^{-1}X^TY$. Given a new set of covariates $X_{...
0
votes
0answers
20 views

What is the name of this type of testing?

I am trying to find information on this type of testing but I don't know what it's called... I have 7 samples that I am using to interpolate over a geographic area using Spline. I am curious to the ...
0
votes
1answer
33 views

When should we use splines in regression? What's the justification?

I am examining the direct causal effect of x on y. Let's assume we a model as follows y ~ x Shows no significant effect of x on y. The reason may be that x ...
0
votes
0answers
37 views

R - Predict new $x$ using B-spline coefficients?

I have this R code that generates B-spline coefficients using 96 data points, so x = integers 1 = 96 and y are some numbers at each x. ...
0
votes
0answers
42 views

val.prob.ci.2 issue

I am trying to plot a calibration plot. There are 329443 observations, and I enter the following: ...
2
votes
1answer
39 views

mgcv: p-spline basis does not have local support

My understanding is that one of the attractive properties of the B-spline basis is that the individual basis functions have local support, i.e. it will be >0 on the interval between $d+2$ adjacent ...
1
vote
1answer
57 views

Calculate spline terms of a logistic regression using published knots and formula

I try to calculate spline terms of a logistic regression to generate a linear predictor/ prediction formula for the model "Lymph Node Involvement (Cores)" The source (https://www.mskcc.org/...
0
votes
0answers
10 views

How adjusting differs between non-splines and splines models?

Interested in the effect of X1 on Y Model without splines Y ~ X1 + X2 Model with splines Y ~ X1 + s(X2) I have noticed, that ...
1
vote
1answer
69 views

Natural splines degrees of freedom

I am reading ISL and found that fitting a cubic spline with $K$ knots uses $K+4$ degrees of freedom, since it estimates $K+4$ regression coefficients (p.273). However, in ESL they say that a natural ...
1
vote
1answer
38 views

Several short questions on non-linearity in multiple linear & logistic regression?

I have a few related questions that have been bugging me for quite a while regarding non-linearity in linear & logistic regression with multiple predictors. EDIT: I have since removed parts 3 and ...
1
vote
0answers
42 views

How to interpret a conditional smooths plot of a splines model?

Let's have simulated data higher weight should be associated with lower height in this data ...
0
votes
0answers
20 views

How is the smoothing spline penalty computed in practice?

I'm digging into smoothing splines and finding good resources, but no one talks about how to actually calculate the penalty $\int \hat{f}^{"}(x)^2 dx$ in the standard smoothing spline loss: Since <...
3
votes
1answer
61 views

AIC to determine optimal degrees of freedom for natural spline in GLMM?

Is it appropriate to use AIC to determine the optimal degrees of freedom for a natural spline? I have measured 200 animals at six points in time. My data look like below. ...
0
votes
0answers
17 views

How choose formula in the Generalized Additive Model using Thin Plate Splines?

I am using mgcv to train GAM. For example, suppose we have a Dataset with 3 Features: x, y and z. When should I use a Thin Plate Spline for each variable? When should I use a Thin Plate Spline with ...
1
vote
1answer
48 views

How do splines work when being used on the right side of an equation?

I have seen 2 ways of using splines: Spline as the primary model: Here, we use a spline to model y as a function of a single covariate x. That is, it is used as a regression model. The example in the ...
0
votes
1answer
136 views

ISLR splines - degrees of freedom confusion?

I'm working through the ISLR book and I am incredibly confused by question 9)d) of chapter 7. It uses the MASS::Boston dataset, and the question is as follows: Use ...
0
votes
0answers
29 views

Is it appropriate to interpolate a signal for frequency analysis?

From an experiment, I have (somewhat) irregularly sampled data. The aim is to find the dominant frequency of the signal. As I understand it, most methods for frequency analysis require evenly spaced ...
0
votes
0answers
21 views

How does truncated power basis function imposed the continuity constraint for each knot in splines

This was sort of answered in this post Truncated power basis function and continuity in b-splines Using high-enough powers in [truncated power][1] functions allows you to "match up" not ...
0
votes
0answers
33 views

How does $\vec{\beta}=(H^TH)^{-1}H^T\vec{y}$ equivalent to least squares criteria for evaluating splines? [duplicate]

I'm learning about splines and the equation for a spline trying to predict the true function given data points is expressed as $$f(x)=\sum^k_{m=1}\beta_mh_m(x)$$ Where $\beta_m$ is some linear ...
1
vote
0answers
18 views

Tensor product between an ispline and a bspline for fitting data that should be monotonic in one dimension

I'm not very familiar with the process for solving tensor product basis fittings. I've done some work with fitting an ispline basis with a non-negative-least-squares solver to fit a monotonic spline ...
2
votes
1answer
25 views

For B-spline what does $\sum_{i=0,n}N_{i,k}(t)=1$ mean?

For B-spline what does $\sum_{i=0,n}N_{i,k}(t)=1$ mean? I don't understand what this means cause $N_{i,k}(t)$ are basis functions so what does it mean for them to all sum up to 1?
0
votes
0answers
13 views

For B-Spline why $n+1 > k \ge 2$ and why is $t_{k-1} \le t \le t_{n+1}$

For B-Spline why $n+1 > k \ge 2$ and why is $t_{k-1} \le t \le t_{n+1}$ The general definition of B-Spline is $$P(t)=\sum_{i=0,n}N_{i,k}(t)P_i, t_{k-1} \le t \le t_{n+1}$$ Why can't k (the degree ...
0
votes
0answers
8 views

Q: Using splines just for adjusting a fixed level effect in a hierarchical model?

I am interested how the outcome variable differs between the regions. My model including "age" variable causes clearly amplified Y-variable conditional means. ...
3
votes
1answer
175 views

Given a truncated power basis function show that it represents a cubic spline for one knot

Given the truncated power basis function $$h_1(x)=1, h_2(x)=x, h_3(x)=x^2, h_4(x)=x^3, h_5(x)=(x-\epsilon)^3_+$$ Show that a function of the form $f(x)=\beta_0+\beta_1x+\beta_2x^2+\beta_3x^3+\beta(x-\...
7
votes
1answer
141 views

Linear Changepoint Model with LASSO

I was experimenting with time series data specifically using fourier basis functions and fitting with a LASSO. I then decided to try just connecting the first point with another point and that point ...
4
votes
2answers
204 views

“Spline fitting” in a piece-wise regression sense

I'm looking to better understand how a Octave built in function splinefit works. That itself is a wrapper around something on the MATLAB file exchange. As I ...
0
votes
0answers
185 views

Interaction with restricted cubic spline - comparison between SAS and R

When performing the same cox-regression in SAS and i R (including and interaction with a 3 knot restricted cubic spline), I receive different parameter estimates (i.e on age_spline 2). In my example ...
0
votes
0answers
19 views

How many splines in a cubic spline which has 10 knots?

How many splines in a cubic spline which has 10 knots? I'm confused with the term 'knots'. Are the edge points counted as knots? Even though they are not fastening two 3rd-order polynomial splines ...
1
vote
0answers
9 views

How to choose the equally spaced values for temperature variable in R? [closed]

I am learning a distributed lag non-linear model. In that, I have to create a cross basis matrix first. For cross-basis, I need to specify the knots at equally spaced values of the temperature ...
1
vote
0answers
26 views

R Function which computes 10-fold cross-validation MSE errors [closed]

There is some data I want to fit B-splines to and I already have a scheme for the location of the knots, but I want to use cross-validation to find the optimal number of knots. Is there any built-in R ...
2
votes
1answer
58 views

What does low rank smoother mean?

I read a paper on thin plate splines that stated several advantages. Thin plate splines: Do not rely on ’knots’ as many other spline methods do Are of isotropic character (i.e. unaffected by the ...
0
votes
0answers
13 views

What are the most likely reasons for convergence failure in back-fitting algorithm (GAM)?

I'm trying to build a binomial model using proc gam in SAS. When I include certain predictors as splines in the model , I get an error that the scoring algorithm ...
0
votes
1answer
53 views

newdata argument in prediction function for natural spline and smoothing spline

I am trying to plot a fitted spline with both ns() and smooth.spline() models. When I fit the spline I am unsure how I can set the newdata argument in the prediction function. For the ns() model, it ...

1
2 3 4 5
9