Stata Help

Dealing with Constants in Linear Regression with Stata

Stata defaults to including a constant term (0) also known as the intercept. However, you can speicfy , nocons to set the constant equal to zero if it makes conceptual sense. The example the Stata manual uses prsents a bivariate linear regression using length to predict weight. Since when length is zero, weight is zero, the , noconstant is used. For this example, the final command looks like regress weight length, nocons and the _cons line of output is no longer present in the table of regression coefficients.

Similar to nocons, Stata also offers a , hascons option. This is useful for cases where your model contains a set of mutually exclusive indicator variables. When you specify , hascons Stata will check to make sure a constant is in fact present. If it cannot find one, then it will display an error message "(note: hascons false) and calculate a constant variable (_cons). Additionally, as stated on the main regression page, Stata is always looking for collinear variables and dropping them, even when ,hascons is not specified. Dropped variables are indicated by having "(dropped)" beside them rather than a regression coefficient.

Back