π Week 3 Homework β Feedback
π Week 3 Homework β Feedback
Student: Michele Nascia
Files: week3_homework_starter.m, RGDP_Growth_Comparison_USA_DEU_ITA.png, RGDP_Growth_Comparison_USA_DEU_ITA.fig, WB_RGDP_Selected_Panel.csv, RGDP.csv
Assignment: World Bank Real GDP & Growth (CSV version)
β Overall Assessment
Result: Mostly correct
- Data import, cleaning, logs and YoY growth are implemented correctly for the selected countries (ITA, DEU, USA).
- The submitted figure clearly shows levels (top) and growth rates (bottom), with sensible dynamics (2009 & 2020 recessions visible).
- Two reproducibility issues required manual intervention before grading: the script name had a suffix
(7).mand a hard reference toweek3_homework_starter(3).mat line 156. These should be fixed by the student.
π Task-by-Task Check (Slides Tasks 1β8)
| Task | Description | Status | Notes |
|---|---|---|---|
| 1 | Import NY.GDP.MKTP.KD (all countries) via CSV |
β | Reads CSV; selected countries subset prepared. |
| 2 | Inspect & extract (country/iso3, year, value) | β | Proper year/value extraction and typing. |
| 3 | Build tidy table (country/iso3, year, value) |
β | WB_RGDP_Selected_Panel.csv present with long structure. |
| 4 | Compute logs & annual growth | β | Uses diff(log(value))*100 by country; results consistent. |
| 5 | Verify US growth vs Week 1 | β | Pattern matches expected US series. |
| 6 | Plot selected countriesβ Real GDP + legend; save figure | β | Levels plotted; saved as RGDP_Growth_Comparison_USA_DEU_ITA.png (naming differs from spec but acceptable content-wise). |
| 7 | Plot growth rates in different subplots per country + average line; save figure | β οΈ | Growth shown in a single subplot (shared across countries) and no mean line per country. |
| 8 | Export panel with growth to CSV | β | WB_RGDP_Selected_Panel.csv exported (CSV name allowed to differ). |
πΌοΈ Numerical & Plot Consistency
- Levels: USA line (dotted) on higher scale; DEU and ITA close and smooth β consistent with WB data.
- Growth: Timing and amplitudes of downturns line up across countries; values look reasonable.
π οΈ Required Fixes (minimal edits)
1) Reproducibility / file names
- Rename your main script to
week3_homework_solution.m(avoid(...)in filenames). - Remove hard-coded references to other script versions:
% line 156 currently: % run('week3_homework_starter(3).m') % change to: % run('week3_homework_starter.m') % or integrate code directly in your solution file
2) Growth plots
sel = {'ITA','DEU','USA'};
figure('Color','w');
for i = 1:numel(sel)
subplot(numel(sel),1,i);
sub = T(strcmp(T.CountryCode, sel{i}), :);
plot(sub.Year, sub.GrowthYoY, '-o'); hold on;
mu = mean(sub.GrowthYoY, 'omitnan');
yline(mu, '--', sprintf('Mean = %.2f%%', mu), 'HandleVisibility','off');
grid on; box on;
title(sel{i}); ylabel('Growth (%)');
end
xlabel('Year');
saveas(gcf, 'week3_rgdp_growth.png');
Style & Clarity
- Add semicolons to suppress Command Window output.
- Include a brief header comment (purpose, inputs, outputs).
- Prefer relative paths and avoid run() where possible (keep everything in the main script or call helper functions).