Econ 257 D1 Quiz

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/70

encourage image

There's no tags or description

Looks like no tags are added yet.

71 Terms

1
New cards

common/general time trend

the trajectory of the variable regardless of treatment

2
New cards

parallel-trends assumption

absent the reform, the treated group would have followed the same trend as the control group; check that the two groups moved in parallel in the years before the reform, parallel pre-trends make the assumption credible; diverging pre-trends make doubt

3
New cards

counterfactual

dashed line on diff-in-diff graph, where the treated group would have been without the reform (its before level, carried forward along the control’s trend)

4
New cards

longitudinal data (or panel or cross-sectional time-series)

data with several units followed over several periods

5
New cards

why is a single country bad as a control group?

A single control is

1. sensitive to whatever happens in that one country (a drought, a crisis, a data revision there would masquerade as a treatment effect)

2. open to the charge of cherry-picking, choosing the one control that gives the answer you want

6
New cards

a convincing control group of countries

several logical, natural control countries, or a regional group that excludes the treated country, and present 3–4 control groups

7
New cards

does a DID solve third variable problem

mostly, but not when third variable drove the reform. defences: choose as-exogenous reforms, always show pre-trends, use a triple difference, and keep the time horizon short

8
New cards

difference-in-difference

(Y_Tafter − Y_Tbefore) − (Y_Cafter − Y_Cbefore)

9
New cards

triple difference

two groups in same country, one affected by reform and one unaffected, if the unaffected group moves there is evidence other things are moving

10
New cards

short vs long time horizons

in the long run many other things can happen, but in short time we miss the long-run effects of the reform

11
New cards

falsification

use a variable knowingly not affected by the reform, should not change, otherwise might indicate something like good government

12
New cards

true effect of t with bias

yi=a+bTi+cAi

from which you find

yt-yc=b+c(At-Ac)

where b is the true effect and c(At-Ac) is bias

13
New cards

why RTC works

If treatment is assigned at random, then who is treated has nothing to do with ability, so on average A_T = A_C and the bias term vanishes. Nothing causes the treatment (it is random), so the outcome cannot be causing it either: the arrow can only run treatment → outcome

14
New cards

Parametric vs nonparametric

