1

我正在尝试对每月观察(共同基金特征)进行分位数回归。我想做的是每月将我的观察结果分成五分之一(我的数据集包括 99 个月)。我想根据一个变量(滞后基金规模,即总净资产)来确定五分位数,该变量稍后将用作解释基金业绩的自变量。

我已经尝试做的是使用该qreg命令,但它使用基于因变量而不是所需自变量的分位数。

此外,我尝试使用该xtile命令来创建五分位数;但是,by:不支持该命令。

    . by Date: xtile QLagTNA= LagTNA, nq(5)
    xtile may not be combined with by
    r(190);

是否有一个(组合)命令可以使我免于逐月手动创建五分位数?

4

1 回答 1

3

Statistical comments first before getting to your question, which has two Stata answers at least.

  1. Quantile regression is defined by prediction of quantiles of the response (what you call the dependent variable). You may or may not want to do that, but using quantile-based groups for predictors does not itself make a regression a quantile regression.

  2. Quantiles (here quintiles) are values that divide a variable into bands of defined frequency. Here you want the 0, 20, 40, 60, 80, 100% points. The bands, intervals or groups themselves are not best called quantiles, although many statistically-minded people would know what you mean.

  3. What you propose seems common in economics and business, but it is still degrading the information in the data.

All that said, you could always write a loop using forval, something like this

egen group = group(Date) 
su group, meanonly 
gen QLagTNA = . 

quietly forval d = 1/`r(max)' { 
      xtile work = LagTNA if group == `d', nq(5)  
      replace QLagTNA = work if group == `d' 
      drop work 
} 

For more, see this link

But you will probably prefer to download a user-written egen function [correct term here] to do this

ssc inst egenmore 
h egenmore 

The function you want is xtile().

于 2014-06-08T07:59:17.633 回答