class: center, middle # Introducción ### Econometría #### Licenciatura en Economía #### Dr. Francisco J. Cabrera-Hernández Otoño 2024 ##### CIDE Santa Fe, Ciudad de México. --- ## Outline - **.blue[¿Qué es econometría?]** - Diferentes tipos de datos y modelación. - Precisión versus sesgo. - Introducción a regresión. --- <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#stats.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Econometrics Sir Clive Granger, Nobel Laureate, noted: “We need a special field called econometrics, and textbooks about it, because it is generally accepted that economic data possess certain properties that are not considered in standard statistics texts” --- ## ¿Para qué sirve? **Respuestas Causales:** México es el segundo receptor de remesas del mundo ¿pero sirven para reducir la pobreza? La teoría clásica dice que el salario mínimo arriba del equilibrio genera desempleo ¿en México lo generó? La teoría dice que el comercio internacional genera ventajas comparativas que benefician a los que menos ganan ¿es esto cierto en México? --- ## ¿Para qué sirve? **Predicción:** <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#target.jpg" alt=" " width="60%" /> <p class="caption"> </p> </div> [Fuente: New York Times](https://www.nytimes.com/2012/02/19/magazine/shopping-habits.html) --- ## ¿Para qué NO sirve? ¡Para responder a algo que no tiene una pregunta! I have a dataset! <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#software.png" alt=" " width="60%" /> <p class="caption"> </p> </div> --- ## Ejemplo: Un tesista en una universidad privada "x" contaba con base de datos con ingresos de hogares en México. Planteó la siguiente relación: `$$Pobreza_{h} = f(Ingresos_{h}, Educación_{ih}, Región_{h})$$` ¿Es una pregunta interesante? ¿Es relevante? ¿Tiene algún sentido teórico? La econometría aplicada es útil si usa para responder preguntas interesantes. --- ## Questions about questions. “I checked it very thoroughly, said the computer, and that quite definitely is the answer. I think the problem, to be quite honest with you, is that you’ve never actually known what the question is…” **Douglas Adams, The Hitchhiker’s Guide to the Galaxy (1979) in Mostly Harmless Econometrics.** “The promiscuous use of fancy econometric techniques cannot save a shaky research” **Joshua Angrist - Metrics.** --- ## Outline - ¿Qué es econometría? - **.blue[Diferentes tipos de datos y modelación.]** - Precisión versus sesgo. - Introducción a regresión. --- ## Tipos de Datos - Time series data - **Cross-sectional data** - Pooled cross-sections - Panel/Longitudinal data Econometric methods depend on the nature of the data used. Use of inappropriate methods may lead to misleading results. --- ## Time Series - This includes observations of a variable or several variables over time. - Examples include stock prices, money supply, consumer price index, gross domestic product (GDP). - Data frequency may include daily, weekly, monthly, quarterly, annually... - Typical features of time series include trends and seasonality. --- ##Time Series Minimum Wage, Unvempoyment, and other data for Puerto Rico: <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#timeseries.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Sección Cruzada Incluyen muestras de individuos, hogares, firmas, ciudades, estados, países, etc. **En un momento del tiempo**. Las observaciones en sección cruzada son más o menos independientes. Un ejemplo es una muestra aleatoria tomada de una población, como la ENIGH. Este curso se enfoca en datos de sección cruzada. --- ## Sección Cruzada <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#cross.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Pooled Cross-Section - Two or more cross-sections are combined in one data set. - Cross sections are drawn independently of each other. - Pooled cross-sections are often used to evaluate policy changes. - Example: Evaluating the effect of change in property taxes on house prices. Random sample of house prices for the year 1993. A new random sample of house prices for the year 1995. --- ## Pooled Cross-Section <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#pooled.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Datos Panel Las mismas unidades de sección cruzada, se siguen en el tiempo. Los datos panel tienen un componente de sección cruzada y otro de series de tiempo. **Se pueden utilizar para modelar características no observables fijas en el tiempo**. Por ejemplo, las estadísitcas de crimen en una ciudad `\(i\)` a través del tiempo `\(t\)`. --- ## Datos Panel <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#paneldata.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Preguntas Rápidas: Una base de datos que recauda la edad, el sexo y los ingresos de los consumidores de Starbucks en marzo de 2020, es de tipo: Una base de datos que recauda la edad, el género, y los ingresos de los consumidores de Starbucks y los sigue trimestralmente entre 2020 y 2021, es de tipo: 1. Serie de tiempo 2. Cohorte transversal 3. Cohorte transversal repetido 4. Panel --- ## Modelación de Series de Tiempo Utiliza los datos del pasado y observa su comportamiento: tendencia o estacionalidad. Utiliza un modelo/algortimo que mejor se adapte a esa "forma" de los datos (**curve-fitting**). A partir de esto predice, **suponiendo que todo lo demás permanece cambiando igual** --- ## Modelación de Series de Tiempo <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#mtimeseries.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Machine Learning (Data Science) - En esencia es el mismo procedimiento que que la modelación de series de tiempo (curve-fitting) - Pueden integrar "predictores": edad, escolaridad, género... - Use cada vez más extenso, complementado con otros métodos (computer intensive) <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#ML.jpg" alt=" " width="50%" /> <p class="caption"> </p> </div> --- ## Análisis causal (Reduced-Form Causal Analysis) - El más importante para establecer relaciones causales entre variables. - Integra la medición de factores no observables. - No buscan predecir (los economistas hemos sido bastante malos en esto). Se hace preguntas "what if?". - Por ejemplo: [¿Estudiar en una universidad privada mejora los ingresos de las personas?](https://www.nber.org/papers/w7322) --- ## Análisis Causal <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#amazon.png" alt=" " width="80%" /> <p class="caption"> </p> </div> --- ## Análisis Causal Cabrera-Padilla 2020 (LAER) <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#cabrerapadilla.png" alt=" " width="80%" /> <p class="caption"> </p> </div> --- ## En suma Las estimaciones *curve-fitting* (ML y Series de tiempo) comunes en negocios, finanzas y macroeconomía (excepto ML), son poco efectivas para controlar por "no observables". Las estimaciones causales (cohorte transversal y datos panel) dominantes en economía moderna y política pública, en crecimento en negocios. Machine Learning puede complementar a ambas pero [se usa más como predictor](https://www.youtube.com/watch?v=2EhRT2mOXm8). --- ## Outline - ¿Qué es econometría? - Diferentes tipos de datos y modelación. - **.blue[Precisión versus sesgo.]** - Introducción a regresión. --- ## Precisión vs. Sesgo Series de tiempo (precisión) vs. Análisis Causal (precisión y sesgo) <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#precision1.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Precisión vs. Sesgo <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#precision2.png" alt=" " width="80%" /> <p class="caption"> </p> </div> --- ## Precisión vs. Sesgo <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#covidpro.png" alt=" " width="100%" /> <p class="caption"> </p> </div> --- ## Outline - ¿Qué es econometría? - Diferentes tipos de datos y modelación. - Precisión versus sesgo. - **.blue[Introducción a regresión.]** --- ## Distribution of wages (notation example) Wage is a random (we don't know the wage before measuring) variable with probability distribution: `$$F(u)=P[wage \le u ]$$` If differentiable, the PDF: $$ f(u) = {d \over du} F(u) $$ Mean or expectation for a random variable Y with discrete support is: `$$\mu = E[Y] = \sum_{j=1}^{\infty} \tau_{j}\mathbb{P}[Y=\tau_{j}]$$` --- ## Conditional Expectation Function The conditional expectation of log(wage) given gender, race, and education is: $$ E[log(wage) | gender = man, race = white, education = 12 ] $$ <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#CEF.png" alt=" " width="75%" /> <p class="caption"> </p> </div> --- ## Conditional Expectation Function In general: `$$E[Y|X_1 = x_1 , X_2 = x_2... X_k = x_k] = m(x_1,x_2, ...,x_k )$$` We can write the conditioning variables as a vector in `\(\mathbb{R}^k\)`: `$$X= \left( \begin{array}{c} X_1\\ X_2\\ \vdots\\ X_k \end{array} \right)$$` The CEF: $$m(x) = E[Y|X=x]; x \epsilon \mathbb{R}^{k} $$ When `\(X=x\)` average value of Y is m(x). --- ## Continuous CEF The conditional density is a re-normalized slice of the joint density `\(f(y,x)\)` holding x fixed. <div class="figure" style="text-align: center"> <img src="data:image/png;base64,#CEFC.png" alt=" " width="90%" /> <p class="caption"> </p> </div> --- ## Econometrics Regression - Consumer demand for a product often can be thought of as a relationship between: the quantity demanded (Q); its price (P); the price of a substitute (Ps); and disposable income (Yd). - The *dependent* variable Y: depends on *explanatory* variables X: `$$E[Q|P = \bar{p} , P_s = {p}_s, Y_d = {y}_d] = m(p,p_s,y_d)$$` --- ## Econometrics Regression - Ecuación Teórica: `$$Q = \beta_0 + \beta_1P + \beta_2P_s + \beta_3 Y_d$$` - La CEF (concepto teórico detrás) indicaría el valor esperado de Q para cada valor de `\(P=p\)`. - Una regresión (con datos) nos permite aproximar la CEF, al estimar el cambio promedio en Q cuando existe aumento de una unidad en P: `$$Q = 27.7 + 0.11P + 0.03P_s + 0.23Y_d$$` - *Si el ingreso disponible aumenta en uno, Q aumenta en 0.23 unidades.* - 0.23 es el coeficiente de regresión. --- ## <style> .centered-word { position: absolute; top: 50%; left: 35%; transform: translate(-50%, -50%); } </style> <div class="centered-word"> <h3>.black[¿Dudas?]</h3> <h3>.black[francisco.cabrera@cide.edu]</h3> </div> <div class="figure" style="text-align: right"> <img src="data:image/png;base64,#bullseye.png" alt=" " width="45%" /> <p class="caption"> </p> </div>