⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gprobit.ado

📁 是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到
💻 ADO
字号:
*! version 4.0.3  24feb2005
program define gprobit, eclass byable(onecall)
	if _by() {
		local BY `"by `_byvars'`_byrc0':"'
	}

	if _caller() < 9 {
		`BY' gprobit_8 `*'
		exit
	}

	`BY' _vce_parserun gprobit, jkopts(eclass) : `0'
	if "`s(exit)'" != "" {
		exit
	}

	version 6.0, missing
	if `"`*'"'==`""' | substr(`"`1'"',1,1)==`","' { 
		if `"`e(cmd)'"'!=`"gprobit"' { error 301 } 
		if _by() { error 190 }
		Replay `0'
		exit
	}
	else { 
	`BY' Estimate `0'
end

program Estimate, eclass byable(recall)
	syntax varlist(min=2) [if] [in] [, Level(cilevel) ]
	marksample touse
	tokenize `varlist'
	local lhs1 "`1'"
	local lhs "`1' `2'"
	tempvar S P PROBIT xb wt
	quietly {
		gen long `S'=`1' if `1'>=0
		gen long `P'=`2' if `2'>=0 & `1'<=`2'
		gen double `PROBIT'=invnorm(`S'/`P') if `touse'
		mac shift 2
		/* Stage one OLS to get weights */
		_regress `PROBIT' `*' if `touse'
		predict double `xb', xb
		gen double `wt' = norm(`xb')
		replace `wt' = `S'*(normden(`wt'))^2 / (`wt'*(1-`wt'))
		_regress `PROBIT' `*' [aw=`wt'] if `touse', depname(`lhs1')
	}
	est local cmd
	est local wexp
	est local wtype 
	est local ll
	est local ll_0
	est local depvar "`lhs'"
	est local predict "gprobi_p"
	est local title ///
		`"Weighted LS probit regression for grouped data"'
	est local cmd "gprobit"
	global S_E_cmd "gprobit"   /* double save */

	Replay, level(`level')
end

program Replay
	syntax [, Level(cilevel) ]
	if "`e(prefix)'" == "" {
		di _n as txt `"`e(title)'"'
	}
	regress, level(`level')
end

exit

/*
Prior to version 9 of Stata, the weights were calculated using the
observed proportions in the formula n*p*(1-p).  Now we run a first-
stage OLS regression to get predicted p's and use those in the weights
instead.  See Greene (3rd ed., p. 896, fn. 24). BPP
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -