Dear All,
I'm struggling with the following problem. I have a panel dataset with return and marketcap data on various securities. Besides I have dummies for industry and country. See sample below:
I want to run a regression with a dummy for all countries and industries without omitting dummies. I want to realize this by restricting my regression such that the sum of all industry dummy betas times their number of securities in that specific industry is zero, and the same for all country dummy betas. Mathematically this solves the problem of multicollinearity only I don't know how to realize this in stata.
I already tried the following code:
The problem with this code is that it does not work for panel data and that it still omits two dummies, one industry and one country.
Perhaps some of you can help me with this interesting case?
I'm struggling with the following problem. I have a panel dataset with return and marketcap data on various securities. Besides I have dummies for industry and country. See sample below:
Code:
input int(date _j) double return long marketcap byte industry str14 country 14252 295 -.029411764705882495 207874 3 "Austria" 14259 319 -.03891233005157064 552000 2 "Austria" 14266 339 -.025473071324599684 4299390 7 "Portugal" 14273 301 0 609427 8 "Portugal" 14280 327 . 130248 3 "Germany" 14287 319 -.08069414316702818 552000 2 "Germany" 14294 307 -.004160887656033322 228750 8 "France" 14301 337 0 46500 8 "France"
I already tried the following code:
Code:
bysort _j: drop if industry==. levelsof country1, local(country1) levelsof industry, local(industry) local country1_constraint 0 local industry_constraint 0 foreach c of local country1 { count if country1 == `c' local country1_constraint `country1_constraint' + `r(N)'*cc`c' gen byte cc`c' = `c'.country1 } foreach i of local industry { count if industry == `i' local industry_constraint `industry_constraint' + `r(N)'*ii`i' gen byte ii`i' = `i'.industry } display `"`industry_constraint'"' constraint def 1 `country1_constraint' = 0 constraint def 2 `industry_constraint' = 0 cnsreg ret cc* ii*, noconstant constraints(1 2)
Perhaps some of you can help me with this interesting case?
Comment