Docsity

Empirical Economics, Appunti di Economia

Toggle sidebar
bg1
Empirical economics
Review of Statistics and Probability !
Policy research question: does class size affect student learning and achievement?
What is the effect on test scores (or some other outcome measure) of reducing
class size by one student per class? By 8 student/class?!
If the class is too small you have schoolmates in your class who doesn’t fit with you !
The teacher can dedicate more time to the students but on the other side there are
also some limitation on the student learning!
We can use a theoretical model !
THE CALIFORNIA TEST SCORE DATA SET!
It is make of K-6 and K-8 (correspond to elementary and junior high schooling Italy),
California school district!
We want to study the correlation between school size and student achievement; we
don’t have information about the single score of the student but about the average,
second informations STR we refer to the class size (student to teacher ratio).!
If look at the STR we see average 19.6, standard deviation 1.9, smaller classe have
17.3% while largest ones have 90% students; test average score in. Maths is 654.2
maximum score is 8hundred, standard deviation reflects even the unit of measure of
the variables; 50% is the median is the school district which is in the middle of our
variable.!
This table doesn’t tell us anything about the relationship between test score and
STR. (We have lot of information about separate variables) W#hat can we do to
see if there is a relation? !
1) make a SCATTERPLOT: each drought is the district, x is STR while y axes
we measure the test score (from 620 to 720). Have a look to the shape,
we can say a negative correlation between the two variables. They’re
useful to have a first idea of the two variables, when they are distributed
on the main diagonal then there is a positive correlation, now they are
distributed on the secondary diagonal then there e is a negative
correlation.!
One of the advantage of empirical analysis is that using data we can find a
quantitative answer to our question, now we want to have some quantitative or
numerical evidence of this relationship. !
First thing is to compare the evidence score in districts with low STRs to those with
high STRs (ESTIMATION). We need to have an estimation of the difference!
Let’s suppose there is a difference between with a school with small and large size
but we also have to test if this difference can run the same excursive or !
We have to test the hypothesis. (HYPOTHESIS TESTING)!
INITIAL DATA ANALYSIS!
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e

Anteprima parziale del testo

Scarica Empirical Economics e più Appunti in PDF di Economia solo su Docsity!

Empirical economics

Review of Statistics and Probability

Policy research question: does class size affect student learning and achievement? What is the effect on test scores (or some other outcome measure) of reducing class size by one student per class? By 8 student/class? If the class is too small you have schoolmates in your class who doesn’t fit with you The teacher can dedicate more time to the students but on the other side there are also some limitation on the student learning We can use a theoretical model THE CALIFORNIA TEST SCORE DATA SET It is make of K-6 and K-8 (correspond to elementary and junior high schooling Italy), California school district We want to study the correlation between school size and student achievement; we don’t have information about the single score of the student but about the average, second informations STR we refer to the class size (student to teacher ratio). If look at the STR we see average 19.6, standard deviation 1.9, smaller classe have 17.3% while largest ones have 90% students; test average score in. Maths is 654. maximum score is 8hundred, standard deviation reflects even the unit of measure of the variables; 50% is the median is the school district which is in the middle of our variable. This table doesn’t tell us anything about the relationship between test score and STR. (We have lot of information about separate variables) W hat can we do to see if there is a relation?

  1. make a SCATTERPLOT: each drought is the district, x is STR while y axes we measure the test score (from 620 to 720). Have a look to the shape, we can say a negative correlation between the two variables. They’re useful to have a first idea of the two variables, when they are distributed on the main diagonal then there is a positive correlation, now they are distributed on the secondary diagonal then there e is a negative correlation. One of the advantage of empirical analysis is that using data we can find a quantitative answer to our question, now we want to have some quantitative or numerical evidence of this relationship. First thing is to compare the evidence score in districts with low STRs to those with high STRs (ESTIMATION). We need to have an estimation of the difference Let’s suppose there is a difference between with a school with small and large size but we also have to test if this difference can run the same excursive or We have to test the hypothesis. (HYPOTHESIS TESTING) INITIAL DATA ANALYSIS

