Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Smoothing/Spline and momentum


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Smoothing/Spline and momentum
Date   Wed, 4 Feb 2009 17:47:27 -0000

Mata has cubic spline interpolation. 

A cubic interpolation routine is available as -cipolate- on SSC. 

You say you have x, y; I wonder if you also have time or some
equivalent, say t. My instinct is that it might be easier to interpolate
in terms of x = x(t) and y = y(t) rather than y = y(x) or x = x(y), but
I'm not sure where that instinct comes from. I'm probably guessing by
analogy with smoothing directions on the circle where a direction can
quite naturally flip smoothly from (in compass terms) just W of N to
just E of N and a good smoothing method has to respect that. One good
solution is to decouple the smoothing into smmothing of sine and cosine
and then take the arctangent. 

That leads laterally into mentioning that working with polar coordinates
may make just as much sense. 

Nick 
n.j.cox@durham.ac.uk 

Dan Weitzenfeld

I have data consisting of X,Y coordinates of a moving object, sampled
at an unfortunately low sampling rate.  I'm therefore trying to
approximate location in the intervals between sampling points using
some combination of interpolation and smoothing or splining.
I have tried a bunch of methods (see below), but I'm having difficulty
meeting my two goals:
1) the interpolated trajectory should always go through the sampled
points (they are sampled without error, so I feel like I should hit
them)
2) the interpolated trajectory should look like a moving object with
momentum
     a.  the trajectory should be somewhat smooth, what I would call
"sports car smooth"
     b.  velocity when entering a curve is taken into account  - a
faster entry means a later, deeper apex

So far, I have tried:
-spline-
-rcspline-
-lowess-
-smooth-

I am wondering if anyone has any tips or package recommendations for
solving this fun problem.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index