80 likes | 218 Vues
This workshop presentation by Angela Ryu at Duke University focuses on calculating and plotting Mean Squared Error (MSE) using log returns for XOM and WMT over a 1,093-day period with a sampling interval of 5 minutes. The procedure involves calculating beta values through different cases of window sizes (30 days to 50 days) and estimating the forecasting error using squared errors. The results are plotted to visualize the relationship between sampling intervals and MSE, providing insights into financial data behavior.
E N D
Calculating and Plotting MSE Angela Ryu Economics 201FS Honors Junior Workshop: Finance Duke University March 24, 2010
Example • XOM (Y) vs. WMT (X) • Number of days: 1093 days • Sampling interval: 5 minutes • Beta Calculation days: 30 days
Preparation (1) - Setup • Get WMT, XOM log returns and denote Px, Py respectively. • Sample P by 5 minutes: 76 data for each day • Take out the overnight returns • Size (Px) = Size (Py) = 76 * 1093
Preparation (2) – Calculate Beta • Days – (1:30), (2:31), (3:32), … , (1064:1093) • Case (1:30): • Take first 76 * 30 data (1 to 76*30) from Px and Py and denote X1:30 and Y1:30 . • Calculate with (where Y = βX) • Take the mean and denote β1:30 • Case (2:31): • Exclude the day 1 data (1 to 76) and add data on the day 31 (76*30+1 to 76*31). Get β2:31 • Repeat to get β3:32, …, β1063:1092 Note: all betas are scalar
Preparation (2) – Calculate Beta Case (1:30): Case (2:31):
Preparation (3) – Calculate MSE • Calculate SE for each beta. • SE31 = (Y31 - β1:30 * X31 )2 • SE32 = (Y32 – β2:31 * X32 )2 … • SE1093= (Y1093 – β1063:1092 * X1093 )2 Note: SEi is a vector of size 76 for all i = 31, … 1093 • Take the average to get MSE30 • MSE30 = avg [avg(SE1:30 ), …, avg(SE1064:1093)] ()2 Square each term in vector
Preparation (4) – change intervals & plot for each sampling interval • Sampling intervals: change from 1 min to 20 mins in prep. (1) • Beta Calculation intervals: change from 1 day to 50 days in prep (2) • Plot for each sampling interval • X axis: Beta Cal. Interval days (from 1 to 50) • Y axis: the value of MSE • In total, we get 20 plots