parmest&parmby命令

parmest&parmby命令

Convert estimation results to a dataset with one observation per parameter.

Stata
1
2
3
4
5
6
7
8
sysuse auto, clear
reg price mpg weight, r
* 列表显示回归结果
parmest,format(estimate min95 max95 %8.2f p %8.1e) list(,)

* 显示label、不显示编号、不显示表格框线
glm mpg foreign,family(gamma) link(power -1)
parmest, label format(estimate min95 max95 p %8.2f p %8.1e) list(parm label estimate min95 max95 p, clean noobs)
Stata
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
* 显示显著性✨🌟
regress price mpg weight foreign displacement headroom, r
parmest,label format(p %8.1e) stars(0.05 0.01 0.001 0.0001) list(parm label estimate min95 max95 p stars, clean noobs)

* parmby命令
parmby "qui logit foreign mpg, or", label eform for(estimate min95 max95 %8.2f p %8.1e) list(parm label estimate min95 max95 p)
* eform: Exponentiate estimates and confidence limits.

* 显示两个置信水平的置信区间
parmby "qui logit foreign mpg, or", level(95 97.5) cln(rank) label eform for(estimate min* max* %8.2f p %8.1e) li(parm label estimate min2 min1 max1 max2 p, clean noobs)
* clnumber(numbering_rule): Numbering rule for naming confidence limit variables

* omit和empty选项: 显示某个被解释变量是否被省略或为空
parmby "regress weight i.foreign#i.rep78", omit empty list(if !empty, abbr(32))
* omit: Variable containing parameter omit status.
* empty: Variable containing parameter empty cell status.

* nostore选项: create an output dataset in the memory.
parmby "regr mpg weight,robust",by(foreign) label command norestore

sysuse auto, clear
gen gpm=1/mpg
rename foreign t
parmby "regr gpm weight",by(t) label rename(t tstat p pvalue) norestore

sysuse auto, clear
gene byte pw1=1
svyset [pwei=pw1],clear
parmby "svy :mean mpg weight price, over(foreign)", norestore ylabel ev(_N _N_subp) es(N)
d
list eq ylabel parm ev_* es_* estimate min95 max95

* 把估计结果输出为文件
sysuse auto, clear
parmby "logit foreign mpg, or", label eform saving(parms1.dta)
parmby "regr mpg weight displ,robust",by(foreign) label saving(myparms,replace)

* 合并多个估计结果
gene gpm=1/mpg
tempfile tf1 tf2 tf3
parmby "regr gpm weight", lab saving(`"`tf1'"',replace) idn(1) ids(Unadjusted)
parmby "regr gpm foreign", lab saving(`"`tf2'"',replace) idn(2) ids(Unadjusted)
parmby "regr gpm weight foreign", lab saving(`"`tf3'"',replace) idn(3) ids(Adjusted)
drop _all
append using `"`tf1'"' `"`tf2'"' `"`tf3'"'
list idnum idstr parm estimate min95 max95 p, noobs nodis sep(0)
* idnum(#): Numeric dataset ID variable.
* idstr(string): String dataset ID variable.

* flist(): storing the results in temporary files, whose names are stored by the flist() option in a global macro tflist.
sysuse auto, clear
global tflist ""
global modseq=0
foreach X of var headroom trunk weight length turn displacement gear_ratio{
global modseq=$modseq+1
tempfile tfcur
parmby "regr mpg `X'",by(foreign) label command format(estimate min95 max95 %8.2f p %8.1e) idn($modseq) saving(`"`tfcur'"',replace) flist(tflist)
}
drop _all
append using $tflist
sort idnum command foreign parmseq
describe
by idnum command:list foreign parm label estimate min95 max95 p, noobs sep(0)

* parmest&mi estimate
use "http://www.stata-press.com/data/r11/mhouses1993s30", clear
describe
mi estimate (ratio: _b[age]/_b[sqft]): regress price tax sqft age nfeatures ne custom corner
parmest, norestore
tempfile tf1
parmest, bmat(e(b_Q_mi)) vmat(e(V_Q_mi)) dfmat(e(df_Q_mi)) saving(`"`tf1'"', replace)
append using `"`tf1'"', gene(parmtype)
lab def parmtype 0 "Original" 1 "Transformed"
lab val parmtype parmtype
lab var parmtype "Parameter type"
describe
list, sepby(parmtype)
# Stata

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×