Bookmark and Share

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

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

st: multiple CI/mean plots in one graphic

From   "Pieter-Jan" <>
To   <>
Subject   st: multiple CI/mean plots in one graphic
Date   Thu, 28 Apr 2011 19:33:23 +0200

Dear Statalisters,

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

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
2             0             5.97                     6.05

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.

Many thanks,

Pieter-Jan van Ooij

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index