I am confused why Stata OLS and Mata would give me different results, rather one of them is incorrect for the same data.
See the following dataset and the output from Stata OLS and Mata code provided in Stata Blog by David Drukker https://blog.stata.com/2016/01/12/pr...nd-using-mata/.
OLS results
Mata code
See the following dataset and the output from Stata OLS and Mata code provided in Stata Blog by David Drukker https://blog.stata.com/2016/01/12/pr...nd-using-mata/.
Code:
clear input double(y x1 x2 x3 x4 x5 x6) -.053244516 .74 -1.56 .95 -.18 -1.46 -.109749 .06378974 .74 -1.56 .95 -.18 -1.46 -.109749 .021148825 .74 -1.56 .95 -.18 -1.46 -.109749 -.055137638 .74 -1.56 .95 -.18 -1.46 -.109749 -.04604394 .74 -1.56 .95 -.18 -1.46 -.109749 .005379249 .74 -1.56 .95 -.18 -1.46 -.109749 -.003599284 .74 -1.56 .95 -.18 -1.46 -.109749 -.041651525 .74 -1.56 .95 -.18 -1.46 -.109749 -.029081209 .74 -1.56 .95 -.18 -1.46 -.109749 .11075136 .74 -1.56 .95 -.18 -1.46 -.109749 -.004830927 .74 -1.56 .95 -.18 -1.46 -.109749 -.036290001 .74 -1.56 .95 -.18 -1.46 -.109749 .052939385 .74 -1.56 .95 -.18 -1.46 -.109749 .010752792 .74 -1.56 .95 -.18 -1.46 -.109749 -.017558312 .74 -1.56 .95 -.18 -1.46 -.109749 -.092018902 .74 -1.56 .95 -.18 -1.46 -.109749 -.007434979 .74 -1.56 .95 -.18 -1.46 -.109749 -.005221944 .74 -1.56 .95 -.18 -1.46 -.109749 -.005797118 .74 -1.56 .95 -.18 -1.46 -.109749 .013793322 .74 -1.56 .95 -.18 -1.46 -.109749 .063281447 .74 -1.56 .95 -.18 -1.46 -.109749 .00873368 .74 -1.56 .95 -.18 -1.46 -.109749 -.026145279 .74 -1.56 .95 -.18 -1.46 -.109749 -.001409444 .74 -1.56 .95 -.18 -1.46 -.109749 .017094433 .74 -1.56 .95 -.18 -1.46 -.109749 -.021337137 .74 -1.56 .95 -.18 -1.46 -.109749 -.081678033 .74 -1.56 .95 -.18 -1.46 -.109749 0 .74 -1.56 .95 -.18 -1.46 -.109749 -.023657016 .74 -1.56 .95 -.18 -1.46 -.109749 -.025943395 .74 -1.56 .95 -.18 -1.46 -.109749 -.021053409 .74 -1.56 .95 -.18 -1.46 -.109749 -.018648559 .74 -1.56 .95 -.18 -1.46 -.109749 .033170536 .74 -1.56 .95 -.18 -1.46 -.109749 -.058127742 .74 -1.56 .95 -.18 -1.46 -.109749 .010582109 .74 -1.56 .95 -.18 -1.46 -.109749 .020438667 .74 -1.56 .95 -.18 -1.46 -.109749 .006299234 .74 -1.56 .95 -.18 -1.46 -.109749 -.007017573 .74 -1.56 .95 -.18 -1.46 -.109749 .027920596 .74 -1.56 .95 -.18 -1.46 -.109749 .038655818 .74 -1.56 .95 -.18 -1.46 -.109749 -.034916267 .74 -1.56 .95 -.18 -1.46 -.109749 .037139546 .74 -1.56 .95 -.18 -1.46 -.109749 .064247444 .74 -1.56 .95 -.18 -1.46 -.109749 .009569451 .74 -1.56 .95 -.18 -1.46 -.109749 .032088313 .74 -1.56 .95 -.18 -1.46 -.109749 .00925543 .74 -1.56 .95 -.18 -1.46 -.109749 0 .74 -1.56 .95 -.18 -1.46 -.109749 .014764607 .74 -1.56 .95 -.18 -1.46 -.109749 -.050643735 .74 -1.56 .95 -.18 -1.46 -.109749 -.050325084 .74 -1.56 .95 -.18 -1.46 -.109749 -.021739986 .74 -1.56 .95 -.18 -1.46 -.109749 -.04284016 .74 -1.56 .95 -.18 -1.46 -.109749 -.033662669 .74 -1.56 .95 -.18 -1.46 -.109749 end
Code:
reg y x1-x6 Source | SS df MS Number of obs = 53 -------------+---------------------------------- F(0, 52) = 0.00 Model | 0 0 . Prob > F = . Residual | .077875744 52 .00149761 R-squared = 0.0000 -------------+---------------------------------- Adj R-squared = 0.0000 Total | .077875744 52 .00149761 Root MSE = .0387 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | 0 (omitted) x2 | 0 (omitted) x3 | 0 (omitted) x4 | 0 (omitted) x5 | 0 (omitted) x6 | 0 (omitted) _cons | -.0046275 .0053157 -0.87 0.388 -.0152943 .0060392 ------------------------------------------------------------------------------
Code:
. myregress11 y x1-x6 ------------------------------------------------------------------------------ | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | 0 (omitted) x2 | .0029664 .0034075 0.87 0.388 -.0038713 .009804 x3 | 0 (omitted) x4 | 0 (omitted) x5 | 0 (omitted) x6 | 0 (omitted) _cons | 0 (omitted) ------------------------------------------------------------------------------
Comment