0.909395426580465, 0.806793813827552, 0.474927337412093,
-0.0383057034947468,
-0.454526719533217, -0.187379201707524, 0.249983084438962,
0.632832546743065,
-0.986399675507447, -0.970631383787144), .Dim = c(504L,
2L), .Dimnames = list(
NULL, c("sensors.sample", "")))
What I'd like to do is get a spline through all the points.
On the face of it that seems to be an extraordinary request. So (not
for the first time) I must not be understanding something. Are you
really asking for assistance in constructing a 503rd or 504th degree
polynomial? And if you are, then why pose the question on a statistics-
oriented mailing list. We only deal in approximations to the Truth.
I'm
thinking the spline function is my best approach. But a plot of the
spline and the points shows it does not cross every one perfectly. Do
I need to specify a particular method for this, or am I using the
wrong approach? Thanks in advance! -- H
--
Sent from my mobile device
Envoyait de mon portable
David:
Why do you say the OP wants a 503rd or 504th degree polynomial?
He/she wants an interpolating spline.
But that is precisely what "spline()" or "splinefun()" would give him/her.
So I don't understand the problem either!!!
To the OP:
What did you actually *do* to create your spline?
Did you use spline() or splinefun()? And if not, why not?
Do read the posting guide!
cheers,
Rolf
0.909395426580465, 0.806793813827552, 0.474927337412093,
-0.0383057034947468,
-0.454526719533217, -0.187379201707524, 0.249983084438962,
0.632832546743065,
-0.986399675507447, -0.970631383787144), .Dim = c(504L, 2L),
.Dimnames = list(
NULL, c("sensors.sample", "")))
What I'd like to do is get a spline through all the points.
On the face of it that seems to be an extraordinary request. So (not
for the first time) I must not be understanding something. Are you
really asking for assistance in constructing a 503rd or 504th degree
polynomial? And if you are, then why pose the question on a
statistics-oriented mailing list. We only deal in approximations to
the Truth.
I'm
thinking the spline function is my best approach. But a plot of the
spline and the points shows it does not cross every one perfectly. Do
I need to specify a particular method for this, or am I using the
wrong approach? Thanks in advance! -- H
--
Sent from my mobile device
Envoyait de mon portable
On 14 February 2012 21:26, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
? ?What did you actually *do* to create your spline?
? ?Did you use spline() or splinefun()? ?And if not, why not?
Yes... I used the spline() function to get a list of points that
should go though every point in the dataset, but it does not go
through each point, just most of them.
Is this what it is supposed to do? If so, my understanding of the
maths underlying it are incorrect -- this is entirely possible as
well.
Sent from my mobile device
Envoyait de mon portable
What part of "read the posting guide" did you not understand? The "provide commented, minimal, self-contained, reproducible code" part?
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
Hasan Diwan <hasan.diwan at gmail.com> wrote:
Rolf,
On 14 February 2012 21:26, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
? ?What did you actually *do* to create your spline?
? ?Did you use spline() or splinefun()? ?And if not, why not?
Yes... I used the spline() function to get a list of points that
should go though every point in the dataset, but it does not go
through each point, just most of them.
Is this what it is supposed to do? If so, my understanding of the
maths underlying it are incorrect -- this is entirely possible as
well.
--
Sent from my mobile device
Envoyait de mon portable
Rolf,
On 14 February 2012 21:26, Rolf Turner <rolf.turner at xtra.co.nz> wrote:
? ?What did you actually *do* to create your spline?
? ?Did you use spline() or splinefun()? ?And if not, why not?
Yes... I used the spline() function to get a list of points that
should go though every point in the dataset, but it does not go
through each point, just most of them.
Is this what it is supposed to do? If so, my understanding of the
maths underlying it are incorrect -- this is entirely possible as
well.
--
Sent from my mobile device
Envoyait de mon portable
structure(c(1328565718.65, 1328566608.9, 1328566162.65, 1328566571.1,
1328566598.85, 1328565634.3, 1328566513.95, 1328565123.65, 1328565827.1,
......
What I'd like to do is get a spline through all the points. I'm
thinking the spline function is my best approach. But a plot of the
spline and the points shows it does not cross every one perfectly. Do
I need to specify a particular method for this, or am I using the
wrong approach? Thanks in advance! -- H
I assigned your str to the variable z.
And then did this
z.s <- spline(z[,1],z[,2])
z.range <- 1:50
plot(z.s$x[z.range],z.s$y[z.range])
lines(z.s$x[z.range],z.s$y[z.range], col=2)
z.range <- 401:450
plot(z.s$x[z.range],z.s$y[z.range])
lines(z.s$x[z.range],z.s$y[z.range], col=2)
And got the distinct impression that the spline is going through your points.
So what have you done and what made you draw your conclusion?
Berend
On 15 February 2012 19:00, Jeff Newmiller<jdnewmil at dcn.davis.ca.us> wrote:
What part of "read the posting guide" did you not understand? The "provide commented, minimal, self-contained, reproducible code" part?
Off topic: why is there so much unfriendliness on this thread ? Both
the above and DW's post seem unnecessarily aggressive and unhelpful.
There is *not* ``so much unfriendliness on this thread''. People become
brusque, not unfriendly, when those asking questions persist in deliberate
obtuseness.
DW puts an enormous amount of time and effort into providing helpful
advice on this list, but is understandably put off by silly questions or
failures to follow the posting guide.
His efforts should be appreciated and applauded, not whined about.
cheers,
Rolf Turner
David:
Why do you say the OP wants a 503rd or 504th degree polynomial?
He/she wants an interpolating spline.
I suppose that a piecewise approach could lower the degree of
polynomial needed, but it would still require estimating a huge number
of knot points and local coefficients for an overly specified basis,
and in a statistical sense still appear to be a massive case of over-
fitting. If you look at the data graphically, it appears to be a noisy
band of fairly uniform data between -1.2 and 1.2 with a few outliers.
But that is precisely what "spline()" or "splinefun()" would give
him/her.
Even if it did, I was trying too raise the question whether it _should_.
Attached is the result of this:
> plot(sensor.sample)
> ?spline
> lines(spline(x=sensor.sample[,1], y=sensor.sample[,2]), col = 2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sensor.spline.fit.pdf
Type: application/pdf
Size: 152888 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120215/e384db74/attachment.pdf>
-------------- next part --------------
It's 149 KB (over the size limit for automatic posting which will get
it flagged for moderation). One of the other moderators can decide
whether it adds to the discussion.
There are a couple of points that on visual inspection could be said
to have been "missed" in that the incredibly complex spline function
has under shot some points. Increasing the number of points in the
spline() call to increasing multiples of 504 lets most of the circles
get touched by red lines but there is (at least) one point that is
resistant to inclusion. Perhaps it is at a point where there is a tie
and the mean is being plotted. (There are 4 ties in the x data:
> which(table(sensor.sample[,1]) >1)
1328565718.65 1328566162.65 1328566571.1 1328566608.9
179 305 404 414 )
So what? I think the whole exercise is misguided on statistical
grounds, AND we were not given any basis for considering other grounds
AND this is a statistical list.
David.
>
> So I don't understand the problem either!!!
>
> To the OP:
>
> What did you actually *do* to create your spline?
> Did you use spline() or splinefun()? And if not, why not?
>
> Do read the posting guide!
>
> cheers,
>
> Rolf
>
> On 15/02/12 15:37, David Winsemius wrote:
>>
>> On Feb 14, 2012, at 4:14 PM, Hasan Diwan wrote:
>>
>>>> dput(sensor.sample)
>>> structure(c(1328565718.65, 1328566608.9, 1328566162.65,
>>> 1328566571.1,
>> snipped 5 pages of data....
>>> 0.909395426580465, 0.806793813827552, 0.474927337412093,
>>> -0.0383057034947468,
>>> -0.454526719533217, -0.187379201707524, 0.249983084438962,
>>> 0.632832546743065,
>>> -0.986399675507447, -0.970631383787144), .Dim = c(504L,
>>> 2L), .Dimnames = list(
>>> NULL, c("sensors.sample", "")))
>>>
>>> What I'd like to do is get a spline through all the points.
>>
>> On the face of it that seems to be an extraordinary request. So
>> (not for the first time) I must not be understanding something.
>> Are you really asking for assistance in constructing a 503rd or
>> 504th degree polynomial? And if you are, then why pose the
>> question on a statistics-oriented mailing list. We only deal in
>> approximations to the Truth.
>>
>>
>>
>>> I'm
>>> thinking the spline function is my best approach. But a plot of the
>>> spline and the points shows it does not cross every one perfectly.
>>> Do
>>> I need to specify a particular method for this, or am I using the
>>> wrong approach? Thanks in advance! -- H
>>> --
>>> Sent from my mobile device
>>> Envoyait de mon portable
>>
>>
>
David Winsemius, MD
West Hartford, CT