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
switching column with cond()?Dear All, I have the following data Code: * Example generated by -dataex-. To install: ssc install…
Interpreting impacts of ratio (bounded) explanatory variablesHello, I run regression with probit and get the table of average marginal effects. I am wondering ho…
Exponentiated coefficients after mi estimate: melogitHello, I am looking to get exponentiated coefficients after estimating a multilevel, mixed effects l…
variable labelsvariable labels 16 Aug 2019, 20:31 sex age response freq 0 0 0 26 0 0 1 12 0 0 2 7 …
How to insert variable A's value as new rows of variable BDear Stata users, I have a question about data management. Data example is as below. Suppose we hav…
Subscribe to:
Post Comments (Atom)
0 Response to qreg2 'invalid cluster' error
Post a Comment