Hi, I would like to set constraints later use them in a program. Here is a small example:
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
constraint `ind' `var'=_b[`var']
local ++ind
}
What I get is
. constraint list
1: weight=_b[weight]
2: mpg=_b[mpg]
So, my question is why my constraints do not have numbers, representing regression coefficients on the right hand sides?
I also tried modification:
sysuse auto, clear
regress price weight mpg
local indep "weight mpg"
local ind=1
foreach var of varlist `indep' {
local b`var'=_b[`var']
constraint `ind' `var'=`bvar'
local ++ind
}
but then I get
. constraint list
1: weight=
2: mpg=
Again no numbers, just blanks.
Related Posts with Correct use of constraint in foreach cycle
Storing loop regression outputsHello everyone, I'm trying to run the below loop and store the estimates of each regression model; …
Difference in Difference (DiD) within GMMHello everyone, I am trying to work out how to complete a DiD (difference in difference) analysis w…
SignificanceHi guys. For my research (Master Thesis) I have two control variables on segments: one for the numb…
Fama Macbeth cross sectional regressionHello, I want to run Fama Macbeth cross sectional regression of monthly excess return of 500 securit…
Logit / probit regression with binary endogenous explanatory variableDear all, I am currently facing an issue with regard to binary endogenous explanatory variables in p…
Subscribe to:
Post Comments (Atom)
0 Response to Correct use of constraint in foreach cycle
Post a Comment