Stata has a number of ways of making tables. Here are some alternative commands, and some tweaks that may be especially useful for multilevel models.
2 Data Source 🌲
The data used in this example are derived from the R package Functions and Datasets for “Forest Analytics with R”.
According to the documentation, the source of these data are: “von Guttenberg’s Norway spruce (Picea abies [L.] Karst) tree measurement data.”
The documentation goes on to further note that:
“The data are measures from 107 trees. The trees were selected as being of average size from healthy and well stocked stands in the Alps.”
3 Setup 🌲
clearall// clear workspaceuse"gutten.dta", clear// use tree data as exampledescribe// describe the data
Contains data from gutten.dta
Observations: 1,200
Variables: 9 19 Feb 2020 08:23
-------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
-------------------------------------------------------------------------------
site long %9.0g site site
location long %9.0g location location
tree long %9.0g tree
age_base long %9.0g age.base
height double %9.0g height
dbh_cm double %9.0g dbh.cm
volume double %9.0g volume
age_bh double %9.0g age.bh
tree_ID long %9.0g tree_ID tree.ID
-------------------------------------------------------------------------------
Sorted by:
4 Estimate a Multilevel Model 🌲
mixed height age_base i.site || tree_ID: // mixed modeleststore M1 // store the estimates (this would work with multiple stored estimates)
Performing EM optimization ...
Performing gradient-based optimization:
Iteration 0: Log likelihood = -3051.1192
Iteration 1: Log likelihood = -3051.1192
Computing standard errors ...
Mixed-effects ML regression Number of obs = 1,200
Group variable: tree_ID Number of groups = 107
Obs per group:
min = 5
avg = 11.2
max = 15
Wald chi2(5) = 8651.66
Log likelihood = -3051.1192 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
height | Coefficient Std. err. z P>|z| [95% conf. interval]
-------------+----------------------------------------------------------------
age_base | .2144446 .0023691 90.52 0.000 .2098014 .2190879
|
site |
2 | -3.316408 .4738969 -7.00 0.000 -4.245229 -2.387587
3 | -8.094846 .5358151 -15.11 0.000 -9.145024 -7.044667
4 | -11.50985 .5291215 -21.75 0.000 -12.54691 -10.47279
5 | -15.86582 .7116202 -22.30 0.000 -17.26057 -14.47107
|
_cons | 8.233362 .4092147 20.12 0.000 7.431316 9.035408
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects parameters | Estimate Std. err. [95% conf. interval]
-----------------------------+------------------------------------------------
tree_ID: Identity |
var(_cons) | 2.170508 .4004445 1.511891 3.116037
-----------------------------+------------------------------------------------
var(Residual) | 8.392966 .3586298 7.718693 9.12614
------------------------------------------------------------------------------
LR test vs. linear model: chibar2(01) = 135.90 Prob >= chibar2 = 0.0000
5 Use estimates table 🌲
estimatestable M1, b(%9.3f) star// nicely formatted table of results
Frustratingly, as you can see in Section 5, with multilevel models, the default behavior of estimates table is to report the \(ln\) of the random effects. Below, I use the , variance post option to post the variance rather than the logarithm of the variance.
Notice how , variance post essentially replays the results, but with the random effects as variances, rather than as the logarithm of the standard deviation.
mixed height age_base i.site || tree_ID: // mixed modelestatsd, variancepost// post results as variance scale rather than log scaleeststore M2 // store the estimates (this would work with multiple stored estimates)
7 Use estimates table To Compare These Approaches🌲
We Usually Use estimates table for Different Models
When used with multiple sets of estimates, we usually use estimates table to present the results of different models, rather than the same model presented in different ways. Below, however, for the sake of illustration, we present the same model in two different ways.
* nicely formatted tableof resultsestimatestable M1 M2, b(%9.3f) star///title("M1 and M2 are the Same Model Presented Differently")
There is also a very helpful export option for exporting these tables to a variety of ouput formats. See help etable in Stata for more information.
9 Add One More Set of Estimates for Illustration🌲
9.1 Multiple Estimates With estimates table🌲
mixed height age_base i.site i.location || tree_ID: // mixed modelestatsd, variancepost// post results as variance scale rather than log scaleeststore M3 // store the estimates (this would work with multiple stored estimates)esttable M2 M3, b(%9.3f) star