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

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: multiple CI/mean plots in one graphic |

Date |
Thu, 28 Apr 2011 20:40:05 +0100 |

-civplot- is a user-written plot from SSC written in 1999 for Stata 6. I am not surprised that it does not separate out different groups given a command . civplot variable1, by(time) as the command does not even mention -group-. Also, as -njc_stuff- (also SSC) documents, -civplot- is considered obsolete given -ciplot- (also SSC). But better than either is to do it yourself using the principles described in Cox, N.J. 2010. Speaking Stata: The statsby strategy. Stata Journal 10, 143-151. http://www.stata-journal.com/article.html?article=gr0045 The following problem has essentially similar structure to yours and shows some technique sysuse auto, clear statsby mean=r(mean) ub=r(ub) lb=r(lb) , by(foreign rep78) : ci weight separate mean, by(foreign) veryshortlabel separate ub, by(foreign) veryshortlabel separate lb, by(foreign) veryshortlabel scatter mean0 mean1 rep78 || rcap ub0 lb0 rep78 || rcap ub1 lb1 rep78, legend(order(1 2)) However, note that what you have done so far implies that separate days are independent, which may not be quite right! Nick On Thu, Apr 28, 2011 at 6:33 PM, Pieter-Jan <duikerarts@home.nl> wrote: > Recently we performed a randomized crossover study in which we monitored the > lung function of a group of volunteers during three days. Day 1 was used to > determine baseline lung function whereas day 2 and 3 were used to monitor > lung function after inhaling either placebo (air) or active gas (oxygen) > under hyperbaric condition. During each measurement day lung function was > measured 6 times. All variables and observations were put in a dataset which > initially had the following format: > > ID Group Time Variable1 etc > 1 0 0 6.19 > 2 0 0 5.97 > Etc > > ID exist of 13 persons > Group: 0 (baseline), 1 (placebo), 2 (active) > Time: 0, 2, 4, 8, 12, 22 hours after exposure > > To give the reader a good overview how f.e. variable 1 changes over time > within the 3 groups I want to plot the CI and mean of each group on each > time point in one graphic. I tried civplot > > Civplot variable1, by(time) > > But that gives me no separate plots of the three groups. > > I tried to change the dataset by deleting the group variable and changing > the Variable1 etc as follows > > ID Time Variable1_baseline Variable1_placebo > Variable1_active etc > 1 0 6.19 6.01 > 6.11 > 2 0 5.97 6.05 > 5.91 > > Civplot variable1_baseline, by(time) > > This allows me only 1 civplot for each variable but just like the first > attempt this gave me only 1 plot per graphic. I tried also twoway > > Twoway (scatter variable1_baseline time) (fpfit variable1_baseline time) > (scatter variable1_placebo time) (fpfit variable1_placebo time) (scatter > variable1_active time) (fpfit variable1_active time) > > And this gives the possibilities of putting multiple plots in one graphic > but specially the scatter makes it cluttered. A simple CI/mean would > counteract this. > > Is there a possibility in Stata of putting multiple CI/mean plots into one > graphic? Maybe the answer speaks for itself but I am rather new into Stata > that's why I asking this question. * * 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/

**Follow-Ups**:**RE: st: multiple CI/mean plots in one graphic***From:*"Pieter-Jan" <duikerarts@home.nl>

**References**:**st: multiple CI/mean plots in one graphic***From:*"Pieter-Jan" <duikerarts@home.nl>

- Prev by Date:
**st: xtmixed and missing data** - Next by Date:
**st: testing for differences in parameters with clogit with standardized parameter estimates** - Previous by thread:
**st: multiple CI/mean plots in one graphic** - Next by thread:
**RE: st: multiple CI/mean plots in one graphic** - Index(es):