MEXGENZMVNPRB Computes multivariate normal probability by Genz' algorithm using randomized Korobov rules or subregion adaptive integration rules or crude Monte Carlo method CALL [value,error,inform]=mexgenzmvnprb(correl,A,B,abseps,releps,maxpoints,method); CORREL = vector of correlation coefficients; the correlation coefficient in row I column J of the correlation matrix should be stored in CORREL( J + ((I-2)*(I-1))/2 ), for J < I. (Note: If S is a correlation matrix then CORREL = S(find(tril(S,-1)));) The correlation matrix must be positive semidefinite. A = vector of lower integration limits. B = vector of upper integration limits. NOTE: any values greater the 37, are considered as infinite values. ABSEPS = absolute error tolerance. RELEPS = relative error tolerance. MAXPTS = maximum number of function values allowed. This parameter can be used to limit the time. A sensible strategy is to start with MAXPTS = 1000*N, and then increase MAXPTS if ERROR is too large. ERROR = estimated absolute error, with 99% confidence level. VALUE = estimated value for the integral INFORM = termination status parameter: if INFORM = 0, normal completion with ERROR < EPS; if INFORM = 1, completion with ERROR > EPS and MAXPTS function vaules used; increase MAXPTS to decrease ERROR; if INFORM = 2, N > NMAX or N < 1. METHOD INTEGER, defining the integration method used 1 SADAPT Subregion Adaptive integration method , NMAX = 20 2 KROBOV Randomized KOROBOV rules NMAX = 100 3 RCRUDE Crude Monte-Carlo Algorithm with simple antithetic variates, NMAX = 100 and weighted results on restart 4 SPHMVN Monte-Carlo algorithm by Deak (1980), NMAX = 100
Display message and abort function. |
Multivariate Normal probability by Genz' algorithm. |
001 function [value,error1,inform]=mexgenzmvnprb(correl,A,B,abseps,releps,maxpoints,method) 002 %MEXGENZMVNPRB Computes multivariate normal probability by Genz' algorithm 003 % using randomized Korobov rules or subregion adaptive 004 % integration rules or crude Monte Carlo method 005 % 006 % CALL [value,error,inform]=mexgenzmvnprb(correl,A,B,abseps,releps,maxpoints,method); 007 % 008 % CORREL = vector of correlation coefficients; the correlation 009 % coefficient in row I column J of the correlation matrix 010 % should be stored in CORREL( J + ((I-2)*(I-1))/2 ), for J < I. 011 % (Note: If S is a correlation matrix then CORREL = S(find(tril(S,-1)));) 012 % The correlation matrix must be positive semidefinite. 013 % A = vector of lower integration limits. 014 % B = vector of upper integration limits. 015 % NOTE: any values greater the 37, are considered as infinite values. 016 % ABSEPS = absolute error tolerance. 017 % RELEPS = relative error tolerance. 018 % MAXPTS = maximum number of function values allowed. This 019 % parameter can be used to limit the time. A sensible 020 % strategy is to start with MAXPTS = 1000*N, and then 021 % increase MAXPTS if ERROR is too large. 022 % ERROR = estimated absolute error, with 99% confidence level. 023 % VALUE = estimated value for the integral 024 % INFORM = termination status parameter: 025 % if INFORM = 0, normal completion with ERROR < EPS; 026 % if INFORM = 1, completion with ERROR > EPS and MAXPTS 027 % function vaules used; increase MAXPTS to 028 % decrease ERROR; 029 % if INFORM = 2, N > NMAX or N < 1. 030 % METHOD INTEGER, defining the integration method used 031 % 1 SADAPT Subregion Adaptive integration method , NMAX = 20 032 % 2 KROBOV Randomized KOROBOV rules NMAX = 100 033 % 3 RCRUDE Crude Monte-Carlo Algorithm with simple antithetic variates, NMAX = 100 034 % and weighted results on restart 035 % 4 SPHMVN Monte-Carlo algorithm by Deak (1980), NMAX = 100 036 % 037 % 038 039 % The corresponding mex-file was successfully compiled for matlab 5.3 040 % using Compaq Visual Fortran 6.1, and Windows 2000 and XP. 041 % The example here uses Fortran77 source. 042 % First, you will need to modify your mexopts.bat file. 043 % To find it, issue the command prefdir(1) from the Matlab command line, 044 % the directory it answers with will contain your mexopts.bat file. 045 % Open it for editing. The first section will look like: 046 % 047 %rem ******************************************************************** 048 %rem General parameters 049 %rem ******************************************************************** 050 %set MATLAB=%MATLAB% 051 %set DF_ROOT=C:\Program Files\Microsoft Visual Studio 052 %set VCDir=%DF_ROOT%\VC98 053 %set MSDevDir=%DF_ROOT%\Common\msdev98 054 %set DFDir=%DF_ROOT%\DF98 055 %set PATH=%MSDevDir%\bin;%DFDir%\BIN;%VCDir%\BIN;%PATH% 056 %set INCLUDE=%DFDir%\INCLUDE;%DFDir%\IMSL\INCLUDE;%INCLUDE% 057 %set LIB=%DFDir%\LIB;%VCDir%\LIB 058 % 059 % then you are ready to compile this file at the matlab prompt using the following command: 060 % mex -O mexGenzMvnPrb.f 061 062 disp('mexGenzMvnPrb is not implemented as a m-function') 063 disp(' compile the mexfile mexGenzMvnPrb.f before you try again.') 064 error('mexGenzMvnPrb error') 065 return
Comments or corrections to the WAFO group