What is the first population assumption of bivariate OLS regression? How might this assumption be violated? How could we account for this violation?
Linearity: the true relationship between x and y is linear. This could be violated if we instead have a true nonlinear relationship, which we could account for by adapting our regression to match.
What is the second population assumption of bivariate OLS regression? How might this assumption be violated? How could we account for this violation?
Unbiasedness: the conditional expected value of our error term is zero for all values of x. This could be violated if there are variables missing from our regression that are correlated with x and y. We could address this by including these missing/omitted regressors in a multivariate regression.
What is the third population assumption of bivariate OLS regression? How might this assumption be violated? How could we account for this violation?
Homoskedasticity: the distribution (variance) of our errors is constant across values of x. This could be violated if the distribution of our errors changes for larger or smaller values of x. We could account for this by using robust standard errors in our regression.
What is the fourth population assumption of bivariate OLS regression? How might this assumption be violated? How could we account for this violation?
Independence: our error terms are uncorrelated for different units of observation. This could be violated if our observations are not independent from each other, such as time-series data of GDP for a given country. We could account for this by using more complicated forms of regression that account for error dependence.
Question 2: Manual calculations
Consider a dataset with 3 observations for \((x,y): (2,4),(1,3)\) and \((6,2)\).
From first principles (using formulas not Stata), compute:
What variables are present in our dataset? List them along with their labels.
u AED_SALARYSAT, cleardes
(Data for A. Colin Cameron (2022), ANALYSIS OF ECONOMIC DATA, Amazon)
Contains data from AED_SALARYSAT.dta
Observations: 876 Data for A. Colin Cameron
(2022), ANALYSIS OF ECONOMIC
DATA, Amazon
Variables: 12 22 Jan 2022 15:50
-------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
-------------------------------------------------------------------------------
salary float %9.0g Annual Salary in dollars
lnsalary float %9.0g Natural Logarithm of Annual
Salary
satverb int %32.0g SAT test verbal score (highest
self-reported score as of 2007)
satmath int %32.0g SAT test mathematics score
(highest self-reported score as
of 2007)
highgrade byte %8.0g Highest grade ever completed
age float %9.0g Age in years
sex byte %14.0g 1 = female 0 = male
minority float %9.0g 1 = minority 0 = not minority
height float %9.0g Height in inches
weight int %8.0g Weight in pounds
genhealth byte %9.0g Health status: 1=Excellent
2=VeryGood 3=Good 4=Fair 5=Poor
actscore float %32.0g ACT test score (highest
self-reported score as of 2007)
-------------------------------------------------------------------------------
Sorted by:
Suppose we want to run a regression of salary on SAT verbal score. Perform this regression and interpret the output.
reg salary satverb
Source | SS df MS Number of obs = 876
-------------+---------------------------------- F(1, 874) = 9.61
Model | 5.7575e+09 1 5.7575e+09 Prob > F = 0.0020
Residual | 5.2357e+11 874 599052503 R-squared = 0.0109
-------------+---------------------------------- Adj R-squared = 0.0097
Total | 5.2933e+11 875 604947912 Root MSE = 24476
------------------------------------------------------------------------------
salary | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
satverb | 23.92566 7.717525 3.10 0.002 8.778612 39.07271
_cons | 23752.62 4278.621 5.55 0.000 15355.05 32150.2
------------------------------------------------------------------------------
\(\boldsymbol{\widehat{salary}=23752.62+23.93\times SATverb}\). Variation in SAT verbal score accounts for 1.09% of variation in salary.
Generate the residuals from the above regression using predict resid, resid and plot these against SAT verbal scores in a scatter plot. Do our errors appear to be homoskedastic or heteroskedastic?
predictresid, residscresid satverb
Our errors appear to be a bit heteroskedastic, with larger errors for larger values of SAT verbal score.
Make changes to the regression in part (b) to account for your answer in part (c). How does this change your estimated coefficients? How does this change your estimated standard errors? Does this make sense?
We would want to add the , robust option to our regression to account for this heteroskedasticity. This should change our standard errors but not our point estimates for our coefficients. In this case, robust standard errors decrease our standard error and increase our t-score for our slope coefficient.
Question 4: Bivariate regression
Using AED_CALELECTRICITY.DTA from hw2, we now want to investigate when electricity gets more and less expensive.
Create a scatterplot of the spot price of electricity and the month. What do you notice?
u AED_CALELECTRICITY, clearsc niso month
(Data for A. Colin Cameron (2015): Analysis of Economics Data, W.W. Norton)
We notice that the spot price of electricity is higher and more varied during the summer months.
Create a scatterplot of the spot price and the day only for the month of November. What do you notice?
sc niso dayifmonth==11
We notice that there is an outlier value of around $150 for the spot price on one day, and that otherwise the spot price is relatively consistent.
Overlay a best fit line onto your scatterplot from part (b). Without calculations or running a regression, what would you expect \(b_1\) and \(b_2\) to be for a regression of day on spot price in the month of November?
sc niso dayifmonth==11 || lfit niso dayifmonth==11
We would expect a \(b_1\approx40,b_2<0\) given what we see from the best fit line.
Between day and month, which series is more correlated with the spot price?
corr niso monthday
(obs=682)
| niso month day
-------------+---------------------------
niso | 1.0000
month | 0.1685 1.0000
day | 0.0345 0.0309 1.0000
Month is more correlated with niso than day (0.1685 vs. 0.0345).
Perform the regression from part (b) of the spot price on day during November. Interpret your results.
reg niso dayifmonth==11
Source | SS df MS Number of obs = 60
-------------+---------------------------------- F(1, 58) = 3.63
Model | 1142.9022 1 1142.9022 Prob > F = 0.0617
Residual | 18260.543 58 314.836949 R-squared = 0.0589
-------------+---------------------------------- Adj R-squared = 0.0427
Total | 19403.4452 59 328.871953 Root MSE = 17.744
------------------------------------------------------------------------------
niso | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
day | -.5042428 .2646537 -1.91 0.062 -1.034005 .0255192
_cons | 41.28264 4.69838 8.79 0.000 31.87781 50.68747
------------------------------------------------------------------------------
We see that indeed our intercept term is near 40 and our slope is negative: electricity prices decrease throughout November.
Suppose we are concerned our data violates the third assumption of bivariate linear regression. What could we add to part (e) to address this? Make this change and interpret your new results.
If we are worried that our data violates homoskedasticity, we can add the , robust option to our regression to accommodate heteroskedastic errors.
reg niso dayifmonth==11, robust
Linear regression Number of obs = 60
F(1, 58) = 3.26
Prob > F = 0.0761
R-squared = 0.0589
Root MSE = 17.744
------------------------------------------------------------------------------
| Robust
niso | Coefficient std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
day | -.5042428 .2792251 -1.81 0.076 -1.063173 .054687
_cons | 41.28264 6.187393 6.67 0.000 28.89723 53.66806
------------------------------------------------------------------------------
What would we expect the spot price of electricity to be on the first day of November? On the last?
\(\boldsymbol{41.28-0.50\times1=\$40.78}\)
\(\boldsymbol{41.28-0.50\times30=\$26.28}\)
Find a day of the month in November with a positive residual. Find a day of the month in November with a negative residual.
Interpret the t-stat, p-value, and confidence interval for \(b_2\) in your regression from part (f). What test does this correspond to? What are its hypotheses? What is its conclusion and why?
This is our test of association between day and niso.\[H_0:\beta_2=0;\quad H_A:\beta_2\neq0\]With \(\alpha=0.05\), we fail to reject the test of association as our p-value is 0.076>0.05. We can also confirm this conclusion with our critical value approach or our confidence interval including 0.