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

From |
vwiggins@stata.com (Vince Wiggins, StataCorp) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: graph mean and sd over/by category |

Date |
Mon, 10 Feb 2003 16:55:20 -0600 |

Among other things, George Hoffman <ghoffman@mcw.edu> asks, > [...] fitted curves under scatter plots look beautiful - can the > regression coefficients from fplotci or qplotci be captured somehow, > as poor-man's curve fit? I think George is referring to the -fpfitci- and -qfitci- plot types of -graph twoway-. If so, he can readily perform the regressions that produced the graphs. -qfitci- just performs a quadratic regression. If we use the auto data, -sysuse auto-, the lines for the graph command, . twoway qfitci mpg weight are the predictions of the quadratic fit, . gen weight2 = weight^2 . regress mpg weight weight2 The coefficients can be seen in the output of -regress-, or manipulated in the usual way through the saved results. If George wants to add the predictions, and their CIs to his dataset, he can type, . predictnl mpg_hat2 = predict() , ci(ci_low ci_high) This is a very simple application of -predictnl-, Bobby Gutierrez <rgutierrez@stata.com> said more in a prior post, but it lets us get both the predictions and their CIs with one command. We could then get a graph similar to our earlier -twoway qfitci-, by typing, . twoway rarea ci_low ci_high weight, sort || line mpg_hat2 weight, sort which we will immediately think looks ugly and decide to relabel the CI in the legend, option -legend(label())-, and change the fill color of the CI to be the standard for our scheme, option -p(ci)-. . twoway rarea ci_low ci_high weight , sort p(ci) || line mpg_hat2 weight , sort legend(label(1 "CI")) The -fpfitci- plot type just uses -fracpoly- as the engine to produce the fits, much like -regress- is used for the quadratic fit. For our example, the corresponding -fracpoly- estimation command is, . fracpoly regress mpg weight and we can repeat the rest of the story, or just use -fracplot-, to plot the fit and CI. -- Vince vwiggins@stata.com * * 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/

- Prev by Date:
**st: RE: RE: HTML/MIME: no!!!** - Next by Date:
**st: RE: RE: graph mean and sd over/by category** - Previous by thread:
**st: Exploring association in binary response in longitudinal** - Next by thread:
**RE: st: graph mean and sd over/by category** - Index(es):

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