First we have to define which district we consider low size and large six so we divide the school districts in 2 groups: STR <20 and STR > 20 ( we consider the median, which is about 20). We could also choose to create more than 2 groups but the analysis will be more complicated. In this case statistics is meaningful from a statistics point of view. Let’s do the statistics analysis following the 3 parts we have seen before.

  1. ESTIMATION of difference= difference between group means Upper bar over the variable means the average ( small) refers to school district with small classes. Difference between the 2 means computed before, and the result is 7.4 on a scale of 8 hundred points. In this case we have also to wonder if this difference is economically significant so we have to investigate a bit more whether investing resource in reducing resources (and obviously significant from a statistical point of view). Let’s compare with the standard deviation (19.1) is 7.4 relative large compared to the standard deviation? Actually if we move a small district to the large to the small class side this can cause an increase to the test score. Which is a relevant effect, we can also think of what happen to test score when you move a school district to STR distribution? If we move to 666.7 to 659.4 we have an effect even more economic relevant (7.3). We choose to move from 60 to 75 percentile because it’s up to us, we can choose the percentiles.
  2. TEST THE HYPOTHESIS that difference = 0 We want to test if the difference is different from zero and we use a T-TEST, competed taking the parameter divided by the standard error, and we are combining in the same statistics 2 different variables ( mean of the test of small and large classes)/ by sum of the variance, applying the formula. The result is 4.05 which is > 1.96 so reject (at the 5% significance level) the null hypothesis that the two means are the same.
  3. Construct a CONFIDENCE INTERVAL for the difference We want to construct the 95% confidence interval for the difference between the means is (formula vedi slide). The range of estimate goes from 3.8 to 11.0. There are two ways to interpret this results: the 95% confidence interval for the difference doesn’t include 0; and the hypothesis that difference equal to zero is rejected at the 5% level. The third way to interprete the confidence interval is to use other samples from the same population. REVIEW POF STATISTICAL THEORY
  • (^) The probability framework fro statistical inference
  • (^) Population, random variable and distribution A. POPULATION: group or collection of all possible entities of interest ( in our ex the school districts).

Provare a installare STATA Mercoledì prossimo inizio lezione alle 12:

RANDOM VARIABLES: JOINT DISTRIBUTIONS AND COVARIANCE

  • Random variables X and Z have a JOINT DISTRIBUTION ( random because we can assume what is the value of the variable) we may study the characteristic of this variables and find their moments ( means, variance, skewness, second third fourth moment of the distribution ). Let’s consider 2 random variables in a population X and Z and they are characterized of a connection between the 2 variables.
  • The COVARIANCE is a measure of the linear association between X and Z; its units are units of X x units of Z (sigmaXZ)
  • cov(X,Z) >0 means a positive relation between X and Z if negative there is a negative relation
  • The distribution of one variable don’t depend on the distribution of the other variables so the con should be equal to zero
  • We can find that the covariance is equal two zero but this not mean the 2 variable are independently distributed In this scatterplot we see a negative correlation between test score and STR, so the covariance is likely negative, we expect the correlation is negative. The CORRELATION COEFFICIENT is defined id terms of the covariance. When is equal to 1 there is a perfect positive linear association between the 2 variables considered. So all the points should be distributed along a straight line, on the contrary if it’s -1 the point are distributed on the line but in a negative line. When it’s equal to zero there is no a linear association between the variables. We refer to a LINEAR ASSOCIATION between 2 variables, so if it is not linear then the correlation index is zero. GRAPHICS OF THE CORRELATION COEFFICIENT MEASURES LINEAR ASSOCIATION First panel the shape of the clouds of absorption we see there is a positive correlation, if we compute the correlation will find a positive number (not perfectly like 1). Second panel the correlation is clearly negative so we are going to find a negative number (close to -1 but not exactly -1) Last 2 panels the correlation is equal zero: left one graphic show us a random distribution while the right one let us think there is not a relation between X and Y bit there is a clear cut correlation but is not a LINEAR CORRELATION. This is a case of a quadratic relationship.

CONDITIONAL DISTRIBUTIONS AND CONDITIONAL MEANS

