Displaying 20 results from an estimated 1443 matches for "splines".
2008 Dec 07
1
custom panel help in lattice
Hi,
I am having an issue with a custom panel for lattice. The problem
comes when I try passing a groups argument.
Here is the custom panel, a wrapper for smooth spline. I copied
panel.loess and replaced the loess arguments with smooth.spline().
[Note: I would like to use the cross-validation fitting properties of
smooth.spline.]
library(lattice)
2003 Aug 14
2
Using spline parameters to generate data
# I need to generate some data. I'm modeling some time series that follow
a
# negative exponential decay (mostly). I have 20 samples that can easily
be fit with cubic splines.
# What I want to do is generate many thousands of similar samples using
the parameters from the splines
# For instance one data sample looks not unlike this:
foo.curve <- 1 * exp(-0.01 * 1:500) + 0.5
ts.plot(foo.curve, lwd = 2)
# Another sample looks not unlike this:
foo.curve2 <- 0.9 * e...
2011 Sep 20
2
Multivariate spline regression and predicted values
Hello,
I am trying to estimate a multivariate regression of Y on X with
regression splines. Y is (nx1), and X is (nxd), with d>1. I assume the
data is generated by some unknown regression function f(X), as in Y =
f(X) + u, where u is some well-behaved regression error. I want to
estimate f(X) via regression splines (tensor product splines). Then, I
want to get the predicted values for...
2012 Jun 06
2
package zoo, function na.spline with option maxgap -> Error: attempt to apply non-function?
Hello,
I'm trying to use na.spline (package zoo) to fill some missing data in a time series.
this works fine, however, if I apply the 'maxgap' argument, I always get the error:
<------
Error in na.spline.vec(x., coredata(object.), xout = xout., ...) : attempt to apply non-function
------>
I couldn't find a similar error for this case in the mailing lists and zoo vignette,
2004 Jul 12
3
Smooth monotone estimation on R
Hi all,
I'm looking for smooth monotone estimation packages, preferably using splines.
I downloaded the 'cobs' package and intend to use it, but since it offers only quadratic splines based on L1 minimization, I'd like to compare its performance to that of a more 'mainstream' cubic-spline, L2-norm minimizing spline. Preferably a smoothing spline.
Does anyone kn...
2002 Feb 20
2
How to get the penalized log likelihood from smooth.spline()?
I use smooth.spline(x, y) in package modreg and I would like to get
value of penalized log likelihood and preferable also its two parts. To
make clear what I am asking for (and make sure that I am asking for the
right thing) I clarify my problem trying to use the same notation as in
help(smooth.spline):
I want to find the natural cubic spline f(x) such that
L(f) = \sum_{k=1}{n} w[k](y[k] -
2009 Mar 31
2
How to generate natural cubic spline in R?
Suppose I have two var x and y,now I want to fits a natural cubic
spline in x to y,at the same time create new var containing the
smoothed values of y. How can I get it?
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) + e_i
where e_i is normal with mean 0 and variance sigma_i^2
There is a smoothing parameter lambda between 0 and 1.
.when lambda is 0, smoothness is all that matters, and the fitting func...
2007 Jul 04
3
Problem/bug with smooth.spline and all.knots=T
Dear list,
if I do
smooth.spline(tmpSec, tmpT, all.knots=T)
with the attached data, I get this error-message:
Error in smooth.spline(tmpSec, tmpT, all.knots = T) :
smoothing parameter value too small
If I do
smooth.spline(tmpSec[-single arbitrary number], tmpT[-single arbitrary number], all.knots=T)
it works!
I just don't see it. It works for hundrets other datasets, but not for
2006 Jul 31
1
questions regarding spline functions
Greetings,
A couple general questions regarding the use of splines to interpolate depth
profile data.
Here is an example of a set of depths, with associated attributes for a given
soil profile, along with a function for calculating midpoints from a set of
soil horizon boundaries:
#calculate midpoints:
mid <- function(x) {
for( i in 1:length(x)) {
if( i &...
2000 Sep 04
2
bug in spline()? (PR#653)
...1:10 using
either
spline(x,y,n=10,method="natural",xmin=1,xmax=10)
or
fn <- splinefun(x,y,method="natural")
fn(1:10)
This gives c(2.5366,1.2266,-0.0834,...,1.0390). I agree with all values
except that at x=1. The interpolation formula in Green and Silverman's
book on splines gives the derivative of a natural spline at the first
knot as f'(x1)=(f2-f1)/(x2-x1) -(1/6)(x2-x1)d, where d=second derivative
at the second knot. For the above example, d=0.7071, f'(x1)=-1.3493,
and the natural spline interpolant has value 1.2266-(-1.3493)=2.5759
at x=1, not 2.5366.
PS Th...
2006 Nov 07
1
multivariate splines
Hi,
I am looking for an R package that would calculate multivarite (mostly
2d and 3d, tensor) cubic interpolating splines, so that I could
evaluate these splines (and their derivatives) at many points (unkown
at the time of calculating the spline polynomials) repeatedly.
To make things concrete, I have an array V with
dim(V) = k
and gridpoint vectors grid=list(...), length(grid[[i]])==k[i], and
would like to get so...
2012 Feb 24
1
B-spline/smooth.basis derivative matrices
Hello,
I've noticed that SPLUS seems to have a function for evaluating derivative matrices of splines. I've found the R function that evaluates matrices from 'smooth.spline'; maybe someone has written something to do the same with smooth.basis?
regards,
s
2009 Nov 06
3
order of points in spline
Hello everyone,
I was trying to fit a spline to some points and I was quite surprised to
find out that the function spline does not take into account the order of
the points themselves, but orders them by x.
For instance, I have:
x <- c(262, 275, 264, 250, 247, 242, 238, 233)
y <- c(422, 389, 359, 308, 269, 229, 191, 176)
plot(x, y, xlim=c(0, 500), ylim=c(0,500))
s <- spline(x,y)
2001 Dec 05
4
Questions about piecewise spline fitting
Hi All,
I want to fit a piecewise spline of degree 1, i.e. a spline consisting of a
straight line over each piece. I downloaded the R package pspline, then I
have following questions:
1. in the program, the degree of the spline is specified by 2*norder-1. Why
do they adopt such scheme that we can only fit a spline with odd degree?
2. norder cannot be set to 1. Is there any specific reason
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data
for the predictor variable, y=vector of data for the response variable)
fit <- smooth.spline(x,y)
Now, given a spline fit point y_new, I want to be able to find out what
value of x_new yielded this fit value. How to do so?
(This problem is the inverse of the predict.smooth.spline function, which
takes x_new as input
2011 Aug 25
3
Application of results from smooth.spline outside R
Hi,
I want to use the result from smooth.spline outside R.
I take my data ,which is 180 point stored in x and y
s <- smooth(x,y)
I can know use to e.g. find the interpolated value at e.g. x=500
predict (s,500)
My problem is, that i don't know how to implement the predict function. I
have looked at literature, but i cannot connect the output of the
smooth.spline() to an actual spline
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
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.
2005 Jul 19
2
Taking the derivative of a quadratic B-spline
Hello,
I have been trying to take the derivative of a quadratic B-spline
obtained by using the COBS library. What I would like to do is
similar to what one can do by using
fit<-smooth.spline(cdf)
xx<-seq(-10,10,.1)
predict(fit, xx, deriv = 1)
The goal is to fit the spline to data that is approximating a
cumulative distribution function (e.g. in my example, cdf is a
2-column matrix with x