Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

-csipolate- updated on SSC [was: Re: st: cubic spline interpolation in panel data]


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   -csipolate- updated on SSC [was: Re: st: cubic spline interpolation in panel data]
Date   Fri, 8 Apr 2011 16:21:48 +0100

Thanks to Kit Baum, -csipolate- has been updated on SSC.

To those who want a brief explanation of this outcome of a thread
started by Ben Ammar:

1. -ipolate- is an official Stata command that just does linear interpolation.

2. -cipolate- is a user-written command (SSC) for cubic interpolation.
This is a classic (18th century if not earlier) based on fitting
cubics to subsets of four distinct points.

3. -csipolate- is another user-written command (SSC) for cubic
_spline_ interpolation.
It is at root just a wrapper for the Mata functions -spline3()- and
-splineval()-

Ben Ammar's dataset exposed a limitation of -csipolate-. It fell over
when asked to interpolate singleton missing values.

That is, there is just one observation; and the variable in question
is missing in that bservation.

In this case there is nothing to interpolate with, so the problem is
insoluble as stated.

Further, discussion with Stata tech support (very clear analysis from
Isabel Canette) establishes that it is clearly my bug in the sense
that the rules for the Mata functions in question certainly exclude
feeding them matrices with 0 rows and 0 columns, which was what
happened here.

So, I have fixed it. Only one line of code needed to be changed.

Thanks to Ben for providing a challenge to meet.

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

[...]

>> On Mon, Apr 4, 2011 at 3:57 PM, Ben Ammar <Ben-Ammar@gmx.de> wrote:

>> > I was wondering if there's any possibility to use spline3() with Mata if
>> the dataset is in panel form (400000 observations, 40 years)?

[...]
*
*   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   |   Site index