We are looking at the distribution of a random variable and we can also compute the conditional moment such as the conditional means ( = the expectation of conditional distribution) E(Y|X =x) IMPORTANT CONCEPT OF NOTATION Conditional variance is the variance of the conditional distribution Delta is the difference = (conditional means of the test score with STR < 20) minus (the conditional means of the test score pf STR >= 20) I can compute the mortality rates of those who is texting a new vaccine for the covid, for example. When the conditional mean is constant, means the two variables are uncorrelated, so the 2 variables are independently distributed. The CONDITIONAL MEAN corresponds to the more intuitive idea of the group mean. CONDITIONAL MEANS AND PREDICITONS The conditional mean plays a key role in prediction For example you want to predict someone’s score given the STR M is pur prediction which can be a conditional mean but also other statistics MSPE= Mean square prediction error is simply the average of the expect value of the difference between the 2 variable (guarda formula tra parentesi sulla slide) DISTRIBUTION OF A SAMPLE OF DATA DRAWN RANDOMLY FROM A POPULATION In our case our population was the school district of the area. We assume that the sample of observation is a random sample of the initial population. Randomness of the data means that prior to sample selection which have a value of Y which is random because the individual selected is random. Y1 and Y2 are randomly selected for this reason they are INDEPENDENTLY DISTRIBUTED this the correlation is zero, n information pf individual 1 are available on the individual 2. If the individual come from the same population they are IDENTICALLY DISTRIBUTED; under simple random sampling Y1 and Y2 are independently and identically distributed (iid) ESTIMATION Y segnato sopra is the natural estimator of the mean Y is a random variable and its properties are determined by the SAMPLING DISTRIBUTION of Y segnato (sample = campione)

  1. The individuals in the sample are drawn at random
  2. Thus the values are random

HYPOTHESIS TESTING

Make a provisional decision based on the evidence at hand and whether a null hypothesis is true, or instead that she alternative hypothesis is true. Now we want to test more formally whether a certain mean is actually equal or not to a specific value. We want to make a sort of previsional decision. Null hyphotesis in pur case the mean of the population is equal to a certain value. 1-sided test because we are comparing pour value with values which are grader or lower than it. We can also have a 2-sided statistical test SOME TERMINOLOGY P-VALUE= probability of drawing. Statistic at least as adverse to the null hypothesis, is a measure of the probability that you will reject the null hypothesis when the null hp is actually true SIGNIFICANCE LEVEL= is a pre-specified probability of rejecting null hp when the null is true. The most using critical significance level is 5%. (Foruma p-value) Can be defined as the porb that the absolute difference between the mean of the population (or another statistics from data) menus the value of the value of the null hp we are simply formally defined the definition of p-value. To compete the p-value we need to know the sampling distribution of Ybar which is complicated if n is small. If N is large we can use the normal distribution approximation. ESTIMATOR OF THE VARIANCE OF Y Usually e We test the null hyphptesis that mean is equal to zero, usually reject if the value of the t-statistic is in absolute value grader or equal to the critical level we associate to the the t-statistic used. The p-value is sometimes called the MARGINAL SIGNIFICANCE LEVEL. REGRESSION: THE STUDENT T DISTRIBUTION Compute the t-statistic with our data then we compute the degrees of freedom (N-1). However if the sample is relatively large (more than 30 observations), the t- distribution and standard normal distribution are very similar. CONFIDENCE INTERVALS A 95% confidence interval for the means is an interval that contains the true value of the population mean in 95% of repeated samples. However in a certain way this anther a random measure in pur analysis. We know the population mean value is not a random value. Slide con confidence intervals formula STATA LAB 1

STATA LAB 2

