2017-04-19 16 views
2

私は互いに下の2つの回帰の係数(信頼区間を持つ)を表示したいと思います。 Ben Jannの素敵なcoefplotssc install coefplot)を使用すると、すべてのモデルのすべての係数が含まれているグラフのみを1つのサブグラフで作成できますが、係数ではなくモデルで係数を並べることに成功しません。coefplot:それぞれ1つのグラフにいくつかの係数を持つ複数のモデル

また、私は必要ではない係数でいくつかの部分グラフを持つグラフを作成することができます:係数の共通のスケールと1つのサブグラフが必要です。ここで

は私のニーズと私はちょうど説明を示す最低限の例が来る:

sysuse auto.dta, clear 
reg price mpg rep78 
eststo model1 
reg price mpg rep78 weight 
eststo model2 

*what do I have: 2 models with 2 coefficients each (plus constant) 

*what do I want: 1 graph with 2 models beneath one another, 
       *2 coefficients per model, 1 colour and legend entry per coefficient (not model!) 
       *common scale 

*what is easy to get: 

coefplot model1 model2, ///1 graph with all coefficients and models, 
    keep(mpg rep78)   //but order is by coefficient, not by model 
          //how to add model names as ylabels? 

*or 1 graph with 2 subgraphs by coefficient: 
coefplot model1 || model2, /// 
    keep(mpg rep78) bycoefs  

誰が最適coefplotを使用して、私がしたいグラフを得ることに私を助けることができますか?

この例の注釈を読んでもわかるように、完璧な解決策には、モデル名を使用して係数(モデルではない)とylabelごとに1つの色と凡例エントリが含まれますが、これは二次的です。

私は既にcoefplotオプションのいくつかを試しましたが、それらのほとんどは、異なるモデルの係数ではなく、1つのモデルからいくつかの方程式用です。

答えて

0

私はモデル名に対処する方法がわからないけど、あなたの質問の最初の部分のために、あなただけのような何かができることを私には思える:

sysuse auto.dta, clear 
reg price mpg rep78 
eststo m1 
reg price mpg rep78 weight 
eststo m2 


coefplot (m1) || (m2), /// 
drop(_cons) byopts(row(2)) keep(mpg rep78) 

または私は何誤解かを欲しいです?

関連する問題