Displaying 20 results from an estimated 2000 matches similar to: "Optimal knot locations for splines"
2009 Jan 17
2
DierckxSpline segfault
I've just encountered a segfault when using DierckxSpline::percur
function. Below is the minimal example which triggers the error:
---
library(DierckxSpline)
x <- 1:10
y <- rep(0, 10)
pspline <- percur(x, y)
---
*** caught segfault ***
address (nil), cause 'memory not mapped'
Traceback:
1: .Fortran("percur", iopt = as.integer(iopt), m = as.integer(m),
x =
2024 Jul 09
1
Automatic Knot selection in Piecewise linear splines
How can I do automatic knot selection while fitting piecewise linear
splines to two variables x and y? Which package to use to do it simply? I
also want to visualize the splines (and the scatter plot) with a graph.
Anupam
[[alternative HTML version deleted]]
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
>>>>> Anupam Tyagi
>>>>> on Tue, 9 Jul 2024 16:16:43 +0530 writes:
> How can I do automatic knot selection while fitting piecewise linear
> splines to two variables x and y? Which package to use to do it simply? I
> also want to visualize the splines (and the scatter plot) with a graph.
> Anupam
NB: linear splines, i.e. piecewise
2024 Jul 26
1
Automatic Knot selection in Piecewise linear splines
dear all,
I apologize for my delay in replying you. Here my contribution, maybe
just for completeness:
Similar to "earth", "segmented" also fits piecewise linear relationships
with the number of breakpoints being selected by the AIC or BIC
(recommended).
#code (example and code from Martin Maechler previous email)
library(segmented)
o<-selgmented(y, ~x, Kmax=20,
2009 Apr 03
1
DierckxSpline fitting with different sets of y-values in one time
Dear "R" users,
I have a question about the Package DierckxSpline. I have tried to find the answer by myself but it didn't worked out.
I wondered if Dierckxspline can use different sets of y values in one time to fit a line with knot. I have different sets of Y values representing the same thing for different voxels (in an fmri image). I have already fitted the data in different
2006 Nov 15
1
splineDesign and not-a-knot conditions
Hi,
I would like to fit an (interpolating) spline to data where the
derivatives at the endpoints of the interval are nonzero, thus the
natural spline endpoint-specification does not make sense. Books (de
Boor, etc) suggest that in this case I use not-a-knot splines.
I know what not-a-knot splines are (so if I were solving for the
coefficients directly I knew how to do this), but I don't
2013 Feb 27
1
Finding the knots in a smoothing spline using nknots
Hi r-helpers.
Please forgive my ignorance, but I would like to plot a smoothing spline
(smooth.spline) from package "stats", and show the knots in the plot, and I
can't seem to figure out where smooth.spline has located the knots (when I
use nknots). Unfortunately, I don't know a lot about splines, but I know
that they provide me an easy way to estimate the location of local
2017 Jun 23
1
Piecewise continuous logistic regression with one knot
How can I fit a piecewise continuous logistic regression with a single free knot (i.e. the knot is not specified; the model produce an estimate of the value of the knot).
Thank you,
John
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
2010 Dec 23
2
Piece-wise continuous regression with one knot
Windows Vista
R 2.10 - I know it is old, I will update later today.
How might I perform a piece-wise linear regression where two linear segments are separated by a single knot? In addition to estimating the slopes of the two segments (or the slope in one segment and the difference between the slope of the first and second segment), I would like the analysis to select the optimum knot. My first
2010 Nov 17
1
where are my pspline knots?
Hi All,
I am trying to figure out how to get the position of the knots in a pspline used in a cox model.
my.model = coxph(Surv(agein, ageout, status) ~ pspline(x), mydata) # x being continuous
How do I find out where the knot of the spline are? I would like to know to figure out how many cases are there between each knot.
Best,
Federico
--
Federico C. F. Calboli
Department of Epidemiology
2003 May 08
2
natural splines
Apologies if this is this too obscure for R-help.
In package splines, ns(x,,knots,intercept=TRUE) produces an n by K+2
matrix N, the values of K+2 basis functions for the natural splines with K
(internal) knots, evaluated at x. It does this by first generating an
n by K+4 matrix B of unconstrained splines, then postmultiplying B by
H, a K+4 by K+2 representation of the nullspace of C (2 by K+4),
2002 May 02
1
splines
I've got a problem with the R function spline.des.
I use the following arguments:
x_seq(0,1,length=200)
knot_quantile(x,(1:8)/9)
ord_3
k_sort(c(rep(range(x),ord,knot)))
derivs_rep(2,200)
When I do spline.des(k,x,ord,derivs)$design on Splus and on R, I don't
have the same results.
However, if I take an order ord=4 (ie a spline of degree 3), then, I
have the same
2009 Oct 23
2
interpretation of RCS 'coefs' and 'knots'
Hi,
I have fit a series of ols() models, by group, in this manner:
l <- ols(y ~ rcs(x, 4))
... where the series of 'x' values in each group is the same, however knots
are not always identical between groups. The result is a table of 'coefs'
derived from the ols objects, by group:
group Intercept top top' top''
1 6.864 0.01 2.241 -2.65
2011 Jun 08
1
predict with model (rms package)
Dear R-help,
In the rms package, I have fitted an ols model with a variable
represented as a restricted cubic spline, with the knot locations
specified as a previously defined vector. When I save the model object
and open it in another workspace which does not contain the vector of
knot locations, I get an error message if I try to predict with that
model. This also happens if only one workspace
2010 Jun 11
1
Documentation of B-spline function
Goodmorning,
This is a documentation related question about the B-spline function in R.
In the help file it is stated that:
"df degrees of freedom; one can specify df rather than knots; bs() then chooses df-degree-1 knots at suitable quantiles of x (which will ignore missing values)."
So if one were to specify a spline with 6 degrees of freedom (and no intercept) then a basis
2012 Jan 16
0
choosing a proper knot in GAM mgcv package
hi
I want to choose proper knot for the following formula
formula = y~ s(x1) + s(x2) + s(x3) + s(x4) + s(x5) + s(x6) +s(x7) + s(x8)
gam(fromula,data=dat)
if i run the error is
Error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
A term has fewer unique covariate combinations than specified maximum
degrees of freedom
how to find k and rectify this error
-----
Thanks in
2005 Feb 24
2
a question about function eval()
Hi,
I have a question about the usage of eval(). Wonder if any experienced user can help me out of it.
I use eval() in the following function:
semireg.pwl <- function(coef.s=rnorm(1),coef.a=rnorm(1),knots.pos=knots.x,knots.ini.val=knots.val){
knotn <- length(knots.pos)
def.par.env <- sys.frame(1)
print(def.par.env)
print(environment(coef.s))
tg <- eval( (parse(text=
2009 Nov 05
1
Simulate data for spline/piecewise regression model
Dear All,
I am trying to simulate data for a spline/piecewise regression model. I am missing something fundamental in my simulation procedure because when I try to fit my simulated data using the Gauss-Newton method in SAS, I am getting some wacky parameter estimates. Can anyone please check my simulation code and tell me what mistake I am making in generating data for spline model?
Thank you
2010 May 24
1
finding the best cubic spline fitting
Hi,
I am trying to fit cubic spline to a data on mortality rate by age and year
(1900-2008). The data is noisy and hence I would like to smooth using spline
and also extrapolate beyond 2008. Data from 1900 to 1948 are very unreliable
while data from 1948 to 2008 are reliable. I would like to have a higher
weight for data between 1948 to 2008. I am not sure how to do this. When I
smooth data from
2009 Oct 13
2
How to choose a proper smoothing spline in GAM of mgcv package?
Hi, there,
I have 5 datasets. I would like to choose a basis spline with same knots in
GAM function in order to obtain same basis function for 5 datasets.
Moreover, the basis spline is used to for an interaction of two covarites.
I used "cr" in one covariate, but it can only smooth w.r.t 1 covariate. Can
anyone give me some suggestion about how to choose a proper smoothing spline