similar to: How to generate natural cubic spline in R?

Displaying 20 results from an estimated 5000 matches similar to: "How to generate natural cubic spline in R?"

2012 Dec 01
3
cubic spline
Hallo, I'm facing a problem and I would really appreciate your support. I have to translate some Matalb code in R that I don't know very well but I would like to. I have to interpolate 5 point with a cubic spline function and then I expect my function returns the Y value as output a specific X value inside the evaluation range. Let's suppose that: 1- *X = [-10, -5, 0, 5, 10]* 2
2010 Apr 09
1
How to get the penalty matrix for natural cubic spline?
Hi, all I am trying to get the basis matrix and penalty matrix for natural cubic splines. In the "splines" package of R,"ns" can generate the B-spline basis matrix for a natural cubic spline. How can I get the basis matrix and penalty matrix for natural cubic spline. Thanks a lot! Lee [[alternative HTML version deleted]]
2006 Mar 17
1
Derivative of a splinefun function.
Is there a way of calculating the derivative of a function returned by splinefun()? Such a function is a cubic spline, whence it has a calculable derivative, but is there a (simple) way of getting at it? One workaround that I have thought of is to take a fine grid of points, evaluate the function returned by splinefun() at these points, put an interpolating spline through these points using
2002 Sep 09
1
Monotonic interpolation
Has anyone got a function for smooth monotonic interpolation of a univariate function? I'm after something like the NAG function PCHIM which does monotonic Hermite interpolation. Alternatively, montononic cubic spline interpolation. Please reply directly. Rob Hyndman ___________________________________________________ Rob J Hyndman Associate Professor & Director of Consulting
2009 Sep 24
1
basic cubic spline smoothing
Hello, I come from a non statistics background, but R is available to me, and I needed to test an implementation of smoothing spline that I have written in c++, so I would like to match the results with R (for my unit tests) I am following http://www.nabble.com/file/p25569553/SPLINES.PDF SPLINES.PDF where we have a list of points (xi, yi), the yi points are random such that: y_i = f(x_i) +
2004 Nov 10
2
cubic spline/smoother with nlme
Greetings, I would like to use a cubic spline or smoother to model the fixed effects within nlme. So far the only smoother I have been able to get to run successfully in nlme is smooth(). I tried smooth.spline: fixed=list(lKa~1,lCL~smooth.spline(BSA, df=3)) the error I got was the following. Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid
2013 Mar 06
1
Constrained cubic smoothing spline
Hello everone,            Anyone who knows how to force a cubic smoothing spline to pass through a particular point?            I found on website  someone said that we can use "cobs package" to force the spline pass through certain points or impose shape           constraints (increasing, decreasing). However,  this package is using  B-spline and can only do linear and quadratic
2005 May 02
2
Restricted cubic spline function ERROR?: glm(Y~rcs(x,5))
Dear all, Is the restricted cubic spline function working properly in the glm model? We used glm(y~rcs(x,5), family=binomial) but it seems that for some theoretical reasons the rcs, restricted cubic spline function can not be fitted by a glm function. Is this correct? Regards, Jan ((Originally, we used lrm(y~ rcs(x,5)) but we couldn't find how to derive the AIC value of the fitted model.
2011 May 04
1
natural cubic splines
Dear R-helpers, I need to fit natural cubic spline with specified number of knots. I expected 'splines' package will be helpful, but I am confused by its help. Is more detailed documentation available for it or could you recommend another R function? Best regards Ondrej Mikula
2009 Jul 09
1
splint
I am trying to understand idea for splint, but it use Fortran code. Does anyone know how to see that Fortran code? Is splint a not-knot spline method? Thanks, jfm [[alternative HTML version deleted]]
2008 Oct 10
1
how to evaluate a cubic Bezier curve (B-spline?) given the four control points
I'm trying to use R to determine the quality of a cubic Bezier curve approximation of an elliptical arc. I know the four control points and I want to compute (x,y) coordinates of many points on the curve. I can't find anything in either the base distribution or CRAN that does this; all the spline-related packages seem to be about *fitting* piecewise Bezier curves to a data set.
1998 May 25
2
RFC: spline / splinefun (etc) amalgamation
At present R has separate functions "spline" and "splinefun". The first of these carries out spline interpolation of a data set and returns the interpolated values; the second returns the interpolating function itself (approx and approxfun are similar). I would like to combine these into a single function "spline" with an (optional) argument which determines which
2013 Mar 11
1
Use pcls in "mgcv" package to achieve constrained cubic spline
Hello everyone,          Dr. wood told me that I can adapting his example to force cubic spline to pass through certain point.          I still have no idea how to achieve this. Suppose we want to force the cubic spline to pass (1,1), how can I achieve this by adapting the following code? # Penalized example: monotonic penalized regression spline ..... # Generate data from a monotonic truth.
2007 Oct 05
2
Splines
I want to fit a cubic spline of x on y. where : x [1] 467 468 460 460 450 432 419 420 423 423 y [1] 1 2 3 4 5 6 7 8 9 10 using the syntax spline(y, x) I got following output : $x [1] 1.000000 1.310345 1.620690 1.931034 2.241379 2.551724 2.862069 [8] 3.172414 3.482759 3.793103 4.103448 4.413793 4.724138 5.034483 [15] 5.344828 5.655172
2011 Oct 11
1
restricted cubic spline within survfit.cph in the package rms
Hello,   does anyone have an example on how to use restricted cubic splines function rcs within survfit.cph, if cph (Cox Proportional Hazard Regression) was done with restricted cubic splines (which I made to work)? Thank you. > [[alternative HTML version deleted]]
2010 May 14
1
Cubic B-spline, how to numerically integrate?
(corrected version of previous posting) I fit a GAM to turtle growth data following methods in Limpus & Chaloupka 1997 (http://www.int-res.com/articles/meps/149/m149p023.pdf). I want to obtain figures similar to Fig 3 c & f in Limpus & Chaloupka (1997), which according to the figure legend are "expected size-at-age functions" obtained by numerically integrating
2007 May 21
2
comparing fit of cubic spline
I want to compare the fit of a quadratic model to continuous data, with that of a cubic spline fit. Is there a way of computing AIC from for e.g. a GAM with a smoothing spine, and comparing this to AIC from a quadratic model? Cheers ****************************************** Tom Reed PhD Student Institute of Evolutionary Biology 102 Ashworth Laboratories Kings Buildings University of
2011 Aug 06
1
How to estimate confidential intervals for the derivatives of cubic smoothing spline
Dear all, I want to use smooth.spline to construct a cubic smoothing spline and its first derivative to my data. However, the predict.smooth.spline does not seem to provide a SE for both the fitted values and their derivatives. How should I calculate it? Thank you very much, Bingzhang
2000 Sep 04
2
bug in spline()? (PR#653)
BUG IN SPLINE()? Version R-1.0.1, system i486,linux If the spline(x,y,method="natural") function is given values outside the range of the data, it does not give a warning. Moreover, the extrapolated value reported is not the ordinate of the natural spline defined by (x,y). Example. Let x <- c(2,5,8,10) and y <- c(1.2266,-1.7606,-0.5051,1.0390). Then interpolate/extrapolate with
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