Good day all,
Please, I need the Stata command to write out my model with the estimated coefficients. For instance, I have done the following regression with 10 explanatory variables in Stata:
newey LIS prevLIS imports equities infotechperm sqrcostofadmin investmenteducation sqrgdppercapita VASmanu corruptionindexr VASagric, lag(0)
I followed this code to generate the equation:
sysuse auto
regress mpg weight
matrix m = e(b)
local a = m[1,2]
local b = m[1,1]
file open dofile using "dofile.do", read write
file write dofile "gen y = `a' + `b'*weight"
file close dofile
The file "dofile.do", which you can apply to the external data, contains this line:
Code:
gen y = 39.44028353071797 + -.0060086868119993*weight
Here is what I came up with:
matrix m = e(b)
local a = m[1,11]
local b = m[1,10]
file open dofile using "dofile.do", read write
file write dofile"gen LIS = ‘a’ + _’b’*prevLIS +_’b’*imports + _’b’*equities + _’b’*infotechperm + _’b’*sqrcostofadmin + _’b’*investmenteducation + _’b’*sqrgdppercapita + _’b’* VASmanu + _’b’*corruptionindexr + _’b’*VASagric, lag(0)"
file close dofile
gen LIS = 5.53409598195157 + _'b'*prevLIS +_'b'*imports + _'b'*equities + _'b'*infotechperm + _'b'*sqrcostofadmin + _'b'*investmenteducation + _'b'*sqrgdppercapita + _'b'* VASmanu + _'b'*corruptionindexr + _'b'*VASagric, lag(0)0)
The output in my dofile only shows the constant as shown above.
What should I do to generate the equation with all the coefficients?
Thank you.
Florence Ijagbone
Please, I need the Stata command to write out my model with the estimated coefficients. For instance, I have done the following regression with 10 explanatory variables in Stata:
newey LIS prevLIS imports equities infotechperm sqrcostofadmin investmenteducation sqrgdppercapita VASmanu corruptionindexr VASagric, lag(0)
I followed this code to generate the equation:
sysuse auto
regress mpg weight
matrix m = e(b)
local a = m[1,2]
local b = m[1,1]
file open dofile using "dofile.do", read write
file write dofile "gen y = `a' + `b'*weight"
file close dofile
The file "dofile.do", which you can apply to the external data, contains this line:
Code:
gen y = 39.44028353071797 + -.0060086868119993*weight
Here is what I came up with:
matrix m = e(b)
local a = m[1,11]
local b = m[1,10]
file open dofile using "dofile.do", read write
file write dofile"gen LIS = ‘a’ + _’b’*prevLIS +_’b’*imports + _’b’*equities + _’b’*infotechperm + _’b’*sqrcostofadmin + _’b’*investmenteducation + _’b’*sqrgdppercapita + _’b’* VASmanu + _’b’*corruptionindexr + _’b’*VASagric, lag(0)"
file close dofile
gen LIS = 5.53409598195157 + _'b'*prevLIS +_'b'*imports + _'b'*equities + _'b'*infotechperm + _'b'*sqrcostofadmin + _'b'*investmenteducation + _'b'*sqrgdppercapita + _'b'* VASmanu + _'b'*corruptionindexr + _'b'*VASagric, lag(0)0)
The output in my dofile only shows the constant as shown above.
What should I do to generate the equation with all the coefficients?
Thank you.
Florence Ijagbone

Comment