Hello everyone,
I am trying to regress 15 separate dependent variables (Country Index returns) with their corresponding (10) indepepent variables (Industrial Benchmark returns excluding the country)
on an annual basis (17years, weekly interval, 52 observations / year).
My aim is to extract the r squared from those regressions in a separate collumn for each regression.
Additionally I want to impose two restrictions on my coefficients, specifically that all β's are non-negative and Σβ=1.
I think that the most convenient way to do it is to align all my variables vertically, define an index value for each Year/variable and loop my regression through each index value
(i.e. Index value 18 will be the 1st year of the 2nd country).
I also understand that the constraint command does not work for innequalities, but I don't really understand the previous discussions and solutions that have been provided throughout the years. I am hoping that someone could clarify for me a bit the solution to this issue.
Bellow is the code I have understood so far that I should use, using the grunfeld dataset as an example.
clear
webuse grunfeld
constraint define 1 invest + mvalue=1
constraint define 2 invest > 0 mvalue > 0 // My main question
forvalues i=1(1)10{
quietly cnsreg company invest mvalue if company == i, c(1,2) //"No observations" message from Stata
generate Rsq_`i' = e(r2) // I think this part is also incorrect
}
End of code.
Stata version 15.1
I would appreciate some help on my inquiries and I hope this post satisfies the forum guidelines.
Regards,
Georgios
Related Posts with Constraint Regressions with a loop and saving the parameters for every year.
How to model change over timeHello, I have panel data and my goal is to model the change over time of my dependent variable. Mor…
Erase blank spaces from a twoway graphDear Statalist, I would like to create a graph (twoway scatter) using the by() option for some group…
Forvalue loop in self-design bootstrapI am a beginning learner of Mata, and I came across a feedback of "break" when running the code belo…
marginsplot after ordered logit modelHi there, I've been struggling with getting my marginsplot the way I would like it. I will use the …
How to draw this kind of figure (for panel data)?Dear All, I found this question here (https://bbs.pinggu.org/thread-7427842-1-1.html, in Chinese). T…
Subscribe to:
Post Comments (Atom)
0 Response to Constraint Regressions with a loop and saving the parameters for every year.
Post a Comment