How to do a double integration of a multivariate normal probability density function
이전 댓글 표시
Hi,
I'm trying to do a double integral on a nultivariate normal probability density function. The two variables I want to integrate over is U and K. I created a function (fun) with the formula for multivariate normal pdf and used this to performe the double integral. When I do it like this I only get errors. Is there an easier approach?
My code:
clc; clear all; close all;
C = [23.875 15.75281; 15.75281 93.9842]; % C = [sigma_u^2 ro*sigma_u*sigma_k;...
ro*sigma_u*sigma_k sigma_k]
mu_u = 1788.2058;
mu_k = 70.8489;
mu = [mu_u;mu_k];
fun = @(U,K) ((1/sqrt(det(C)*(2*pi)^2))*exp(-0.5*transpose([U;K]-mu)*inv(C)*([U;K]-mu)));
q = integral2(fun,1700,1900,30,120);
Thanks!
댓글 수: 1
Greig
2015년 3월 13일
The integral functions assume that the function being integrated is vectorized and speed the integration process by passing vectors of U and K into your function. The way your function is written, however, cannot handle vectors of U and K. Later, either I, or someone else will help you vectorize it (I have no time right now).
채택된 답변
추가 답변 (1개)
Roger Stafford
2015년 3월 13일
You can also compute this using the Statistical Toolbox function 'mvncdf'. See its documentation at:
http://www.mathworks.com/help/stats/mvncdf.html
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!