含义描述
将回归结果报告到DOCX文件中的格式化表格。
语法与选项
reg2docx modellist using filename , [options]
选项 | 功能 |
---|---|
replace | 覆盖指定的现有文档 |
append | 将输出结果附加到指定的文档。 |
title(string) | 添加表的标题。 默认值为title("Regression Table")。 |
pagesize(psize) | 设置文档的页面大小。 默认值为pagesize(A4)。 |
font(fontname[, size[, color]]) | 设置文档的字体,字体大小和字体颜色。 |
landscape | 将文档方向从纵向更改为横向。 |
note(string) | 在表格下添加注释。 |
b(string) | 指定系数格式。 |
t[(fmt)] | 输出t统计信息并指定格式。 |
z[(fmt)] | 输出z统计信息并指定格式。 |
p[(fmt)] | 输出p值并指定格式。 |
se[(fmt)] | 输出标准误并指定格式。 |
scalars(scalarlist) | 指定要输出的标量。 |
noconstant | 不输出截距项。 |
constant | 输出截距项。 |
noobs | 不输出回归样本观察数。 |
nostar | 不输出系数显著性的星星。 |
star[(symbol level [...])] | 指定系数的显著性水平。默认情况为star(* 0.1 ** 0.05 *** 0.01) |
staraux | 显著性星星将打印在t统计量(或标准误差等)的旁边,而不是系数。 |
mtitles(titlelist) | 在表标题中指定模型的标题。 |
nomtitle | 不输出模型标题 |
depvar | 在表头中输出模型因变量的名称作为模型标题。 |
order(list) | 更改变量的顺序。 |
indicate("Ind=*ind") | 指示参数的存在。 |
drop(droplist) | 不汇报某些变量。论文节省篇幅版面常用的做法。 |
noparentheses | 不要在t统计量周围打印括号。 |
parentheses | 在t统计量周围打印括号。 |
brackets | 使用方括号而不是括号。 |
选项详解
1.font(fontname[, size[, color]])
例如:font("楷体","12","black") 。可以不指定字体名而单独指定字体大小和字体颜色,使用font("",size)仅指定字体大小,使用font("","",color)仅指定字体颜色。 默认值为font("Times New Roman")。
2.scalars(scalarlist)
可以利用eruturn list 查看在返回列表中获得的所有标量。例如:scalars(N r2_a(%9.2f) r2_p(%9.2f)) 。N标量为样本数 , r2_a为调整后的R平方 , r2_p为pseudo R平方 。
3.indicate("Ind=*ind")|
将所有符合ind命名的变量从表格中删除,改为报告变量Ind,用Yes和No表示是否控制这些变量。其中""为通配符,"*ind"表示所有以"ind"结尾的变量。
例子
clear
set obs 1000
gen x1 = uniform()
gen x2 = uniform()
gen x3 = uniform()
gen x4 = uniform()
gen x5 = uniform()
gen x6 = uniform()
gen ind = mod(_n,10)
tab ind, gen(ind)
gen y = 0.4+.5*x1+.6*x2+.7*x3+.8*x4+rnormal()*3
replace y = y-.7*x5-.8*x6
forvalue i = 1(1)10 {
replace y = y+sqrt(`i')*ind`i'
}
reg y x1 x5 x6 ind2-ind10
est store m1
reg y x1 x2 x5 x6 ind2-ind10
est store m2
reg y x1 x2 x3 x5 x6 ind2-ind10
est store m3
reg y x1 x2 x3 x4 x5 x6 ind2-ind10
est store m4
reg2docx m1 m2 m3 m4 using d:/mytable2.docx, ///
replace indicate("ind=ind*") drop(x2 x3) ///
scalars(N r2(%9.3f) r2_a(%9.2f)) order(x6 x5) ///
b(%9.3f) t(%7.2f) title(table2: OLS regression results) ///
mtitles("model 1" "model 2" "" "model 4") font("", 6,"red") ///
star(* 0.1 ** 0.05 *** 0.01) noconstant
网友评论