stata 用outreg2输出回归结果
用ssc install outreg2来安装这个命令
1.把多个回归结果输出到一个文件中
reg y x1
outreg2 using a.xls
reg y x2
outreg2 using a.xls
reg y x3
outreg2 using a.xls
如上所示,所有导出文件都用一个名字a。这样导出的结果就放到名字为a的excel表格中了(改成.doc会导出到word文档中),而且自动根据导出的先后顺序用小括号(1)(2)…排序。即使两次回归的自变量、因变量都不同也没有影响,因为如果一个自变量在第一个回归中出现,但在第二个回归中没有出现,那么导出的第二个回归会在相应位置空一个格。
2.保存xtreg回归的r方等参数的结果
使用adds命令
具体的使用方法如:
outreg2 using “D:\微医网信息\5.18实验数据\a.rtf”, adds(R2,e(r2_o))
注意:adds命令面向的是成对的对象,因此不能直接把保存在e()中的结果adds,而是要把结果的名称写在前面,然后再添加结果。其他的e()中保存的结果还有:
xtreg, re stores the following in e():
Scalars
e(N) number of observations
e(N_g) number of groups
e(df_m) model degrees of freedom
e(g_min) smallest group size
e(g_avg) average group size
e(g_max) largest group size
e(Tcon) 1 if T is constant
e(sigma) ancillary parameter (gamma, lnormal)
e(sigma_u) panel-level standard deviation
e(sigma_e) standard deviation of epsilon_it
e(r2_w) R-squared within model
e(r2_o) R-squared overall model
e(r2_b) R-squared between model
e(N_clust) number of clusters
e(chi2) chi-squared
e(p) significance
e(rho) rho
e(thta_min) minimum theta
e(thta_5) theta, 5th percentile
e(thta_50) theta, 50th percentile
e(thta_95) theta, 95th percentile
e(thta_max) maximum theta
e(rmse) root mean squared error of GLS regression
e(Tbar) harmonic mean of group sizes
e(rank) rank of e(V)
Macros
e(cmd) xtreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(ivar) variable denoting groups
e(model) re
e(clustvar) name of cluster variable
e(chi2type) Wald; type of model chi-squared test
e(vce) vcetype specified in vce()
e(vcetype) title used to label Std. Err.
e(sa) Swamy-Arora estimator of the variance components (sa
only)
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok) predictions disallowed by margins
e(asbalanced) factor variables fvset as asbalanced
e(asobserved) factor variables fvset as asobserved
Matrices
e(b) coefficient vector
e(bf) coefficient vector for fixed-effects model
e(theta) theta
e(V) variance-covariance matrix of the estimators
e(VCEf) VCE for fixed-effects model
Functions
e(sample) marks estimation sample
xtreg, be stores the following in e():
Scalars
e(N) number of observations
e(N_g) number of groups
e(typ) WLS, if wls specified
e(mss) model sum of squares
e(df_m) model degrees of freedom
e(rss) residual sum of squares
e(df_r) residual degrees of freedom
e(ll) log likelihood
e(ll_0) log likelihood, constant-only model
e(g_min) smallest group size
e(g_avg) average group size
e(g_max) largest group size
e(Tcon) 1 if T is constant
e(r2) R-squared
e(r2_a) adjusted R-squared
e(r2_w) R-squared within model
e(r2_o) R-squared overall model
e(r2_b) R-squared between model
e(F) F statistic
e(rmse) root mean squared error
e(Tbar) harmonic mean of group sizes
e(rank) rank of e(V)
Macros
e(cmd) xtreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(ivar) variable denoting groups
e(model) be
e(title) title in estimation output
e(vce) vcetype specified in vce()
e(vcetype) title used to label Std. Err.
e(properties) b V
e(predict) program used to implement predict
e(marginsok) predictions allowed by margins
e(marginsnotok) predictions disallowed by margins
e(asbalanced) factor variables fvset as asbalanced
e(asobserved) factor variables fvset as asobserved
Matrices
e(b) coefficient vector
e(V) variance-covariance matrix of the estimators
Functions
e(sample) marks estimation sample
xtreg, fe stores the following in e():
Scalars
e(N) number of observations
e(N_g) number of groups
e(mss) model sum of squares
e(df_m) model degrees of freedom
e(rss) residual sum of squares
e(df_r) residual degrees of freedom
e(tss) total sum of squares
e(g_min) smallest group size
e(g_avg) average group size
e(g_max) largest group size
e(Tcon) 1 if T is constant
e(sigma) ancillary parameter (gamma, lnormal)
e(corr) corr(u_i, Xb)
e(sigma_u) panel-level standard deviation
e(sigma_e) standard deviation of epsilon_it
e(r2) R-squared
e(r2_a) adjusted R-squared
e(r2_w) R-squared within model
e(r2_o) R-squared overall model
e(r2_b) R-squared between model
e(ll) log likelihood
e(ll_0) log likelihood, constant-only model
e(N_clust) number of clusters
e(rho) rho
e(F) F statistic
e(F_f) F for u_i=0
e(df_a) degrees of freedom for absorbed effect
e(df_b) numerator degrees of freedom for F statistic
e(rmse) root mean squared error
e(Tbar) harmonic mean of group sizes
e(rank) rank of e(V)
Macros
e(cmd) xtreg
e(cmdline) command as typed
e(depvar) name of dependent variable
e(ivar) variable denoting groups
e(model) fe
e(wtype) weight type
e(wexp) weight expression
e(clustvar) name of cluster variable
e(vce) vcetype specified in vce()
e(vcetype) title used to label Std. Err.
e(properties) b V
e(predict) program used to implement predict
e(marginsnotok) predictions disallowed by margins
e(asbalanced) factor variables fvset as asbalanced
e(asobserved) factor variables fvset as asobserved
Matrices
e(b) coefficient vector
e(Cns) constraints matrix
e(V) variance-covariance matrix of the estimators
e(V_modelbased) model-based variance
Functions
e(sample) marks estimation sample
欢迎大家关注DataLearner官方微信,接受最新的AI技术推送
