Bump for interest in question 6! And I can't access the above link that cassio posted a few years ago

I'm able to get gbar and calculate the bias correctly but calculating the variance still has me stumped.

Here's my thought process:

To calculate variance, compute the integral of (g(x) - gbar(x))^2*p(x) from x = -1 to x = 1. Do this for each hypothesis g in your your hypothesis set (I generated 1000 different g's). p(x) is the uniform distribution that produces your x-axis data points. Now the expected value of a uniform random variable from -1 to 1 is 1/(1- -1) or 1/2. So the integral you calculate for each hypothesis g is really (g(x) - gbar(x))^2/2 from -1 to 1.

Take the average of these integrals to get your variance.

I'm not getting the answer so clearly my logic is wrong. Can anybody point me in the right direction?