Hello everyone,
For my thesis, I'm trying to do a quantile regression on an income variable called yearlyincome for 2 groups separately. I would like to do this quantile reg using both factor variables and clustered standard errors, as I'm using panel data.
From what I know, there are multiple options for this:
- Using qreg command: this allows for quantiles and factor variables, but not clustered standard errors.
- Using qreg2 command: this allows for quantiles and clustered standard errors, but not factor variables.
- Using reg: which allows for quantiles, clustered standard errors and factor variables. The normal reg command therefore seems favorite, but you would need to separate your income variable with the xtile command into quantiles first.
So basically, I would like to use the normal reg command to do this as it allows everything I want (factor vars and clustered standard errors). I used the xtile command to divide my data into 4 quantiles and that's all fine.
The problem is, I wanted to see if I was doing things right and decided to run both a quantile regression using the qreg command, as well as a quantile regressions using the reg command and doing it on one of the created quantiles. So for clarification, I first created a variable to indicate quantiles:
Then, I ran both regressions:
This should yield the same results right? I figured if I created 4 quantiles (I want the .25th percentile, the .50th, and .75th), quantile no. 1 that is created with the xtile command is the .25th percentile right? Hence I thought the above command should give the exact same results, as I'm estimating the first quantile in both.
However, for some reason they don't. The thing is, I have a valid sample size of 13,713 observations. The reg command only takes 2,611 observations into account, while the qreg command takes into account all 13,713 observations.
So from my thinking, that's the reason they're not yielding the same results. But why not? If anyone could tell me, that would be greatly appreciated!
Best,
For my thesis, I'm trying to do a quantile regression on an income variable called yearlyincome for 2 groups separately. I would like to do this quantile reg using both factor variables and clustered standard errors, as I'm using panel data.
From what I know, there are multiple options for this:
- Using qreg command: this allows for quantiles and factor variables, but not clustered standard errors.
- Using qreg2 command: this allows for quantiles and clustered standard errors, but not factor variables.
- Using reg: which allows for quantiles, clustered standard errors and factor variables. The normal reg command therefore seems favorite, but you would need to separate your income variable with the xtile command into quantiles first.
So basically, I would like to use the normal reg command to do this as it allows everything I want (factor vars and clustered standard errors). I used the xtile command to divide my data into 4 quantiles and that's all fine.
The problem is, I wanted to see if I was doing things right and decided to run both a quantile regression using the qreg command, as well as a quantile regressions using the reg command and doing it on one of the created quantiles. So for clarification, I first created a variable to indicate quantiles:
Code:
xtile Quantiles = yearlyincome, nq(4)
Code:
reg yearlyincome age88 age88sq i.civstatus i.education potworkexp if Quantiles==1 qreg yearlyincome age88 age88sq i.civstatus i.education potworkexp, quantile(.25)
However, for some reason they don't. The thing is, I have a valid sample size of 13,713 observations. The reg command only takes 2,611 observations into account, while the qreg command takes into account all 13,713 observations.
So from my thinking, that's the reason they're not yielding the same results. But why not? If anyone could tell me, that would be greatly appreciated!
Best,
Comment