Code:
sysuse auto regress price weight test _b[weight]=0 mat b = e(b) local constant : display %4.3f = b[1,2] display `constant' local x : display %4.3f = b[1,1] local r2 : display %5.4f = e(r2) local hats : display _skip(1) "̂" _skip(26) "̂" local heads_a "y=" local heads_b "x" local p_value : display %5.4f = r(p) twoway (scatter price weight) || /// (lfit price weight, /// caption("{subscript:`hats'}" "{superscript:`heads_a' `constant'+}{superscript:`x'`heads_b'+ε }" /// "{superscript:R-squred=`r2'}" /// "{superscript:P-value (x-hat): `p_value'}", justification(left) position(3)) legend(off)) ///