Per aprire un file clicchiamo su File poi changing working directory e apro la cartella stata e poi clicco su open per aprire il file scelto We have all the variables on the right How to import data which are not in stata format Let’s tray to import the same dataset starting from the excel version Go to the menu file then import and excel spreadsheet and we choose our excel file, click okay and then flag the first of the two phrase. Se vogliamo cancellare il dataset ci basta scrivere CLEAR nei commands e le variabili spariranno e ogni volta che scrivo clear noi perdiamo tutto quindi prima di cliccarlo è meglio salvare tutto Quando importiamo un file da excel se stat torva una cella vuota allora metterà un punto. Essendo un programma statunitense invece della virgola avremo il punto nella scrittura dei numeri quindi verifichiamo che sia cosi anche nel nostro programma excel. With stata we can use data with multiple observations (ex consumer survey in 2019 or gdp per capital in 2020) I have many entities. x is the name of the variable IT= specific observation and T denotes a specific time period Panel or longitudinal data= when we work with panel data all the entities are observed in the all time period: x with index IT We will use mainly cross section data and pull cross section data Panel data requires more advanced econometrics techniques DESCRIBE : use it when we want to know some features about our data Apriamo ancora caschool.dta ma abbiamo bisogno del do file per conoscere meglio le variabili che abbiamo a disposizione. Quindi possiamo scrivere do edit nei command oppure andiamo in window e clicchiamo do edit. A questo punto nella pagina che si apre, clicchiamo sul do file che abbiamo. Ora dobbiamo scrivere le caratteristiche delle variabili Quando vogliamo scrivere commenti o appunti sul do file dobbiamo sempre iniziare con * e poi scrivere LIST = stat will show me in the main window how this variables look like List str testscr I want stata show me only these 2 variables Sottolineiamo il comando che vogliamo fare e poi clicchiamo su execute selection (ultima icona a destra). Quindi otteniamo la lista delle due variabili che avevamo richiesto nelle 10 osservazioni richieste. Il primo numero si riferisce alla linea in cui

I also have percentages by column, when you scroll down you see that the corresponding final percentage is 100% cell= prende invece la cella Row = prende la riga Row col cell Row sort =list rows in order of observed frequencies Colsort =list of columns in order of observed frequencies How can we get graphs on stata Histograms is the graphical representation of the frequency table: command histograms , to save the graphic I need to command graph save ( gph= graph Graph box to obtain the box plot 21/ Data management To create a new variable is GENERATE or GEN , the name of the new variables = Alternatively to create a dummy in stata we can start generate str_20bis=1 if str>20 /school district with a large class size =1) EGEN= extended generate command RENAME = rename the variable LABEL data = will create a label for the entire data set Before the need to create the label and then we can attach it to a specific variable LABEL DEFINE = Using labels is useful oof you want to give more information to the dataset or the variables names If we want to change the order of the variables we need the command ORDER and then we specify the order of the variable SORT stata will sort in ascending order my observations using first county HOMEWORK

Continuiamo ad analizzare i comandi inseriti nel do-file PRESERVE= RESTORE= stat will go back to the initial data set I had before the preserve command If you don’t want to use preserve or restore command you can simply ask stata to open again the school dataset and run what you need to run and then reopen again the initial dataset.

grader < below = equal When we add other variables coming from other dataset is like we are merging 2 dataset. MERGE is the command we should use We can do it if they refers to different units of analysis FLEXIBLE TABLE in stata, table in which we put some variables but the content of the table maybe be variables statistically computed with our variables in our table. The command is TABLE for ex table county; but we can specific the variable for the row and the variable for the column, then we need to specify the content of our table C= CONTENT Quindi scriviamo C( e all’interno scriviamo il contenuto che vogliamo, per esempio COUNT dist_cod) vogliamo contare il numero di district

