Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[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 <>
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

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.



>> On Mon, Apr 4, 2011 at 3:57 PM, Ben Ammar <> 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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index