Hey 
I would like to make a scatter plot with p-value and r^2 included for a multiple linear regression. I have a continous dependent variable, a continous independent variable and a categorial independent variable (gender).
Earlier Benjamin Chartock, Nick Cox and Roman Mostazir helped me with a similar scatterplot for a simple linear regression (see under this section), and I imagine a scatterplot in the same style, but with a line for men and women separately in the same graph.
reg y-variable x-variable
test _b[x-variable]=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 y-variable x-variable) || ///
(lfit y-variable x-variable, ///
caption("{subscript:`hats'}" ///
"{superscript:`heads_a' `constant'+}{superscript:`x'`heads_b'}" ///
"{superscript:R-squared=`r2'}" ///
"{superscript:P-value : `p_value'}", justification(left) position(3)) legend(off))
I hope some of you can help.
Thank you, Kristine

I would like to make a scatter plot with p-value and r^2 included for a multiple linear regression. I have a continous dependent variable, a continous independent variable and a categorial independent variable (gender).
Earlier Benjamin Chartock, Nick Cox and Roman Mostazir helped me with a similar scatterplot for a simple linear regression (see under this section), and I imagine a scatterplot in the same style, but with a line for men and women separately in the same graph.
reg y-variable x-variable
test _b[x-variable]=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 y-variable x-variable) || ///
(lfit y-variable x-variable, ///
caption("{subscript:`hats'}" ///
"{superscript:`heads_a' `constant'+}{superscript:`x'`heads_b'}" ///
"{superscript:R-squared=`r2'}" ///
"{superscript:P-value : `p_value'}", justification(left) position(3)) legend(off))
I hope some of you can help.
Thank you, Kristine
Comment