I wrote a program that computes a weighted regression and now I want my estimation results to be stored as an e(b) vector so that the bootstrap command can easily access the results, but I keep getting an error. My program looks like:
capture program drop mytest
program mytest, eclass
version 13
syntax varlist [if]
marksample touse
// mata subroutine creates matrix `b', such as mata: bla("`varlist'", "`touse'")
tempname b
matrix `b' = (1\2\3)
ereturn post `b'
end
mytest town_id
ereturn list
But I keep getting a conformability error r(503);
upon running the script. When I instead post an ordinary matrix such as ereturn matrix x = b
, everything works fine but I would like to have my coefficients stored 'properly' in an e(b)
vector.
I checked Stata's documentation but was unable to find out why this is not working. Their advice is to code
tempname b V
// produce coefficient vector `b' and variance–covariance matrix `V'
ereturn post `b' `V', obs(`nobs') depname(`depn') esample(`touse')
The options of ereturn post are all optional. Could anyone tell me what I am missing here? Thanks!