Hello,

I'm trying to plot concertation indices for 5 variables obtained from separate linear regression models over 6 study waves to resemble the attached example, including 95% confidence intervals. My 5 vars are: overall arts engagement (ciartscore*), cinema engagement (cia*), galleries engagement (cic*), theatre engagement (cid*) and depressive symptoms (cidep*) and are modelled separately, and I would like to show, for each variable, concertation indices values over study waves 2 to 7. Each study wave has a different number of observations and study wave-specific cross-sectional weights (w*wgt) , as well as a separate “rank*” variable (rank of wave-specific wealth variable obtained from glcurve command) which I use in the regression models to obtain the concertation index values.

I've been trying to follow this example: https://stackoverflow.com/questions/...ient-over-time as well as some listed in documents by Ben Jann, but I'm unsure how to best set up my data for this.

Am I correct in assuming that the most efficient way of plotting my data would be to:
  1. Reshape my data into a long format so that I have a "study_wave" variable (for this example called study_wave)
  2. Create a loop for each variable (e.g. below for cinema engagement) based on Stackoverflow example, and also where I get stuck...
Clear
set more off

use http://www.stata-press.com/data/r12/nlswork.dta

forvalues i = 70/73 {
regress ln_w grade age if year == `i'
estimates store year`i'
local allyears `allyears' year`i' ||
local labels `labels' `i'
}

// check
display "`allyears'"
display `"`labels'"'
coefplot `allyears', keep(grade) vertical bycoefs bylabels(`labels')


