Would appreciate someone's help in spotting a silly error (or bad math) somewhere here. Its difficult to explain precisely without being able to attach some equations but basically I'm trying to establish equivalents between q5 and q6 below. But instead I get 0.21 & 0.37 and can't see my own error.
q5 is the integral of a product of a quadratic polynomial and the norm pdf q6 is the normal moment-generating-function in t=2,1,0 where each moment is multiplied by its respective polynomial coefficient h1,h2,h3. I can't see why these are not equivalent. If the problem isn't clear, please email me at mark.whirdy@gmail.com and I will send the equations which should help(can't attach a doc here unfortunately).
mu = 0; sigma = 1;h1 = -0.003;h2 = 0.10;h3 = 0.21;a = -10^10; b = 10^10; g = @(mu,sigma,h1,h2,h3)(quad(@(x)((h1*x.^2 + h2*x.^1 + h3*x.^0).*normpdf(x,mu,sigma)), a, b));q5 = g(mu,sigma,h1,h2,h3)t = (2:-1:0)';h = [h1, h2, h3];q6 = h * exp(mu*t + 0.5.*t.*sigma^2) % moment generating function
Best Answer