📄 _svy_mkvmsp.ado
字号:
*! version 1.0.1 24feb2005
program _svy_mkvmsp, eclass
version 9
if `"`e(prefix)'"' != "svy" | `"`e(command)'"' == "" {
exit 301
}
local cmd `e(cmd)'
local svyr svyr
local props : properties `cmd'
if ! `:list svyr in props' {
di as err ///
"misspecification effects cannot be computed with `cmd'"
exit 301
}
nobreak {
capture noisily break {
tempname esave
local subpop `"`e(subpop)'"'
estimates store `esave'
} // capture noisily break
local rc = c(rc)
if `rc' == 0 {
capture Execute `subpop' : `e(command)'
local rc = c(rc)
if `rc' == 0 {
tempname V
matrix `V' = e(V)
}
}
} // nobreak
if "`esave'" != "" {
quietly estimates restore `esave', drop
}
if `rc' {
di as err "misspecification effects could not be computed"
exit `rc'
}
if "`cmd'" == "total" {
tempname nsub
matrix `nsub' = e(_N_subp)
CompTvar `V' `nsub'
local coleq : coleq e(V), quote
local colna : colna e(V), quote
matrix coleq `V' = `coleq'
matrix roweq `V' = `coleq'
matrix colna `V' = `colna'
matrix rowna `V' = `colna'
}
_svy_mkmeff `V'
end
program Execute
_on_colon_parse `0'
local command `"`s(after)'"'
local 0 `"`s(before)'"'
syntax [varname(default=none)] [if] [in]
marksample touse
if "`varlist'" != "" {
markout `touse' `varlist'
quietly replace `touse' = 0 if `varlist' == 0
}
quietly replace `touse' = 0 if e(sample) != 1
local 0 `"`command'"'
syntax [anything(equalok)] [if] [in] [, SCore(passthru) * ]
if `"`if'`in'"' != "" {
marksample touse2
quietly replace `touse' = 0 if `touse2' == 0
}
gettoken cmdname anything : anything
if "`cmdname'" == "total" {
local cmd mean
}
else local cmd `cmdname'
`cmd' `anything' [iw=`touse'], `options'
end
program CompTvar
args V nsub
// adjustment for -total- estimator
tempname c
local cols = colsof(`nsub')
matrix `c' = J(1,`cols',0)
forval i = 1/`cols' {
matrix `c'[1,`i'] = `nsub'[1,`i']^2
}
matrix `V' = diag(`c')*`V'
end
exit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -