Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Issue with options in addplot and lpoly


From   "Fred Wolfe" <[email protected]>
To   [email protected]
Subject   Re: st: Issue with options in addplot and lpoly
Date   Sun, 17 Aug 2008 08:51:08 -0500

Thanks very much for the detailed, helpful  information,Vince.

One point, though. lpolyci does not have a help file and is not
referenced in the lpoly help file. help twoway_lpolyci exists, but one
has to know to look under twoway. By contrast, help scatter and help
twoway_scatter both go to two_way scatter. May I suggest the same
logic for help lpolyci and to add a reference to it in the lpoly help
file.

Thanks again. I learned a lot.

Fred

On Sat, Aug 16, 2008 at 9:06 PM, Vince Wiggins, StataCorp
<[email protected]> wrote:
> Fred Wolfe <[email protected]>
>
>> I have noticed that
>>
>> . lpoly depnow haq_ if dxn == 1, noscat ci addplot(lpoly depnow haq_
>> if dxn == 4, ci)
>> option ci not allowed
>> r(198);
>> Produces an error, but
>>
>> . lpoly depnow haq_ if dxn == 1, noscat ci addplot(lpoly depnow haq_ if dxn ==4)
>>
>> does not.
>>
>> If run without the options, scatter is suppressed, but the CIs are
>> not drawn for the addplot graph.
>
> Fred is thinking that the option -addplot()- allows us to stack up and graph
> the results from any graphics command, but -addplot()- is not that smart.
> Option -addplot()- allows us to add -twoway- plots to the graphs of commands
> that support it.
>
> The subtle thing here is that in addition to the command -lpoly- there is a
> twoway plot for local polynomial smooths, and that plot is also named -lpoly-.
> The -lpoly- command supports the -ci- option to add confidence intervals
> (CIs), but the -twoway lpoly- plot does not.  A plot that does support CIs for
> local polynomial smooths is -lpolyci-.  Because of the complexity of parsing
> -twoway- commands with potentially overlayed plots, it is always the plottype
> itself that designates how many things will be plotted -- in this case both a
> smoothed line and its CI.
>
> Instead of typing, the illegal
>
> . lpoly depnow haq_ if dxn == 1, noscat ci
>        addplot(lpoly depnow haq_ if dxn == 4, ci)
>                ^^^^^                          ^^
>
> Fred can type
>
> . lpoly depnow haq_ if dxn == 1, noscat ci
>        addplot(lpolyci depnow haq_ if dxn == 4)
>                ^^^^^^^
>
> I can't tell if Fred does or does not want the original scatters plotted.  If
> so, he can just keep adding twoway plots in his -addplot()- option, e.g.,
>
> . lpoly depnow haq_ if dxn == 1, noscat ci
>        addplot(lpolyci depnow haq_ if dxn==4 || scatter depnow haq_ if dxn==4)
>                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> This can be taken a long way, but for ultimate flexibility Fred might
> consider using multiple -lpoly- commands with the options
> -generate(x_var, smooth_var)- and -se(se_var)- to create variables containing
> the resulting smooths and their standard errors (from which the CIs can be
> calculated).  Fred can then use the variables in a -twoway- command to produce
> any combination of smooths and CIs that he likes.
>
>
> -- Vince
>   [email protected]
>
> *
> *   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/
>



-- 
Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
NDB Office +1 316 263 2125 Ext 0
Research Office +1 316 686 9195
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index