Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: Re: How Do I Plot a Serset?


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: How Do I Plot a Serset?
Date   Mon, 8 Sep 2003 10:42:24 +0100

Germán Rodríguez

> Nick said:
>
> > . -c(s)- has not been removed, but has a new identity
> > as -twoway mspline-.
>
> This is interesting. I had dismissed mspline because it
> first computes
> cross-medians as a smoothing device and then computes an
> interpolating
> cubic spline. But one can fool mspline into doing just the
> c(s) part by
> defining exactly as many bands as one has points. In my
> application I
> can use twoway mspline logL lambda, bands(7). It is
> imperative to get
> the number of bands exactly right so the medians coincide with the
> evaluation points, otherwise the function would be distorted (which
> makes this workaround brittle). If you don't believe me,
> try changing
> the number of bands to 3 in the example below. (This
> example can also be
> done with twoway function y=(x-2)^2, but serves to illustrate the
> point.)
>
> clear
> set obs 5
> gen x = _n
> gen y = (x-2)^2
> twoway (scatter y x) (mspline y x, bands(5))

You are suggesting here that

Stata 8's -twoway mspline-

is equivalent to

computation of cross-medians PLUS Stata < 8 -c(s)-

However, -c(s) since first introductuion in
Stata was based on a preliminary computation
of cross-medians, as was documented, and there was the same
-bands()- option to tune its operation. If this wasn't obvious,
it is likely because users rarely applied -c(s)- where
it wasn't sensible and/or found the default number of bands
adequate for their purposes.

If there is a distinction between what -twoway mspline- does
and what -c(s)- did, then it is pretty subtle.

> Nick goes on to say:
>
> >I suspect what is behind this move is logic.
> >-c(s)- is not a purely presentational detail like
> >(in similar oldspeak) say -c(l)- or -c(J)-. The
> >computation of cross-medians and the cubic spline
> >interpolation bring in some data analysis. It really
> >belongs in a room of its own, just as -lowess-
>
> I beg to differ a bit. I think the computation of a log-likelihood,
> cross-medians, lowess, or B-splines is the data analytic
> part, leading
> to x-y pairs. If I am doing data analysis I like the flexibility of
> choosing the smoothing device. Then you have the problem of joining
> those points in a plot using smooth curvilinear (rather
> than straight
> line) segments. This I view as purely presentational and is
> the problem
> solved rather nicely by c(s).

I think this mild disagreement is apparent rather than
real, given my first point.

In any case, my suggestion was an attempt to reconstruct
Stata Corp's thinking. I too got used to -c(s)- as a connect
style.

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

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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