# multiple regression with two dummy variables - calculating difference between groups

I am running a multiple regression:

Visits to a tourist attraction = 𝛽0 + 𝛽1ticket price + 𝛽2income + 𝛽3 age + 𝛽4female + 𝛽5local (local vs foreign visitors)

I wonder how to 1) calculate the difference between genders and 2) how to test the equivalence of the regression among local and foreign visitors?

I am new to such analysis and would appreciate your help.

• What tool are you using (if any) to calculate the regression? Most will give you a p-value for each coefficient, which you can compare to your required significance (generally 0.05) - I agree with E. Sommer below for question 1 :) – MikeP Oct 19 '18 at 12:03
• Your question "how to test the equivalence of the regression among local and foreign visitors?" implies that you want to know if the other coefficients (ticket price, income, age) differ between local and foreign visitors. Your model as stated doesn't allow for that. If that is what you are interested in, then you need to add interaction terms between local and the other variables. Read up on who to do this before doing it as it is more complicated (particularly interpreting) then it may seem (e.g., what happens to the main effects). – dbwilson Oct 19 '18 at 15:12

In the model you specified, $$\beta_3$$ would give you the difference between males and females, conditional on ticket price, income, age and origin. Likewise, $$\beta_5$$ would give you the conditional difference between locals and foreigners. If the confidence interval of $$\beta_5$$ is strictly positive or negative, you have a stastistically significant difference between the two groups. As a rule of thumb, you can multiply the standard error of the coefficient by 2. If this is below the absolute value of the coefficient, your result is approx. significant at the 5% level.

It might be that you are not interested in these conditional means. In that case, you need to remove some of the other variables from the model.

• I am using Stata – skirma stasenaite Oct 19 '18 at 12:10
• As MikeP mentions above, the standard regression output of Stata gives you the 95% confidence interval. – E. Sommer Oct 19 '18 at 12:12

One thing that may not be apparent is that linear regression can be used as a t-test:

clear
sysuse auto
ttest price, by(foreign)


Here you can see the output:

------------------------------------------------------------------------------
Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]
---------+--------------------------------------------------------------------
Domestic |      52    6072.423    429.4911    3097.104    5210.184    6934.662
Foreign |      22    6384.682    558.9942    2621.915     5222.19    7547.174
---------+--------------------------------------------------------------------
combined |      74    6165.257    342.8719    2949.496    5481.914      6848.6
---------+--------------------------------------------------------------------
diff |           -312.2587    754.4488               -1816.225    1191.708
------------------------------------------------------------------------------
diff = mean(Domestic) - mean(Foreign)                         t =  -0.4139
Ho: diff = 0                                     degrees of freedom =       72

Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
Pr(T < t) = 0.3401         Pr(|T| > |t|) = 0.6802          Pr(T > t) = 0.6599


The mean price for domestic cars is 6072.4, and that for foreign cars is 6384.7. The difference is about -312.3 dollars (95%CI -1816.2, 1191.8) with a p-value of 0.6802.

Now, we can recast it as a linear regression. The coding scheme for foreign is:

. codebook foreign

--------------------------------------------------------------------------------------------
foreign                                                                             Car type
--------------------------------------------------------------------------------------------

type:  numeric (byte)
label:  origin

range:  [0,1]                        units:  1
unique values:  2                        missing .:  0/74

tabulation:  Freq.   Numeric  Label
52         0  Domestic
22         1  Foreign


And the linear regression is:

. reg price foreign

Source |       SS           df       MS      Number of obs   =        74
-------------+----------------------------------   F(1, 72)        =      0.17
Model |  1507382.66         1  1507382.66   Prob > F        =    0.6802
Residual |   633558013        72  8799416.85   R-squared       =    0.0024
Total |   635065396        73  8699525.97   Root MSE        =    2966.4

------------------------------------------------------------------------------
price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
foreign |   312.2587   754.4488     0.41   0.680    -1191.708    1816.225
_cons |   6072.423    411.363    14.76   0.000     5252.386     6892.46
------------------------------------------------------------------------------


Given the regression formula:

$$\text{Price} = 6072.4 + 312.3\times\text{Foreign},$$

where "Foreign" = 0 for domestic cars and = 1 for foreign cars.

For domestic car, the average price is just the constant (or intercept) which is 6072.4.

For foreign car, the average price is 6072.4 + 312.3.

Notice that, the mean difference 312.3 is the same as the regression coefficient here. Their p-values and 95%CI are also the same. The sign being flipped was due to the fact that t-test looks as the difference as (domestic - foreign) and regression considers (foreign - domestic.)

In your case, the analogy to t-test still works, but now your multiple regression also permits adjusting for other variables.

Thanks for all for valuable advice. I am now wondering if it would be wrong to create interaction terms not only testing for the equivalence of the regression among local and foreign visitors but also between female and other variables to find the difference between genders?

If I included the interaction terms for female dummy, the model would look like this:

Visits to a tourist attraction = 𝛽0 + 𝛽1ticket price + 𝛽2income + 𝛽3age + 𝛽4female + 𝛽5local + 𝛽6ticket price x female + 𝛽7income x female + 𝛽8age x female + 𝛽9local x female

Then the difference between female and male would be B4 + 𝛽6ticket price + 𝛽7income + 𝛽8age + 𝛽9local?