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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: RE: cubic spline in time series


From   "Steve Rothenberg" <drlead@prodigy.net.mx>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: cubic spline in time series
Date   Mon, 13 Sep 2010 17:12:54 -0500

Buzz,

Thanks for the tip, I remember checking out -bspline- from my ssc search.  I
looked again after your message and
-bspline- doesn't do the trick since it only works on one variable, not two.

However, at the end of the -bspline- help file it references another ssc
contribution that didn't appear in the ssc search, -spline-, an oldie from
Peter Sasieni, from Stata Technical Bulletin 22.  -spline- takes an xvar and
a yvar as arguments and the result appears to be what I'm looking for.

Best,
Steve


Steve,
Will -bspline- by Roger Newson from SSC help?

ssc desc bspline



Buzz Burhans, Ph.D.

Dairy-Tech Group
So. Albany, VT / Twin Falls ID

Cell: 208-320-0829
ID Fax: 208-735-1289
VT Fax: 802-755-6842

Email: buzzb3@earthlink.net


-----Mensaje original-----
De: Steve Rothenberg [mailto:drlead@prodigy.net.mx] Enviado el: Monday,
September 13, 2010 2:26 PM
Para: 'statalist@hsphsun2.harvard.edu'
Asunto: cubic spline in time series

I have number of cases data per week for a multi-week time series.  The data
will be modeled with negative binomial models.

I'd like to account for the general tendencies of the case data over time,
using cubic splines and then construct the negative binomial model including
the cubic splines as dependent variable smoothers, along with time-varying
independent variables to determine the effect of those variables on
deviations from the cubic spline-fitted dependent variable.

I've used the Stata command -mkspline-, which sets spline knots according to
ranges of values of a single variable.  Using -mkspline- with default
arguments with the dependent variable in my model, number of cases, results
in four knots being placed according to increasing values of number of
cases.

I've searched statalist and the manuals for a spline function that takes two
arguments, the variable to be fitted and another variable against which the
fit should be made.  The only thing I see is a Mata command -spline3_, which
takes two arguments, real vector x and real vector y.

This might be what I need but I've never used Mata before.  I wonder if
someone could help with 1. alternative ways to construct a spline fitted
time function of a variable.
2. tell me if Mata -spline3- is what I'm looking for.
3. give me guidance in using either a Mata function or some other code that
could do the spline fit of a variable in time.

Best regards,
Steve Rothenberg
National Institute of Public Health
Mexico

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