dfbeta.ado

来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· ADO 代码 · 共 65 行

ADO
65
字号
*! version 4.0.2  23jul2000
program define dfbeta
	version 6.0
	_isfit cons

	if "`*'"=="" { 
		GetRhs varlist
	}
	else {
		syntax varlist
		GetRhs rhs
		tokenize `rhs'
		local i 1
		while "``i''"!="" { 
			local v`i' "``i''"
			local i=`i'+1
		}
		tokenize `varlist'
		while "`1'"!="" { 
			local found
			local j 1
			while "`v`j''"!="" & "`found'"=="" {
				if "`1'"=="`v`j''" { local found true }
				local j=`j'+1
			}
			if "`found'"=="" { 
				di in red "`1' not in model"
				exit 111
			}
			mac shift
		}
	}

	local len = cond(_caller()<7, 8, 32) - 2

	tokenize `varlist'
	local i 0
	while "`1'"!="" { 
		local new ="DF"+substr("`1'",1,`len')
		capture confirm new var `new'
		while _rc { 
			local i=`i'+1
			local new "DF`i'"
			capture confirm new var `new'
		}
		predict float `new', dfbeta(`1')
		di in gr %32s "`new'" ":  DFbeta(`1')"
		mac shift 
	}
end

program define GetRhs /* name */ 
	args where
	tempname b 
	mat `b' = get(_b)
	local rhs : colnames `b'
	mat drop `b'
	local n : word count `rhs'
	tokenize `rhs'
	if "``n''"=="_cons" {
		local `n'
	}
	c_local `where' "`*'"
end

⌨️ 快捷键说明

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