Under the assumptions x an epsilon independent, the error term mean is equal to zero, constant covariance and no serial correlation, the estimator is: consistent, asymptotically normal, routinely computed standard errors are (approximately) correct. EXAMPLE The California test score data TESTSCORE= 698.9 - 2.28STR (Student to teacher ratio) They may be other factors correlated to the class size which can have a direct effect, these factors are all in the error term How can we get this result on Stata? To get OLS estimates we use the stata command REG (regresse) then we need to specify the model (testscr) and the following variable is the x (Pctel) ROBUST (to get what we call heteroskedasticity- robust standard errors) MEASURE OF FIT FOR MULTIPLE REGRESSION SER = Standard errors of Regression= standard deviation of u (with degrees of freedom correction) Root MSE = RMSE= standard deviation of u (without degrees freedom correction) R^2 = fractions of variance of Y explained by X R^2 segnato= adjusted R^2= R^2 with degrees of freedom correction that adjusts for estimation uncertainty (R-squared) Formula of SER and RMSE on the slide ESS = Explained Sum of Squares We can computing the adjusting r squared which corrects this problem by penalizing you for including another regressor (formula per il calcolo di adjusted r squared) Penalization term is (n-1)/(n-k-1) 1)R^2= 0.5 SER= 18. Ser depend on the unit of measure of the variables, to understand if is large or small it is important to compare it with the standard deviation

  1. R^2=0.426 SER= 14.5 significatively lower than before Compering R^2 we can conclude that the share of English learner is an important explanatory of the variance, when we add the additional regressor we don’t have a big change because we are working with relatively large samples. The adjusted R^2 can be negative when k increasing

