The original data source can be found at Robert Shiller's website here. The complete program for the PE plot, including…