Hi,
I have a question about the qreg2 command and would appreciate your feedback.
I am using data from a large survey with a detailed drinking diary. Individuals (n = 102, 772) provide information about the number of drinking occasions (over 400,000 recorded occasions) they have in a week and what they drink at each occasion. The data is cross sectional.
I am interested in examining trends in the total units consumed in the diary week (across all occasions at an individual level) across the consumption distribution between 2009 and 2018, e.g. do we see declines in alcohol consumption across all drinkers. I also included age and gender interaction terms in order to examine whether sex and age differences are seen across the distribution or only among lighter/heavier drinkers. There is no problem here I think, as I have used the sqreg command.
However, I am also interested in looking at trends at an occasion based level e.g. is the prevalence of lighter drinking occasions increasing and heavier drinking occasions decreasing? However, the occasions are obviously clustered within the individual, as an individual participant can contribute multiple drinking occasions across the diary week. As such, I need to account for this in the analysis. I have done some reading around the qreg2 command and this seems to be a good solution however I cannot get my code to run.
I initially tried the code below but had an error message stating that factor variables and interactions are not allowed
qreg2 occ2hrunits drinkyear drinkyear.c#d_sex.i drinkyear.c#d_age3.c, quantile(5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95), cluster(newid)
After looking on these boards I found that the xi: prefix allowed you to specify factor variables so I dropped the interaction terms and settled for controlling for the demographic variables in the analysis and tried the code below;
xi: qreg2 occ2hrunits drinkyear i.d_sex d_age3, quantile(5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95), cluster (newid)
But now I am getting the error message 'invalid cluster'.
Is this a problem with my analysis plan or my code?
Apologies if I have left out any important information - this is my first post here but I have tried to be thorough.
Thank you,
Melissa
Related Posts with qreg2 'invalid cluster' error
Losing Precision with ASEC ID ValuesHi Statalisters,
I'm currently working with the 2019 CPS ASEC, trying to match individual responden…
f test following reghdfe for joint significance of individual fixed effectsHi all,
I'd like to run a f-test to test joint significance of each fixed effects. For example, I'd…
Implied Cost of Equity, mm_root function skips the results of some observationsHi There,
I have used the following codes to calculate the implied cost of equity. While the code c…
Not obvious behaviorThe following fragment illustrates a rather non-obvious behavior of Stata when working with data fra…
MA(5) for panel dataDear Statalist members,
I used the information given on this Stata pdf https://www.stata.com/suppor…
Subscribe to:
Post Comments (Atom)
0 Response to qreg2 'invalid cluster' error
Post a Comment