0

I am new on this blog. Data :

weight month
127     3
105     2
96      4
117     4
97      3
148     3
135     1
117     3
131     2
100     3
133     4
105     4
118     3
109     4
138     3
129     2
120     2
139     3
120     4
103     1
133     3
98      1
133     1
138     4
149     1
124     4
125     3
127     3
149     2
142     2
103     1
113     4
141     4
124     3
102     2
114     1
99      4
114     3
116     4
133     4
104     3
149     1
112     3
123     3
135     3
106     2
97      1
125     1
142     3

I want to simultaneously 4 quantile regressions under different conditions (for the same sample).

qreg (weight if month ==1, quantile(0.75)) ///
    (weight if month ==2, quantile(0.75)) ///
    (weight if month ==3, quantile(0.75)) ///
    (weight if month ==4, quantile(0.75)) 

Error message

parentheses unbalanced
r(132);
` 

I need to run these regressions simultaneously for statistical tests.

Otherwise, to test the inequality of my quantiles, is it better to perform this ? according to this post

qreg weight if month ==1, quantile(.75) 
 qreg weight if month ==2, quantile(.75)

and then building a Z test based on the coefficients (_b[cons]) of both regressions and their standard errors? I guess, this will follow a the critical values of Z table?

  • 2
    This is illegal syntax for `qreg` and does not seem to correspond to your stated goal, as it would run the same model for each month separately. – dimitriy Aug 08 '18 at 00:51
  • by running each month separately, could I still perform statistical test on the 75th quantiles of each month? e.g. 75thpct (month==2) <= 75th pct (month==1) ? – user399035 Aug 08 '18 at 01:05
  • This seems just about on-topic here as there is a query at its heart about the appropriate model. But a question about why code fails is usually off-topic here. – Nick Cox Aug 08 '18 at 01:22
  • This really isn't a blog! – Nick Cox Aug 08 '18 at 01:22
  • What does plotting (as mentioned in the title) have to do with this? – The Laconic Aug 08 '18 at 02:55

1 Answers1

1

Assuming that this is not panel data, you could do something like this:

qreg weight i.month, quantile(0.75)
margins month
marginsplot
margins month, pwcompare

One-sided tests are a bit trickier.

dimitriy
  • 31,081
  • 5
  • 63
  • 138
  • How would your code change if this is panel data? – user399035 Aug 08 '18 at 01:24
  • You would need to adjust that the observations are no longer independent. Clustered standard errors won't work with `qreg`, but there may be a way to block bootstrap the procedure, though that can't be done with the data as it is now. – dimitriy Aug 08 '18 at 01:26
  • Please, see the edit of my post – user399035 Aug 08 '18 at 01:38
  • `suest` will not work with `qreg`, so there is no way to combine the 4 quantile regressions constants. – dimitriy Aug 08 '18 at 01:41