Anda di halaman 1dari 2

clear

capture log close


use twobytwo.dta
log using twobytwo.log, replace
/* We begin by looking at average values of opp across our four groups */
foreach x of varlist fem_int fem_ext mal_int mal_ext{
summ opp if `x'==1
}
/* The above shows, respectively, the mean of opp for the fem_int, fem_ext,
mal_int, mal_ext groups. Perceived fraud opportunity is highest for the
male extrovert group and lowest for the male introvert group.
Next, we run a regression model without a constant term. This will give us
the means of each group, but the stock output will not tell us directly
if the differences in groups are significant. */
reg opp fem_int fem_ext mal_int mal_ext, nocons
/* The means for each group are identical using -summ- or -reg-. Next, we run a
regression model with a constant term, the two indicator variables, and the
interaction. Since we have an indicator equal to one for female and a second
indicator equal to one for introvert, male extroverts are our base group.
Accordingly, we expect B0 in the regression to be equal to 69.4814 since
this is the mean of opp for the base group. Since B1 is related to the gender
indicator variable, adding B0 to B1 gives us the mean of female extroverts.
Since the mean of male extroverts if 69.4814, and the mean of female
is 64.875,we expect B1 to equal 64.875 - 69.4184= -4.6064. B2 is the indicator
variable for personality. Adding B0 to B2 gives us the mean of the male
introvert group which we know is 55.75. Accordingly, we expect B2 to be equal
to 55.75 - 69.4184 = -13.7314. Next is the potentially tricky part: Ask yourself
what our expectation is for the parameter estimate of the interaction term? We
already have male extroverts (B0), female extroverts (B0 + B1), and male
introverts (B0 + B2). We need to estimate the difference between male extroverts
and female introverts. Let's come back to this after looking at the below
regression output */
reg opp gen1 pers1 gen_pers
/* We can see that B0 is equal to 69.4814, B1 is equal to -4.6064, and B2
is equal to -13.7314. All of this matches to what we expected based on manual
calculations of mean differences across the groups. Back to the question
about the expectation of the parameter estimate for B3. We know the mean opp for
male extroverts is 69.4184 and the mean opp for female introverts is 58.6538.
It might be tempting to then say that we therefore expect B3 to be equal to
58.6538 - 69.4814 = -10.8276 , but that is not the result we get. B3 is equal to
7.5103. Why is this? It is because in our female introverts group, we also
have to add in the indicator variable for female and the indicator variable
for personality to the interaction term. These are women, so you add the female
indicator variable. These are introverts, so you add the personality indicator
variable. They also need the interaction term added, as well. If we write the
difference as B0 + B1 + B2 + B3= the mean opportunity for female introvert,
and we already know what B0, B1, B2 and the mean opportunity for female
introverts, we can solve for B3. 69.4814 -4.6064 - 13.7314 + x= 58.6538.
This gives us an anticipated value of B3= 7.5102 which, with rounding,
is what we obtain from the regression. Return to the Wooldridge
example of the difference-in-differences estimator, as well. B3 here is our
difference-in-differences estimator, which gives us the difference in

mean opportunity for male extroverts and female extroverts minus the difference
in mean opportunity for male introverts and female introverts. This may be
seen below */
reg opp fem_int fem_ext mal_int mal_ext, nocons
/* Estimate the difference in means for male_ext and fem_ext minus the
difference in means for mal_int and fem_int and obtain the standard error
of the difference. */
di (69.48148 - 64.875) - (55.75 - 58.65385)
reg opp gen1 pers1 gen_pers
/* The gen_pers parameter estimate agrees to the above and we automatically
have the standard error of this difference. */
/* Next, we turn to various methods to test the statistical significance
between the difference in mean opp for male extroverts and female introverts.
This can be done estimating the mean of each group using regression
without a constant term.... */
reg opp fem_int fem_ext mal_int mal_ext, nocons
test _b[mal_ext]== _b[fem_int]
/* ... or by using a regression with a constant term and testing a linear
combination of parameters. Note here the appropriate test is not
_b[gen1] = _b[pers1] = _b[gen_pers] =0. We aren't testing that each are equal
to zero, but rather that the sum is equal to zero. */
reg opp gen1 pers1 gen_pers
test _b[gen1] + _b[pers1] + _b[gen_pers]=0
/* t test vs. regression for difference in means between male extroverts and
female extroverts. */
reg opp gen1
ttest opp, by(gen1)
/* Above results are equivalent. */

Anda mungkin juga menyukai