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
2
votes
1answer
12 views

Categorical by continuous interaction, when does response differ between groups?

I have fit a 3-knot restricted cubic spline model to my data using the rms package in R with the following code: ...
1
vote
0answers
9 views

How to fit a curve to a dozen local and global minima and boundary data points?

I have a very sparse time series dataset that primarily consists of 3-12 local and global minimums and maximums as well as both boundary points. Is there a way I can fit a curve (preferably non-...
0
votes
0answers
21 views

Package brms (STAN): 3D-plot about tensor product interactions [closed]

I am using the 'brms' package to fit some Generalized Additive Models in R, through STAN. The package interfaces well with the 'mgcv' package, for fitting splines, and I was thinking about plotting ...
0
votes
0answers
36 views

How can I predict a new x using coefficient of B-spline basis functions?

I have a nonparametric regression problem using B-spline basis functions. The range of x is a vector as (350,370,390,410,430). I`ve obtained coefficients. How can I predict the value of response for x=...
0
votes
0answers
15 views

difference between pointwise and simultaneous confidence bands in Copula Regression Spline Model?

What is the difference between pointwise and simultaneous confidence bands in Copula Regression Spline Model? How to interpret them?
0
votes
1answer
16 views

Can I use Gls() or glmer() to predict binary outcomes with restricted cubic splines predictors?

I'm new to rms, as I read the rms book and notes, I saw that the Gls() function could be used to make a longitudinal growth ...
0
votes
0answers
14 views

How can I run Small Area Estimation with Penalized Spline Regression using mgcv R package?

I want to analyze some data using Small Area Estimation with Penalized Spline Regression. I just want to know if I can use mgcv R Package or another package which will ease me to do the analysis ? And ...
1
vote
1answer
44 views

Evaluating Functional Form in Cox Regression using rcs

I was approaching Cox regression and need to evaluate whether is more suitable to model my independent variable as a non-linear prediction of the outcome. Main questions is: How do I check whether or ...
0
votes
0answers
23 views

Derivative Penalties on Smoothing Splines

Suppose we have a curve $\hat{g}$ which is $$ \hat{g} = argmin_{g}\{\sum_{i=1}^{N}[y - g(x_i)]^2 + \lambda \int [g^{(m)}(t)]^2 dt \}, $$ where $g^{(m)}(t)$ is the $m$-th derivative of $g$ and $g^{(0)} ...
0
votes
0answers
42 views

Time Varying Coefficient Model with Uniform Kernel and Spline Estimator

I'm working on the BMACS data set data(BMACS) from library(npmlda). I'm looking at the the time-varying coefficient model of post-CD4 versus smoking $X_1$, pre-HIV CD4 percent $X_2$ (centered) and age ...
0
votes
0answers
15 views

Penalized Least Square in a Time Series

I'm working on going through a paper and I'm having a bit of an issue understanding some of the literature. With the following given background here's what the literature says, I am able to ...
0
votes
2answers
36 views

Allow for non-linear relationship between continuous independent variable and binary outcome in Cox regression

One thing that is not clear to me if how one can model non-linear relationship between continuous independent variables and binary outcome (i.e. dependent variable) in a Cox regression model. Suppose ...
2
votes
2answers
68 views

How to correctly use I-Splines for monotone non-decreasing/ increasing regression?

I have the following data to which I want to fit a monotone non-decreasing spline. ...
0
votes
0answers
52 views

Interpolation of Hessian matrix

I have a model where hessian matrices are calculated along a path. Since the calculation is done using finite differences, this is very time consuming. I have tried to calculate only every second ...
7
votes
1answer
93 views

GAM: Do shrinkage smooth splines also address for concurvity?

I have a gam model with automatic predictor selection based on cubic splines (bs = cr) and SELECT == T or shrinkage cubic splines (bs = cs) and SELECT == F. Now I'm wondering if predictors affected ...
0
votes
1answer
37 views

Understanding the output from coxph when used with pspline

When I run: res<-coxph(Surv(time_to,event)~pspline(covariate,df=3) ,data=a) I get: ...
14
votes
2answers
588 views

Is a spline interpolation considered to be a nonparametric model?

I am aware of the basic differences between nonparametric and parametric statistics. In parametric models, we assume the data follows a distribution and fit it onto it using a fixed number of ...
2
votes
1answer
113 views

Splines: relationship of knots, degree and degrees of freedom

Could one explain how these three parameters change the behaviour of this "wiggle curve" In particular, I am trying to understand b-splines and m-splines. My limited understanding is as ...
1
vote
1answer
32 views

How to calculate basis functions by hand

I am learning about natural splines and basis functions and am struggling with it a lot. I understand the concepts of knots being the part where first and second derivatives are equal on either side. ...
2
votes
1answer
90 views

Basis dimension (k) too low for the smooth term in a GAMM

I am running a generalized additive model (GAM), but when I check the model diagnostics (using gam.check()) I run into problems. I have tried adjusting the value ...
0
votes
0answers
36 views

Why is there a linear and non-linear component of a pspline?

I am trying to fit a cox proportional hazards model with several categorical and one continuous covariate. The plot of martingale's residuals from the null model against the continuous term suggests ...
1
vote
0answers
67 views

Meta-analysis of linear and non-linear associations: R2 as the “effect size”?

I have a question regarding meta-analysis of effect sizes of associations. I was wondering whether it is possible to compare results across studies that modelled the association between two variables &...
1
vote
2answers
112 views

How to show that smoothing spline fit preserves the local regression part of the fit

We need to show that a smoothing spline of $y_i$ to $x_i$ retains the local regression part of the fit. For linear regression, this problem seems trivial because it is relatively easy to move from $...
4
votes
1answer
55 views

Generalized additive models: What exactly is being penalized when using a P-spline smoother with $\texttt{mgcv}$?

Generalized additive models (GAMs) avoid overfitting by introducing a $\color{#D55E00}{\text{penalty term}}$ in the loss function: $$ ||\mathbf{y}-\mathbf{X\beta}||^{2} + \color{#D55E00}{\lambda\...
1
vote
0answers
22 views

Reference category and reporting of restricted cubic spline meta-regression output in metafor

I tried to fit a non-linear meta-regression model with a restricted cubic spline using the package "metafor" in R, as reported in here: https://www.metafor-project.org/doku.php/tips:...
7
votes
3answers
626 views

Why is my design matrix rank deficient? (modelling seasonal data with a cyclic spline)

I am trying to fit a hurdle model to seasonal data for which the day of the year is known. To this end, I tried to construct a spline with cyclic restrictions (ends meet beginnings). Here is a MWE ...
0
votes
0answers
24 views

Relation between the Naive Bayes Classifier and GAM

Problem: This problem is about establishing a connection between the Naive Bayes Classifier and GAM. Consider a classification problem with J classes. Let $f_j (X), X ∈ ℝ^p$, be a density function for ...
0
votes
0answers
44 views

Is it possible and reasonable to use AMEs for interpretation in a logistic regression even if the spline methodology is to be used?

Because of the linearity assumption of the logistic regression I have to use splines for my regression. I am now wondering if I should still use AMEs to extend the results? I am working with R. I know ...
0
votes
1answer
83 views

How do I interpret and analyze the estimates based on specified knots in restricted cubic spline?

First time asking here in CV. I'm trying to perform an adjusted linear regression with a 3-knot restricted cubic spline on R. The 3-knots are explicitly specified based on literature/discussions. A ...
3
votes
1answer
29 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
234 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
167 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
35 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
298 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
42 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
12 views

Plot pooled mixed lme model fit using cubic regression splines

I'd like to plot the following model: ...
0
votes
0answers
134 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
43 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
192 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
100 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
181 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
40 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
32 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
92 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 ...
3
votes
1answer
130 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
43 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
54 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
88 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. ...

1
2 3 4 5
10