I'd like to create a table summarizing results from several models by having a column with the coefficient and confidence intervals in a single row, with the models running across the table. I've gotten close with the help of the table builder, but found some odd behavior that I can't understand.
So far so good, though it has not trimmed the space out of the confidence interval, and I would modestly prefer parentheses to brackets for the confidence interval. But I looked at the description of the layout that Table Builder created for me and saw the column stars[value]. I don't want significance stars, so when I went to write my code for the change in layout, I removed that from the column specification, and when I did, the table only provided the confidence interval, with no brackets around it and no _r_b.
Where am I going wrong?
Code:
clear
webuse kva
stset failtime
streg load bearings, distribution(weibull) time tratio
gen notbearings=0 if bearings==1
replace notbearings=1 if bearings==0
streg load bearings, distribution(weibull) time tratio
eststo bearings
streg load notbearings, distribution(weibull) time tratio
eststo notbearings
collect clear
etable, estimates(bearings notbearings) cstat(_r_b) cstat(_r_ci) column(estimates)
collect style cell result[_r_ci], warn cidelimiter(`","')
collect composite define coefci = _r_b _r_ci, trim replace
collect layout ( coleq#colname#result[coefci] result[N]) (etable_estimates#stars[value])
Collection: ETable
Rows: coleq#colname#result[coefci] result[N]
Columns: etable_estimates#stars[value]
Table 1: 8 x 2
------------------------------------------------------------------------------
bearings notbearings
------------------------------------------------------------------------------
Overload (kVA) 0.941 [0.930, 0.953] 0.941 [0.930, 0.953]
Has new bearings 1.239 [1.070, 1.434]
notbearings 0.807 [0.697, 0.934]
Intercept 330.643 [234.533, 466.139] 409.656 [286.257, 586.248]
ln_p 2.052 [1.597, 2.506] 2.052 [1.597, 2.506]
p 7.780 [4.940, 12.252] 7.780 [4.940, 12.252]
1/p 0.129 [0.082, 0.202] 0.129 [0.082, 0.202]
Number of observations 12 12
------------------------------------------------------------------------------
So far so good, though it has not trimmed the space out of the confidence interval, and I would modestly prefer parentheses to brackets for the confidence interval. But I looked at the description of the layout that Table Builder created for me and saw the column stars[value]. I don't want significance stars, so when I went to write my code for the change in layout, I removed that from the column specification, and when I did, the table only provided the confidence interval, with no brackets around it and no _r_b.
Code:
collect layout ( coleq#colname#result[coefci] result[N]) (etable_estimates)
Collection: ETable
Rows: coleq#colname#result[coefci] result[N]
Columns: etable_estimates
Table 1: 8 x 2
------------------------------------------------------------------
bearings notbearings
------------------------------------------------------------------
Overload (kVA) 0.930, 0.953 0.930, 0.953
Has new bearings 1.070, 1.434
notbearings 0.697, 0.934
Intercept 234.533, 466.139 286.257, 586.248
ln_p 1.597, 2.506 1.597, 2.506
p 7.780 4.940, 12.252 7.780 4.940, 12.252
1/p 0.129 0.082, 0.202 0.129 0.082, 0.202
Number of observations 12 12
------------------------------------------------------------------

Comment