Instructions

There are 4 sets of questions to be answered. You can earn up to 100 points + bonus questions. Points are indicated next to each question.

The policy problem

RESEARCH QUESTION: Does an increase in bus frequency affect bus ridership in City A?

Several cities aim to support public transportation and increase ridership. There are several ways to encourage residents to utilize public transportation more often; one of those is to modify the transit schedule so as to increase the frequency of buses in peak times and reduce waiting time.

City A has opted for this solution and starting from May 1st has implemented a new bus schedule which increases bus frequency. At the end of the year, the mayor wants to estimate whether the decision was effective and ask you to analyze one year of ridership data to test the following hypothesis:

HYPOTHESIS: An increase in bus frequency has a positive effect on bus ridership in City A (i.e., the new schedule is effective).

Data

Data on ridership were provided by the local transit agency. The variable “Passengers” represents the number of daily passengers on all buses in the city (in thousands). Data were collected from January 1st to December 31st. The intervention was implemented on May 1st (day 121 is the first day of the new schedule).

Variable name Description
Passengers Daily passengers on the buses (in thousands)

You can load the data by adding this chunk to your file:

passengers <- 
c(1328, 1407, 1425, 1252, 1287, 1353, 1301, 1294, 1336, 1371, 
1408, 1326, 1364, 1295, 1320, 1260, 1347, 1316, 1287, 1292, 1259, 
1349, 1274, 1365, 1317, 1341, 1316, 1313, 1285, 1369, 1309, 1446, 
1422, 1397, 1358, 1310, 1294, 1373, 1161, 1320, 1376, 1335, 1382, 
1455, 1374, 1267, 1318, 1370, 1297, 1391, 1269, 1341, 1238, 1391, 
1296, 1260, 1330, 1447, 1296, 1389, 1278, 1319, 1333, 1372, 1325, 
1299, 1299, 1312, 1352, 1355, 1404, 1317, 1330, 1325, 1368, 1311, 
1310, 1242, 1247, 1366, 1401, 1282, 1298, 1301, 1341, 1353, 1398, 
1352, 1300, 1442, 1365, 1411, 1360, 1100, 1334, 1336, 1274, 1303, 
1487, 1341, 1436, 1294, 1390, 1338, 1400, 1325, 1352, 1353, 1288, 
1304, 1338, 1355, 1212, 1386, 1426, 1380, 1425, 1287, 1337, 1288, 
1348, 1308, 1402, 1370, 1401, 1363, 1312, 1457, 1367, 1320, 1338, 
1447, 1371, 1402, 1461, 1382, 1260, 1341, 1309, 1317, 1509, 1403, 
1324, 1347, 1351, 1307, 1267, 1312, 1472, 1403, 1327, 1501, 1470, 
1438, 1416, 1369, 1355, 1317, 1448, 1423, 1401, 1356, 1400, 1356, 
1452, 1435, 1387, 1372, 1390, 1538, 1460, 1474, 1510, 1360, 1424, 
1275, 1381, 1453, 1430, 1404, 1350, 1375, 1327, 1312, 1464, 1478, 
1536, 1397, 1229, 1337, 1442, 1316, 1455, 1312, 1505, 1440, 1408, 
1429, 1280, 1560, 1422, 1363, 1349, 1326, 1400, 1464, 1488, 1352, 
1485, 1446, 1540, 1435, 1377, 1287, 1480, 1353, 1359, 1493, 1387, 
1314, 1478, 1306, 1462, 1533, 1261, 1488, 1482, 1461, 1452, 1540, 
1438, 1423, 1425, 1353, 1489, 1546, 1401, 1459, 1527, 1341, 1516, 
1406, 1414, 1442, 1272, 1371, 1435, 1446, 1287, 1496, 1442, 1614, 
1305, 1459, 1342, 1478, 1501, 1357, 1428, 1444, 1431, 1425, 1434, 
1488, 1508, 1454, 1436, 1485, 1522, 1437, 1396, 1407, 1382, 1444, 
1494, 1303, 1552, 1282, 1352, 1412, 1378, 1579, 1543, 1425, 1404, 
1380, 1593, 1555, 1532, 1514, 1485, 1504, 1442, 1401, 1453, 1493, 
1522, 1417, 1545, 1422, 1540, 1447, 1447, 1575, 1431, 1516, 1542, 
1519, 1485, 1526, 1400, 1563, 1471, 1517, 1506, 1514, 1444, 1348, 
1588, 1574, 1275, 1331, 1436, 1475, 1570, 1513, 1469, 1573, 1432, 
1467, 1513, 1475, 1572, 1430, 1512, 1532, 1487, 1474, 1508, 1410, 
1455, 1445, 1544, 1500, 1517, 1496, 1606, 1613, 1526, 1487, 1540, 
1511, 1534, 1620, 1409, 1542, 1517, 1493, 1443, 1463, 1391, 1583, 
1516, 1700, 1422)

