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
Can I use a multinomial logit regression analysis using cubic polynomial of time to control time dependence?If not, which method should I use to control time dependence? My dependent variable is categorial. T…
Missing yearly observation - Panel dataI've got panel data from 2009-2016. Some individuals don't have data for the entire period. ID year…
Poisson distributionHi, if I want to generate a distribution of Poisson probability with the λ per period starting from …
Sharp RD estimation - "Mass points detected in the running variable." issue - 0 nb of observationsDear all, I am currently trying to use a Regression Discontinuity specification to try to estimate …
Can I use Kaplan-Meier estimator to predict duration of a treatment?Hi, I don't have much experience with STATA, and so I'm in need for some help. I have a dataset of a…
Subscribe to:
Post Comments (Atom)
0 Response to Correct use of constraint in foreach cycle
Post a Comment