You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.2 KiB
Plaintext

*! v1.3.0 8Sep2005
/* added "joint" option to go with metareg.ado v2.3.1 */
program define metareg_pm, rclass
version 7
syntax varlist [if], xvars(varlist numeric) [ univariable joint(string) ] *
tokenize `varlist'
args y wsvar n
marksample touse
tempvar xp z zabs
tempname zi
foreach x of varlist `xvars' {
gen `: type `x'' `xp' = `x'[`n'] if `touse'
drop `x'
rename `xp' `x'
}
if "`univariable'" == "" { /* single multiple meta-regression */
metareg `y' `xvars' if `touse', wsvar(`wsvar') notaucomp `options'
foreach x of varlist `xvars' {
scalar `zi' = _b[`x'] / _se[`x']
return scalar z_`x' = `zi'
}
}
else { /* separate univariable meta-regressions */
foreach x of varlist `xvars' {
metareg `y' `x' if `touse', wsvar(`wsvar') notaucomp `options'
scalar `zi' = _b[`x'] / _se[`x']
return scalar z_`x' = `zi'
}
}
while "`joint'" != "" {
gettoken tmp joint : joint, parse("\/|")
if strpos("\/|", "`tmp'") {
continue
}
local 0 `tmp'
syntax varlist
local j = `j' + 1
qui test `varlist'
if "`r(chi2)'" != "" {
return scalar chi2`j' = r(chi2)
}
else {
return scalar chi2`j' = r(F) * r(df)
}
}
end