Assume that I am using the auto dataset, and I am running a regression and I am interested in the variable foreign. For the placebo test, I am assigning random values to foreign, re-running the regression, and storing the coefficients of foreign in a matrix (this is what I managed to do, see the code below). How can I expand this matrix so that it also includes the s.e. and t-value?
Code:
sysuse auto, clear
regress price weight mpg foreign
count if foreign == 1
local numberforeign = r(N)
tempname resmat
forv i=1(1)10 {
gen randomorder = runiform()
sort randomorder
drop foreign
gen foreign = 0
replace foreign = 1 in 1/`numberforeign'
regress price weight mpg foreign
matrix `resmat'=nullmat(`resmat')\ e(b)
drop randomorder
}
matlist `resmat', format(%9.3f)
matrix V = `resmat'
matrix a = V[1..10 ,3..3]
mat list a
0 Response to Matrix with specific output
Post a Comment