My data:
forvalues i = 2/7 {
regress cinema rank [aw=w2wgt - how can I take into account the study_wave-specific rank and weights?] if study_wave == `i'
estimates store study_wave`i'
local allyears `allyears' year`i' ||
local labels `labels' `i' }


display "`allyears'"
display `"`labels'"'

coefplot `allyears', keep(grade – how do I specify my five variables?) vertical bycoefs bylabels(`labels')

Any help would be very much appreciated. Please find my code for regression models which I use to obtain the concertation indices attached and example data below.



----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double idauniq float(ciartscore2 ciartscore3 ciartscore4 ciartscore5 ciartscore6 ciartscore7 cia2 cia3 cia4 cia5 cia6 cia7 cic2 cic3 cic4 cic5 cic6 cic7)
120407 .6110585  .5868953 .3053701 .3082226  .5817445 .52729875  .4263518 .4304892 .28559187 .14907958 .4172361  .3830398 .15328714 .14192791 .1540126        0         0 .28256842
117349        0         .        .        .         .         .         0        .         .         .        .         .         0         .        .        .         .         .
111568 .3055292         . .3053701        0 .29087225         .  .4263518        . .57118374 .29815915 .5563148         .         0         . .1540126        0 .14699772         .
112208 .3055292 .29344764        . .3082226 .29087225         .  .4263518 .5739856         .  .4472387 .5563148         . .15328714 .28385583        . .1497274 .29399544         .
107606        0         0        0        .         .         .         0        0         0         .        .         .  .3065743 .14192791 .3080252        .         .         .
105291        0         .        .        .         .         . .14211725        .         .         .        .         .  .3065743         .        .        .         .         .
105274        0         .        .        .         .         .         0        .         .         .        .         .         0         .        .        .         .         .
106523        0         .        .        .         .         . .14211725        .         .         .        .         .         0         .        .        .         .         .
120728        0         0        0        .         .         . .14211725 .1434964         0         .        .         . .15328714         0 .1540126        .         .         .
104580        0         .        .        .         .         .         0        .         .         .        .         .         0         .        .        .         .         .
107259        0         .        .        .         .         .         0        .         .         .        .         .         0         .        .        .         .         .
116690        0         .        .        0         0         0         0        .         .         0        0 .12767993         0         .        .        0         0         0
119272 .3055292         .        . .3082226         0         0 .14211725        .         . .14907958 .1390787 .12767993 .15328714         .        . .1497274         0 .14128421
118412        0         0        0        0         0         0 .14211725        0         0 .14907958 .1390787         0         0         0        0        0         0         0
118179        0         0        0        .         .         .         0        0         0         .        .         .         0         0        0        .         .         .
120968 .3055292 .29344764 .3053701        .         0 .26364937  .4263518 .4304892  .4283878         . .2781574 .12767993 .15328714 .28385583 .1540126        . .14699772 .14128421
105260 .3055292 .29344764 .3053701 .3082226  .5817445 .26364937   .568469 .5739856 .57118374  .5963183 .5563148  .5107197 .15328714 .14192791 .3080252 .1497274 .14699772 .14128421
119725        0         .        .        .         .         .         0        .         .         .        .         .         0         .        .        .         .         .
119380        0         .        .        .         .         .  .2842345        .         .         .        .         .         0         .        .        .         .         .
119822        0         0 .6107402        0 .29087225 .52729875  .2842345 .1434964  .4283878 .14907958 .1390787  .3830398 .15328714 .14192791 .3080252 .1497274 .14699772 .14128421
end
label values idauniq idauniq
------------------ copy up to and including the previous line ------------------



----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double idauniq float(cid2 cidep2 cid3 cidep3 cid4 cidep4 cid5 cidep5 cid6 cidep6 cid7 cidep7)
120407  .5124655 .11180522  .3656945 .11760303  .3763813 .3678408  .3784584 .11308657 .37248355  .2599499  .3647014 .12791066
117349 .12811637         0         .         .         .        .         .         .         .         .         .         .
111568         0 .22361043         .         .         0        0         0         0 .12416118         0         .         .
112208         0  .7826365 .12189818 .23520607         .        .         0 .22617315         0  .2599499         .         .
107606 .25623274  .6708313 .12189818  .8232212 .12546043 .3678408         .         .         .         .         .         .
105291         0 .11180522         .         .         .        .         .         .         .         .         .         .
105274         0         0         .         .         .        .         .         .         .         .         .         .
106523 .12811637  .4472209         .         .         .        .         .         .         .         .         .         .
120728 .12811637 .11180522 .12189818 .23520607 .12546043 .1226136         .         .         .         .         .         .
104580         0  .4472209         .         .         .        .         .         .         .         .         .         .
107259         0  .8944417         .         .         .        .         .         .         .         .         .         .
116690         0  .8944417         .         .         .        . .12615281   .791606 .12416118 1.0397996         0  .8953746
119272  .3843491         0         .         .         .        .  .3784584 .22617315 .12416118         0 .12156712 .12791066
118412         0  .3354156         0  .7056182 .25092086  .613068         0  .6785195 .12416118 1.0397996         0 .51164263
118179         0  .3354156         0  .3528091         0 .3678408         .         .         .         .         .         .
120968         0         0         0         0         0        0         .         . .12416118         0  .3647014         0
105260 .25623274         0 .12189818         0 .25092086        0 .12615281         0 .37248355         0 .24313423         0
119725         0  .6708313         .         .         .        .         .         .         .         .         .         .
119380 .25623274 .11180522         .         .         .        .         .         .         .         .         .         .
119822 .12811637         0 .24379636  .9408243  .3763813 .3678408 .25230563 .22617315 .37248355 .38992485  .3647014   .383732
end
label values idauniq idauniq
------------------ copy up to and including the previous line ------------------



----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input double(idauniq rank2 rank3 rank4 rank5 rank6 rank7) float(w2wgt w3wgt w4wgt w5wgt w6wgt w7wgt)
120407  .0002030616327800002     .5672292555300248   .5561398375621097    .6187176941403724    .6724049333368352    .6325120528814975  1.325607  1.349908  1.271086 1.1129769 1.0204006  .9167433
117349 .00037036094645306205                     .                   .                    .                    .                    .  1.092147         .         .         .         .         .
111568  .0005432972301528144                     .  .06899211290940273   .07357248787555444   .13999172203922475                    . 1.1289457         .  .9216817 1.0101582  .8518522         .
112208  .0007152775900877632   .016751746165340305                   .   .07376519232716794   .14020633283507675                    . 1.1227053 1.0779383         .  .8515581  .7548384         .
107606  .0008995273853010924 .00024177482503528146 .007088393176625803                    .                    .                    . 1.2028015 1.2275887 1.1551112         .         .         .
105291  .0010263016341531296                     .                   .                    .                    .                    .  .8275952         .         .         .         .         .
105274  .0012063533667458816                     .                   .                    .                    .                    . 1.1753961         .         .         .         .         .
106523   .001376232604492742                     .                   .                    .                    .                    .  1.108989         .         .         .         .         .
120728  .0015573467586610318      .063948746742796     .14589665130593                    .                    .                    . 1.1823317 1.1803237 1.0544201         .         .         .
104580  .0017015250451874447                     .                   .                    .                    .                    .  .9412106         .         .         .         .         .
107259  .0018471280321074963                     .                   .                    .                    .                    .  .9505112         .         .         .         .         .
116690   .001990017032251845                     .                   .   .02522988637311173   .03753482276202721   .05271451921421716   .932794         .         .  .7662734  .6107927  .6469432
119272  .0021292884668444507                     .                   .  .006150002006715243 .0009392646403979203 .0009594639147476147  .9091781         .         .  .8101628  .6447973  .5174048
118412   .002291669360277275  .0013259851091035146 .009388208673832056  .001943139226355905  .019477654490930224  .014322910749317337  1.060039 1.1455082 1.3689535 1.3329713 1.3751986 1.1986527
118179    .00251843449858491  .0028580277090267912  .02702799580236393                    .                    .                    .  1.480346 1.4333975 1.4589818         .         .         .
120968  .0026889244187368773  .0056411308630423245 .002372685732494001                    .  .005857815142378966   .05921214625496377 1.1129756 1.0961629  .7697013         .  .8157049  .6988285
105260  .0028637974761513622    .00671954778395178 .003318746263959669 .0021744851910854924   .00521954624389784   .04550665867693509 1.1415892 1.1680417 1.1971687 1.0223144  .8711897  .7656806
119725  .0030554999268031344                     .                   .                    .                    .                    .  1.251453         .         .         .         .         .
119380  .0032490813005070177                     .                   .                    .                    .                    .  1.263719         .         .         .         .         .
119822   .003429220886489249    .09800249422206214   .2580245616542085    .4731204756582247   .44445572983385806    .6956380220904698 1.1759696 1.2331566 1.4667083  1.299429  .9881352  .9624717
end
label values idauniq idauniq
------------------ copy up to and including the previous line ------------------