Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 72779

Graphing Over-Time Trajectories without Excluding Cases that Have Only a Single Data Point

$
0
0
Dear Listserv—

I’m using Stata 13. My cases are country-years nested within countries. My number of observations (or country-years) per country varies between one and eight. I’m trying to create a figure that displays growth trajectories for a dozen or so countries (where year is on the X axis and average attitudes are on the Y axis). I want to be able to create a figure where: data points for countries with two or more observations are connected up but where the results for countries with a single observation are also displayed as a single data point, or dot. Can anyone suggest how to do this?

FYI, I’ve tried the following two approaches to this task, but both have problems.

(1) I tried using the following code, but the problem was that it connected some observations from different countries together: graph twoway (line hojust year if mena==1 & year>1988, connect(ascending)), xtitle(Year) ytitle(Attitudes) title(Growth Curves in MENA Region)

(2) Then I tried using this code, but the problem was that countries that had only one observation were excluded from the figure. (I want these countries to appear as a single data point in the figure.) xtline hojust if mena==1 & hojust~=. & sample1==1, overlay xtitle(Year) ytitle(Attitudes) title(Growth Curves in MENA Region) legend(off) yscale(range(1 8)) ylabel(1(1)8) xscale(range(1980 2014) noextend) xlabel(1980(10)2014)

Thanks!

Louisa

Viewing all articles
Browse latest Browse all 72779

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>