Displaying 20 results from an estimated 115 matches for "splinefun".
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 the...
2008 Oct 07
0
splinefun gives incorrect derivs when extrapolating to the (PR#13138)
...oding: 7bit
Content-Disposition: inline
G'day Greg,
On Mon, 6 Oct 2008 19:50:13 +0200 (CEST)
Greg.Snow at imail.org wrote:
> This is a low priority bug that has been around for a while, but I
> came across it again while alpha testing 2.8.
Indeed, that bug must have been around since splinefun was changed to
return a function with a deriv argument. Looks as if the person who
produced the initial patch didn't really think through all
possibilities. ;-)
> The resulting function for splinefun gives incorrect deriv values
> when x is less than the smallest x-value used to create...
2008 Oct 07
0
splinefun gives incorrect derivs when extrapolating to the (PR#13139)
...knot it should be taken as zero. So the attached
patch solves the problem in what some might consider a more elegant
manner. :)
With the patch "make check FORCE=FORCE" works on my machine and it
also solves your example:
R> x <- 1:10
R> y <- sin(x)
R>
R> splfun <- splinefun(x,y, method='natural')
R>
R> # these should be linear (and are)
R> splfun( seq(0,1, 0.1) )
[1] 0.5682923 0.5956102 0.6229280 0.6502459 0.6775638 0.7048816
[7] 0.7321995 0.7595174 0.7868352 0.8141531 0.8414710
R>
R> # these should all be the same
R> splfun( seq(0,1, 0...
2008 Oct 06
1
splinefun gives incorrect derivs when extrapolating to the left (PR#13132)
This is a low priority bug that has been around for a while, but I came acr=
oss it again while alpha testing 2.8.
The resulting function for splinefun gives incorrect deriv values when x is=
less than the smallest x-value used to create the function (at least in on=
e circumstance), but does the correct thing for x greater than the largest =
x-value.
Here is an example:
> x <- 1:10
> y <- sin(x)
>
> splfun <- splinefun(x,y...
2010 Feb 15
1
Non-monotonic spline using splinefun(method = "monoH.FC")
Hi,
In my version of R, the stats package splinefun code for fitting a
Fritsch and Carlson monotonic spline does not appear to guarantee a
monotonic result. If two adjoining sections both have over/undershoot
the way the resulting adjustment of alpha and beta is performed can give
modified values which still do not satisfy the required constraints....
2006 Feb 10
1
3-d splinefun
hello,
is it possible to do something like splinefun(x,y), but with a 3rd
dim?
for example, if i have a 2-dim system like:
x<-1:100
y<-rexp(100,1)
func<-splinefun(x,sort(y))
func(n) # returns interpolated value of y (after sorting) given x=n
# i can check this by:
plot(x,sort(y))
lines(spline(x,sort(y)))
Can i do the same thing...
2007 Nov 14
1
problems with splinefun()
I am working with the function: splinefun() ...
When plugging in the variables, I get the function program as if
though having only entered '"splinefun". only way to get the values
is by
spline(xxx,yyy, n=length(xxx)/10, ties = mean)$x and spline(xxx,yyy,
n=length(xxx)/10, ties = mean)$y.
I'm just wondering if there i...
2010 Feb 18
0
Error in coding for splinefun(method = "monoH.FC") (PR#14215)
Full_Name: Tim Heaton
Version: 2.8.1
OS: linux-gnu
Submission from: (NULL) (143.167.4.162)
Hi,
In my version of R, the stats package splinefun code for fitting a
Fritsch and Carlson monotonic spline does not guarantee a
monotonic result. If two adjoining sections both have over/undershoot
the way the resulting adjustment of alpha and beta is performed can give
modified values which still do not satisfy the required constraints. I posed th...
2016 May 01
2
Storage of byte code-compiled functions in sysdata.rda
...tore byte-code compiled
functions, as we have no problems with R-3.1.3, but do see an "Error in fct(x) : byte code
version mismatch" with R-devel SVNrev r70532.
Background:
Starting from several x-y grids, in the sysdata.rda file of RobAStRDA, we store the results
of calls to approxfun/splinefun to these grids from within a session with pkg RobAStRDA
require()d. From pkg RobExtremes we then call these interpolating functions by means of
a call (essentially) as:
getFromNamespace(".RMXE", ns = "RobAStRDA")[["GEVFamily"]][["fun.N"]][[1]](1.3)
upon...
2006 Feb 10
0
3-dim splinefun?
Hello,
Is the an analogous function to splinefun or approxfun for multivariate data sets?
For example, if I have a data set w/ x's and corresponding y's, I can use either splinefun or approx fun to find values of y for interpolated values of x.
Now, what if I want to do the same thing except with a 3 dim. system?
If I have a da...
2010 Mar 12
1
Usage of apply function with two matrices
...m Vf[,1] and y are
taken from V[,1] respectively), because function apply() base on 1 argument
I made it in this way:
Vspline<-matrix(0,nrow=2*n,ncol=K)
Vspline<-rbind(Vf[,1:3],V[,1:3])
where n=5000 and it is number of rows in V and Vf matrices
and then:
FV<-apply(Vspline,2, function(z)
splinefun(Vspline[1:n,z],Vspline[(n+1):(2*n),z], method="mono",ties=mean))
The problems is, that when I am running it, following error occurs:
Error in xy.coords(x, y) : only 0's may be mixed with negative subscripts
I was trying to run function apply replacing z with particular values, and...
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) argumen...
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
2016 May 01
2
Storage of byte code-compiled functions in sysdata.rda
...e no problems with R-3.1.3, but do see an "Error in fct(x) : byte code
>> version mismatch" with R-devel SVNrev r70532.
>>
>> Background:
>> Starting from several x-y grids, in the sysdata.rda file of RobAStRDA, we store the results
>> of calls to approxfun/splinefun to these grids from within a session with pkg RobAStRDA
>> require()d. From pkg RobExtremes we then call these interpolating functions by means of
>> a call (essentially) as:
>>
>> getFromNamespace(".RMXE", ns = "RobAStRDA")[["GEVFamily"]][[&...
2016 May 01
0
Storage of byte code-compiled functions in sysdata.rda
...unctions, as we have no problems with R-3.1.3, but do see an "Error in fct(x) : byte code
> version mismatch" with R-devel SVNrev r70532.
>
> Background:
> Starting from several x-y grids, in the sysdata.rda file of RobAStRDA, we store the results
> of calls to approxfun/splinefun to these grids from within a session with pkg RobAStRDA
> require()d. From pkg RobExtremes we then call these interpolating functions by means of
> a call (essentially) as:
>
> getFromNamespace(".RMXE", ns = "RobAStRDA")[["GEVFamily"]][["fun.N"...
2011 May 27
1
finding derivative of a data series in R
Dear All,
I tried following for getting derivative of a polynomial in R
i<- -10:10
x<-i*i*i+3*i*i+2
fun_spline<-splinefun(i,x)
plot(x,type="l")
lines(x,fx_spline(x, deriv=1), col='green')
lines(x,fx_spline(x, deriv=2), col='green')
Now when I plot
3*i*i + 6*i and 6*i + 6
the plot was not same for first deivative.
where as the 2nd derivative was same
Is this a correct method for getting deri...
2005 Feb 04
2
how to generate a function from a linear model
...ction from a linear model. I think there
should be build-in function that perform this action but I've had no
luck finding it.
For example, I have a model created using lm().
model <- lm(sat.d~1+sat.n+I(sat.n^2))
What I would like to have is a function (similar to the one generated
by splinefun()) so that I can use it on different data-sets.
Thanks in advance for the help.
Tony Han Bao
tonybao at mac.com
2001 May 10
3
lookup function for density(...) objects
Hi folks:
Is there a lookup function that returns the variate given the cumulative
probability for an object returned by the density(...) function?
> mydata _ as.vector(mymatrix)
> mydata.density _ density(mydata)
> mydata.p80 _ lookup(mydata.density, p=0.8) # is there any function to
accomplish this task?
Thanks.
Rajiv.
--------
Rajiv Prasad, Postdoctoral Research Associate,
2005 Jul 24
1
Buglet in src/appl/splines.c (PR#8030)
--AZaLVt6Pw+
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
Dear all,
I was looking at "splinefun" and the underlying C code and believe
that there is a memory access error in the C routine "spline_eval".
Specifically, on line 368 and following the following code appears:
if(ul < x[i] || x[i+1] < ul) {
i = 0;
j = *n;
do {
k = (i+j)/2;
if(ul < x[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?