-1

プログラム mymargin を簡単に調べて、矛盾や拡張/改善の可能性をチェックできる人はいますか... プログラムは、if と in によって選択されたサンプル内の任意の変数の限界効果を推定し、保存された結果に基づいて構築する必要があります。以前のロジット回帰。

capture program drop mymargin

program mymargin, rclass
version 10.1
syntax varlist(max=1 numeric) [if] [in] [, atmean]
marksample touse
quietly count if `touse' == 1
if `r(N)' == 0 {
error 301
}   

local res me mme
tempname `res'
quietly summarize `varlist' if `touse'==1, detail

scalar `me' = // TBU
display as txt "Marginal effect of" `var' ": " `me'

if "`atmean'" == "atmean" {
matrix r = r(stats)
scalar `me' = normalden(_b[sex]*r[2,1]+_b[ageinyears]*r[3,1] +_b[meduc]*r[4,1] +_b[hhinc]*r[5,1] +_b[area]*r[6,1] + _b[_cons])
}
display as txt "Mean marginal effect of" `var' ": " `me'    

foreach r of local res {
return scalar `r' = ``r''
}

return scalar N = r(N)      // return the number of observations
return local var `varlist'  // return the name of the variable
return  // TBU, return the (mean) marginal effect

end

mymargin hhinc
return list
display me
display mme
4

1 に答える 1

1

これは、指定された順序で 5 つの指定された予測子があるという組み込みの仮定のためだけに、私から不合格の評価を得ます。

scalar `me' = normalden(_b[sex]*r[2,1]+_b[ageinyears]*r[3,1] +_b[meduc]*r[4,1] +_b[hhinc]*r[5,1] +_b[area]*r[6,1] + _b[_cons])

また、このsummarizeコマンドはr(stats)、前のコマンドによって取り残されたものを消去します。

スタック オーバーフローの一般的なポリシーに関係なく、コースの課題と思われるものを個人的に支援するのはこれまでです。約1週間前の投稿を参照してください。

于 2013-01-08T10:15:59.457 に答える