# dummy variables and cross section data

I am building a linear regression model to analyze one cross-sectional dataset. In my dataset, there is one string variable called "firm_name", which includes 100 firms(name1, name2, name3....name100). I converted the 'firm_name' from string to numerical(the new variable's name is 'firm_id'), the values become 1, 2, 3 ....100 (name1 becomes 1, names 2 becomes 2, name3 becomes 3....name100 beocmes 100). I added firm_id dummy variables into regression by using i.firm_id to control the unobserved factors and got the parameter(Beta1)'s value of an interested variable(X1). Then, I reordered the value of firm_id (1 becomes 31, 2 becomes 32, 3 become 33,.... 70 becomes 100, and 71 becomes 1.... 100 becomes 30), I run the regression again with the firm_id dummy variables and got a new value of the parameter(Beta1) of the interested variable(X1). But I thought I should got a same value. Do you know why this happened? Thank you.

• It may help to make your post a bit more clear, and maybe even provide some simulated toy example of your issue (which may also help you solve the problem). Additionally, the true solution will probably be a coding one, though I realize there may be some confusion about baseline changing meaning depending on dummies used, which has statistical merit. – doubled Jun 16 at 2:55

3. (if the interested variable is also a categorical, or the intercept, or something similar) Whatever program you used, it is probably omitting the constant, and instead using the dummies, and so you have some issue with the baseline changing. Effects are relative, and by re-labeling firms, you're changing the baseline. To make this clear, suppose you have outcome $$Y$$ and dummies $$W_1,W_2$$ (suppose $$W_1$$ is dummy for male, and $$W_2$$ is dummy for female (you can replace them with firm1 and firm2 if you'd like). If you ran a linear regression by providing $$(Y,W_1,W_2)$$, most software will recognize multicollinearity of $$W_1,W_2$$ and a constant, so it will omit one. If $$W_2$$ is omitted, then you have $$Y = a_1 + a_2W_1$$, so the baseline is $$W_1 = 0$$. In contrast, if $$W_1$$ was omitted, you'd have $$Y = a_1' + a_2'W_2$$, so baseline is $$W_2 = 0$$, and so the interpretation of $$a_1$$ versus $$a_1'$$ is different, and thus affected.