t-test is parametric (normal distribution, summarized by parameters (the mean and the variance), permutation test is nonparametric (t needs no normality and no variance formula, and no t-table)

15
New cards

ttest

ttest Y, by(varT) [reverse] [level (#)]

16
New cards

whisker plot

preserve

ttest Y, by(T)

generate diff = r(mu_2) - r(mu_1)

generate hi = diff + invttail(r(df_t), 0.025) * r(se)

generate lo = diff - invttail(r(df_t), 0.025) * r(se)

keep in 1

generate x = 1

twoway (scatter diff x) ///

(rcap hi lo x), ///

yline(0, lpattern(dash)) ylabel(0(1)5) legend(off) ///

xlabel(0.5 " " 1 " " 1.5 " ", noticks) xtitle("") ///

title(" ")

graph export " .ghp", replace

restore

17
New cards

the sample mean is unbiased: E( Y_) = μ. Explain in words what this means

If we redid the sample many times (a million times), the average of all the Y_’s would be exactly the true population mean μ. One sample can miss, but Y_ is not off on average. If we drew many samples, the average of all the Y_ would be the true mean

18
New cards

pooled ttest requires

assuming equal variances in both groups, if not we can use the welch test, but it’s not ideal bc formula for df is complicated

19
New cards

efficiency

Y has a small variance, so each Y_ is close to μ

20
New cards

why we use n-1

To compute the variance we first need ¯Y, estimated from the same data. This uses up one degree of freedom: it is as if we had only n − 1 observations.

21
New cards

reasons why there can be correlation without causation

third variable problem, directionality (reverse causation), coincidence

22
New cards

standard deviation intervals

if normal, 34.1 is 1SD 13.6 is 2SD 2.3 is 3SD

23
New cards

z-score, units

(yᵢ-ȳ)/SD, unitless

24
New cards

shaky

lots of spread

25
New cards

ū

average deviation

26
New cards

covariance

2E(x-μx)(y-μy)

27
New cards

rename a variable

ren varog varnew

28
New cards

label a variable

label variable var1 “"

29
New cards

get rid of rows of data

drop in #/#

30
New cards

revalue variable

replace var=”” if var==””

31
New cards

convert variable from strings to numbers

destring var, replace

32
New cards

find median

centile var, centile (50)

33
New cards

sort variable into above and below median

gen var2=# if var1>= `r(c_1)’&var1!=.

replace var2=# if var1<`r(c_1)’

34
New cards

Tell me the quantities of each value and percents

tab var

35
New cards

Tell me the mean, min/max, SD, # of observations, variance, median, quarters, skew

sum var, detail

36
New cards

save something

save “\” , replace

37
New cards

make a graph

collapse (mean) mean_var1=var1, by var2

graph twoway (bar mean_var1 var2, barw(#)), xlabel(# ““ etc) xtitle(““) ylabel (# ““ etc) ytitle(““) title (““)

graph save

38
New cards

make a table

eststo var1:estpost summarize var2 if var1==#

esttab var1 var2 using “\.rtf”, plain cells(“mean(label(Mean) fmt (0))” “sd(label(SD) fmt(0))” “count(label(N) fmt(0))”) mtitles(“ “ “ “) noobs replace label title()

39
New cards

import first row as variables

import ““, firstrow

40
New cards

how to import sas

import sas using ““

41
New cards

number of observations stata

count var

42
New cards

general stats about data (string/numbers, missing)

codebook var

43
New cards

directory

cd, use, save

44
New cards

look at distribution

hist var

45
New cards

sort variable from smallest to largest

sort var

46
New cards

bias directionality

can be product positive if all possible third variables end up positive or vice versa, or product neutral, it is positive and overstates bias if a third variable causes both things to happen more, negative understates bias and causes one, but reduces the other

47
New cards

Yᵢ = μ + uᵢ: what is it, and why is E(uᵢ) = 0?

Each observation = truth (μ) + disturbance/noise (uᵢ). E(uᵢ) = 0 because with a symmetric distribution centered on μ, noise is not systematically positive or negative.

48
New cards

Variance of a sum: Var(X+Y)

Var(X) + Var(Y) + 2Cov(X,Y)

49
New cards

Var(a + bX)

b² Var X

50
New cards

Correlation: formula, unit, range

corr(X,Y) = Cov(X,Y) / √(Var X · Var Y). Unitless, between −1 and 1. Independence gives Cov = 0 so corr = 0.

51
New cards

Y = a + bX gives corr

1

52
New cards

Y = a - bX gives corr

-1

53
New cards

σ²_Ȳ = ? + assumptions

σ²/n, 1) Independence between observations (Cov = 0). Can fail with peer effects (students working together). 2) Equal variance σ² for every observation. (Normality is NOT needed.)

54
New cards

Consistency (plim)

plim Ȳ = μ (or lim Ȳ = μ as n → ∞). Since σ²/n → 0, Ȳ converges to μ. Large-sample (asymptotic) property. "Probability limit": P(|Ȳ − μ| > ε) → 0 for any small ε.

55
New cards

Standard error (SE): formula and meaning

SE = √(Var Y / n) = SD/√n. It is the SD of the SAMPLE MEAN Ȳ (not of Y). Shrinks with 1/√n.

56
New cards

Why use a t-distribution instead of the normal?

With a small sample, the SE is itself estimated from few observations and is noisy. The ratio then follows the t-distribution (fatter tails than normal).

57
New cards

Confidence interval recipe

CI = estimate ± critical value × SE. Critical value comes from the t-table (significance level + df).

58
New cards

p-value: definition

The probability of getting a t as large as ours if the true difference were 0. Equivalently, the exact significance level at which the result flips from not significant to significant. Smaller p = stronger evidence.

59
New cards

Significance stars

p < 1%: *** p < 5%: ** p < 10%: * p ≥ 10%: no stars

60
New cards

statistically significant

Significance needs the standard error: it compares the gap to how precisely each mean is estimated

61
New cards

why do we bother dividing the covariance by √Var X Var Y to get a correlation

We divide by √Var X Var Y to get a unitless number that always lies between −1 and +1, so correlations are comparable across variables with different units and scales

62
New cards

p-value

the probability of getting a t as large as ours if the true difference were 0, also the exact significance level

63
New cards

if 0 falls within the confidence interval

It does not prove that the treatment has no effect. We simply cannot reject a difference of 0. The true effect could be as large as upper bound: maybe the sample is just too small.

64
New cards

stata find t-values at 10%, 5%, 2.5% with 8 df

display invttail(8, 0.025), invttail(8, 0.05), invttail(8, 0.005)

65
New cards

scatter plot stata

twoway scatter VarA VarB

66
New cards

correlation stata

correlate VarA VarB

67
New cards

results table with star

* estpost does group 1 minus group 2: recode so that Bachelor+ = 1, No Bachelor = 2


gen U2 = University

replace U2 = 2 if University==0


eststo ttest: estpost ttest VerySatisfied, by(U2)

esttab ttest using "CSS_ttest.rtf", plain ///

cells("mu_1(fmt(3)) mu_2(fmt(3)) b(star fmt(3)) p(fmt(3))") ///

collabels("Bachelor+" "No Bachelor" "Difference" "p-value") ///

star(* 0.10 0.05 * 0.01) noobs replace label title(Very satisfied with life) ///

addnotes("* p<0.10, p<0.05, * p<0.01."

We recode because estpost ttest always computes group 1 minus group 2, and group 1 is the lower value of the variable (here 0 = No Bachelor). With U2, Bachelor+ is group 1, so the difference reads Bachelor+ minus No Bachelor and comes out positive.

68
New cards

permutation test stata

sum Y if T==0

return list

local Control_mean=r(mean)

sum Y if T==1

local Treatment_mean=r(mean)

gen Treatment_Effect= `Treatment_mean’-’Control_mean'

gen real=1

keep real Treatment_Effect

keep in 1


save "Guinness Permutation Test.dta", replace


forvalues i=1(1) 99 {

clear

use "Guinness Full Sample_Cleaned.dta"


gen id=_n

gen number=runiform()

sort number

gen new_T=T[id]


sum Y if new_T==0

local Control_mean=r(mean)

sum Y if new_T==1

local Treatment_mean=r(mean)


gen Treatment_EffectTreatment_mean'-Control_mean'

gen real=0

keep real Treatment_Effect

keep in 1


append using "Guinness Permutation Test.dta"

save "Guinness Permutation Test.dta", replace

}

sort Treatment_Effect

*It is tied at the top with 20 other observations, so not exceptional

tab Treatment_Effect

69
New cards

pre/post-trends + scatter plot

sum Y if T==1&Post==1

local Treatment_Post=r(mean)

sum Y if T==1&Post==0

local Treatment_Pre=r(mean)

sum Y if T==0&Post==1

local Control_Post=r(mean)

sum Y if T==0&Post==0

local Control_Pre=r(mean)

gen Treatment_EffectTreatment_Post'-Treatment_Pre'-Control_Post'-Control_Pre')

keep Treatment_Effect

keep in 1

save "Treatment_Effect.dta", replace

****GRAPH:

clear

use "DID_clean.dta"

collapse (mean) Y, by(T Post)

graph twoway ///

(scatter Y Post if T==1, connect(direct) lcolor(red) lwidth(thick) msymbol(O) msize(large) mcolor(red)) ///

(scatter Y Post if T==0, connect(direct) lcolor(blue) lwidth(thick) msymbol(O) msize(large) mcolor(blue)) ///

, legend(order(1 2) label(1 "Treatment") label(2 "Control") position(6)) xlabel(0 "Before" 1 "After") xline(0.5) xscale(range(-0.2 1.2)) ylabel(0 "0" 3 "3" 6 "6") xtitle("") ytitle("") title("Impact of T on Y")

70
New cards

what to do if duplicates

duplicates drop var, force

71
New cards

merge

merge 1:m Country using "DID_clean.dta"

*Why 1:m?

*The first number (1) is in the master dataset: we have 1 row per country

*The second number (m) is in the using dataset: we have multiple rows per country

*there is a new variable: _merge: the result of the merge:

*1 : in master, not using

*2: not in master but in using

*3: success

drop _merge