Hi Statalisters,
I fitted a model both with NLS and MLE, so I'd like to produce a table with the estimates for the same independent variable in the same row, like this one:

I've tried with -esttab- to get the table, but I'm basically still in this stage:
As you can see, estimates for the same variable are shown in different parts of the table depending on the estimation method. I tried the -esttab- options -rename- and -coeflabels-, but I couldn't produce a meaningful progress. For example,
Any suggestions are welcome! Thank you.
I fitted a model both with NLS and MLE, so I'd like to produce a table with the estimates for the same independent variable in the same row, like this one:
I've tried with -esttab- to get the table, but I'm basically still in this stage:
Code:
. sysuse auto, clear
. // NLS estimates
. generate const = 1
. eststo nls: qui nl (price = exp({xb: mpg weight foreign const})), nolog
. // MLE Estimates
. eststo mle: qui mlexp (exp({theta})*-{b:mpg weight foreign _cons} ///
> - lngamma(exp({theta})) ///
> + (exp({theta})-1)*ln(price) - exp(-{b:})*price), nolog
. nlcom (theta: exp(_b[theta:_cons]))
theta: exp(_b[theta:_cons])
------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
theta | 13.94963 2.266414 6.15 0.000 9.507538 18.39172
------------------------------------------------------------------------------
. // Tabulate NLS and MLE estimates
. esttab nls mle, nonumber nostar se mtitle("NLS" "MLE")
--------------------------------------
NLS MLE
--------------------------------------
main
_cons 0.00489 2.635
(0.0102) (0.162)
--------------------------------------
xb_weight
_cons 0.000660
(0.0000853)
--------------------------------------
xb_foreign
_cons 0.777
(0.105)
--------------------------------------
xb_const
_cons 6.316
(0.473)
--------------------------------------
b
mpg 0.000612
(0.00930)
weight 0.000471
(0.0000758)
foreign 0.525
(0.0825)
_cons 4.450
(0.447)
--------------------------------------
N 74 74
--------------------------------------
Standard errors in parentheses
Code:
. local coeflab xb_mpg:_cons mpg xb_weight:_cons weight xb_foreign:_cons foreign
. local rename xb_cons:_weight weight
. esttab nls mle, nonumber nostar se mtitle("NLS" "MLE") ///
> coeflabels(`coeflab') rename(`rename')
--------------------------------------
NLS MLE
--------------------------------------
main
_cons 0.00489 2.635
(0.0102) (0.162)
--------------------------------------
xb_weight
weight 0.000660
(0.0000853)
--------------------------------------
xb_foreign
foreign 0.777
(0.105)
--------------------------------------
xb_const
_cons 6.316
(0.473)
--------------------------------------
b
mpg 0.000612
(0.00930)
weight 0.000471
(0.0000758)
foreign 0.525
(0.0825)
_cons 4.450
(0.447)
--------------------------------------
N 74 74
--------------------------------------
Standard errors in parentheses

Comment