We can detect heteroskedasticity on the dataset thanks to the graphics 28/ MULTIPLE REGRESSION IN STATA We can see the comment REG = regress We are interested in the relationship between the class size and the student tot teacher ratio, ROBUST compute heteroskedasticity robust standard errors. The square root of the k^th diagonal element is the standard error of Bk. If sigma^” (variance of the error term) Is constant then we have homoskedasticity, however if the variance of the error term is not constant, in this case we have computed standards numbers. COMPUTING ROBUST STANDARD ERRORS (Formula on the slide represent the matrix which can be computed from he regressor and the Ols residuals. Two ways to computing standard errors.

  1. homoskedasticity only standard errors REG, TESTSCR SCR PCTEL (For example) REG, DEPENDENT VARIABLE
  2. Heteroskedasticity- robust standard errors more generalized formula and it contains also the case in which the variance of the error term is constant, so it contains also the homoskedasticity standard case. Probably is better computing homoskedasticity only standard errors, the formula is simpler and also using an excel for example but the main disadvantage is that the formula is only correct if the formula is homoskedastic. The homoskedastticity-only standard errors is the default setting in regression software, to get the heteroskedasticty-robust standard we need to override the default. If we don’t override the default and there is in fact heteroskedasticity, standard errors will be wrong. TEST BASED ON THE OLS ESTIMATOR TEST INVOLVING ONE PARAMETER: t-test (Se = standard errors) It can be used to test a single reaction. If the null hypothesis is true and under the Gauss-Markov assumptions and normality assumption, t has a t-distribution with n- k degrees of freedom. We will reject the null hypothesis if the absolute value of t is too large. Values are too large if they are unlikely to …

STATISTICAL TEST FROM THE REAL WORLD

COVID TEST

H0: no confirmation of the virus H1: confirmation of the virus Type 1 error —> false positive Type 2 error —> false negative What error should be minimized? The aim is to minimize the spread of the disease, so it is reasonable to minimize the type 2 error, it’s not neutral to minimize the type 1 error. (In the paper they recommend to implement more rapid test that are very accurate to identify people who have not the disease but not very good to find people which are ill).

  1. test of a new treatment to cure lung cancer H0: new treatment equivalent to standard treatment H1:? New treatment is better than the standard one (for example) or the treatment is worse than the standard treatment Type 1 error size —> the new treatment is actually better Type 2 error sized —> the new treatment is no better to the standard one so it is better to go on with the standard treatment MULTICOLLINEARITY There is nothing wrong with including variables in your model that are correlated THE DUMMY VARIABLE TRAP OUTLIERS Is an observations that is significantly different from the rest of the sample: it is an exceptional behavior of some of the observations in the dataset.

STATHALLOWEEN

Summarize = basically statistic for a specify variable Summarize with the option ,D = detail it gives more informations about percentiles and moment of the distribution. If we are interested only in mean but we also want an estimation we can use the command MEAN (and variable list) Example MEAN TESTSCR we obtain the mean, the standard error of the mean and the 95% confidence interval. But we can also change the significance level of the confidence interval we have to start with CI (CONFIDENCE INTERVAL) then MEAN and the variable and coma, specifying the new significance level :level(99). T-TEST = also without running regression; Ex: test testscr, by ( str_20); (BY is important to create the two group, is the name used by stata to provide statistic for different groups) in brackets I specify the variable. UNEQUAL =I allow stata to consider unequal variance in the mean between the 2 groups, being more flexible in the t-test. Sample (want to randomly selected 182 observations) PAIRED T-TEST = asl stata to test wether the mean in read score is equal to maths test score PAIRWAISE CORRELATION

  1. CORRELATE variables, cov (if we want he covariance), avginc =average income
  2. PWCORR similar output of using correlate, the main difference is we can also ask stat to provide a t-test on the statistical significance, we can also get information if it is statistically equal to zero. Same syntax of correlate. Or after the coma(,) we can also specify the significance level for example : star (0.05) alle the numbers having the star are statistically significance at 0.05 significance level. OLS IN STATA REG= regression then the dependent variable Y and the entire list of the regressor (independent variables X) ROBUST is the command to obtain heteroskedasticity-robust We can see the f-test in the numbers we obtain GEN=generate REPLACE

Hypothesis tests and confidence intervals are now implemented and interpreted “as usual”. The interpretation of beta1 differs from case to case. The choice of specification should be guided by judgement, test and plotting predicted values. OTHER NONLINEAR FUNCTIONS (AND NONLINEAR LEAST SQUARES) The following regression functions have limitations

  • (^) POLYNOMIAL : test score can decrease with income
  • (^) LINEAR-LOG: test scores increase with income, but without bound (Formula of negative exponential growth curve) We want to estimate BETAZERO, BETA1 E ALFA. Formula with the representation of a non-linear demand function: a and b have a specific economic meaning (a = quantity demanded when the good is free) Demand elasticity = -p/b and when p=b then deman elasticity is equal to 1, when p>b the demand becomes elastic NEGATIVE EXPONENTIAL GROWTH We want to estimate the parameters of the formula LN =NATURAL LOGARITHM in stata Avg =average log= natural logarithm Log= logarithm with base 10 r= robust Replicate the picture we have in the slide : TWOWAY = combine two graphs one with the scatter plot one with the fitted regression go logic model and one with the fitted regression go loglog model SCATTER= to have the scatter plot of the Y variable /// meaning I am changing line

11\

INTERACTIONS BETWEEN INDEPENDENT VARIABLES

Pheraphs a class size reduction is more effective in some circumstances than in others. We will first consider binary X’s then continuous X’s. Can you relate these coefficients to the following table of group means? Substituting the value of the 2 dummy variables, if both are low Once you know how to obtain the expected value starting from the coefficient then we can compute also other differential effects, like I am computed the expected effect INTERACTION BETWEEN CONTINUOUS AND BINARY VARIABLES D (dummy variable) is binary while X is continuous; the effect on Y of X = beta which does not depend on D), how can we interpret the coefficients? It is like we can get 2 different regression line, a regression line for group of observations D =0 and the second regression line for subgroups pf observations in which D = 1. If we want to take the marginal effect of x on y : deltaY/deltaX. The effect of X depends on D When D=1, beta3 is equal to the increment to the effect of X. Grafico 1) dummy variable is equal to zero, D=1 , beta3 is equal to zero but beta different from zero

  1. two regression Line have the same intercepts. If we compute the ratio for the interaction term, the two regression lines have the same slope, the coefficient on HiEL x STR is zero. (which correspond on testing simultaneous that both coefficient are equal to zero, we test the null hypothesis that these 2 jointly coefficient are equal to zero). INTERACTION BETWEEN 2 CONTINUOUS VARIABLES X1 and X2 are continuous The effect of X1 doesn’t depend on X2, and viceversa Hence: deltaY/deltaX1 (this is the marginal effect of x1 on Y) = beta1 + beta3X The effect of X1 depends on X2 and beta3 captures the differential effects of X1 on Y giving a unit change in X2. NONLINEAR REGRESSION FUNCTIONS Using functions of the independent variales (such AS LNx, X1 x X2) allows recasting a large family of nonlinear regression functions as multiple regression. Estimation and inference proceed in the same way as in the linear multiple regression model