Use a time series model to analyze the impact of the program.

Lab Questions

Question 1

Q1: Prepare the data for the analysis.

  • Q1a: Create the three variables you will need to run a time series model: Time, TimeSince, and Treatment. Your dataset should look something like this: (5 points for each variable)
  passengers Time Treatment TimeSince
1 1328 1 0 0
2 1407 2 0 0
3 1425 3 0 0
4 1252 4 0 0
5 1287 5 0 0
6 1353 6 0 0
360 1463 360 1 240
361 1391 361 1 241
362 1583 362 1 242
363 1516 363 1 243
364 1700 364 1 244
365 1422 365 1 245
  • Q1b: Provide a table of summary statistics of passenger traffic. (5 points)

Question 2

Q2: Run the time series model.

  • Q2a: Run the model and provide a result table in stargazer. (5 points + 5 points)
  • Q2b: What does the intercept represent? (5 points)
  • Q2c: What does the coefficient of Time represent? (5 points)
  • Q2d: Which coefficient represents the immediate effect of the policy? (5 points)
  • Q2e: Which coefficient represents the sustained effect of the policy? (5 points)

Question 3

Q3: Now let’s look at the results more closely

  • Q3a: Has the new schedule increased or decreased the use of public transportation in the short term? Indicate the magnitude of the effect and whether it is statistically significant. (3 * 3 points)
  • Q3b: Has the new schedule increased or decreased the use of public transportation in the long term? Indicate the magnitude of the effect and whether it is statistically significant. (3 * 3 points)
  • Q3c: Provide a brief (1-2 statements) possible explanation for these results. (4 points)

Question 4

Q4: An important aspect of a time series model is the counterfactual.

  • Q4a: What is the number of passengers 100 days after the intervention? (5 points)
  • Q4b: What is the counterfactual? Provide both its formula and estimation. (5 + 5 points)
  • Q4c: What would the counterfactual be after 150 days? (5 points)
  • Q4d: Are the two counterfactuals the same? Why? (3 + 5 points)

Bonus

Time series with a control group

We have learned that there are threats to the validity of time series analysis. In particular, another event might have occurred at the same time of the intervention and caused the immediate and sustained effect that we observe.

A way to address this issue is to use a control group that is not subject to the intervention. This design makes sure that the effect we observe is the result of the policy intervention.

The mayor proposes to utilize city B as a control group. City B is a neighbor city with very similar characteristics to city A. Yet city B has not changed its bus schedule in the past year.

  • BQ1 Upload the data TS_Groups_Lab.csv from the class package. Look at the variables that are included and estimate a new time series model which includes the control group. (5 points)
  • BQ2 Interpret only the new coefficients in the model. Indicate whether they are stastitically significant and what they represent. Can you confirm the results of the previous model? (5 points)
X passengers Time Treatment TimeSince Group
1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D file to generate your rendered HTML file.

Login to Canvas at http://canvas.asu.edu and navigate to the assignments tab in the course repository. Upload your HTML and RMD files to the appropriate lab submission link.

Remember to:

Platforms like BlackBoard and Canvas sometimes disallow you from submitting HTML files when there is embedded computer code. If this happens create a zipped folder with both the RMD and HTML files.