About precision of cdfMvn and multi-thread

Hello,

What is the precision of the GAUSS function cdfMvn? How can I change that? I learned that I can use cdfMvne to set an error tolerance, but I do not know how to use a cdfmControl structure (I looked examples online and they do not work).

And related to that. I understand that some GAUSS functions can use the different cores of my computer (I have 8 cores) to make faster computations. Is cdfMvn using multi-thread?

Thank you very much,

Sebastian

3 Answers



0



Here are some working examples from the GAUSS 17 command reference page for cdfmvne
Example 1

//Upper limits of integration for K dimensional multivariate distribution
x = { 0  0 };

//Identity matrix, indicates
//zero correlation between variables
R = { 1 0,
      0 1 };
				
//Define non-centrality vector 
m  = { 0, 0 };	
						
//Define control structure				
struct cdfmControl ctl;
ctl = cdfmControlCreate();

//Calculate cumulative probability of
//both variables being ≤ 0
{p, err, retcode} = cdfMvne(ctl, x, R, m );

//Calculate joint probablity of two
//variables with zero correlation,
//both, being ≤ 0
p2 = cdfn(0) .* cdfn(0);

Both p and p2 should equal 0.25.

Example 2: Compute the multivariate normal cdf at 3 separate pairs of upper limits

//Upper limits of integration
//x1 ≤ -1 and x2 ≤ -1.1
//x1 ≤ 0 and x2 ≤ 0.1
//x1 ≤ 1 and x2 ≤ 1.1
x = {  -1   -1.1,
        0    0.1,
        1    1.1 };

//Correlation matrix
R = {   1  0.31,
     0.31     1 };
				
//Define non-centrality vector 
m  = { 0, 0 };
        				
//Define control structure
struct cdfmControl ctl;
ctl = cdfmControlCreate();
				
//Calculate cumulative probability of
//each pair of upper limits
{ p, err, retcode }  = cdfMvne(ctl, x, R, m);

aptech

1,773


0



Hi,

Thank you for your answer. However, those are the examples I already had and they are not helping. My question is how I can modify the attributes of cdfmControlCreate() to be able to set the error tolerance myself. If I understand correctly, those examples you shared are using the default error tolerance.

And also, are cdfMvn or cdfMvne using multi-threading?

What is the default tolerance for cdfMvn and cdfMvne?

Thank you very much,

Sebastian

 



0



The default values for the cdfmControl structure are:

  • Maximum evaluations: 5e5
  • Absolute error tolerance: 1e-6
  • Relative error tolerance: 1e-12

You can set the members of the cdfmControl structure using the '.' operator. Here is a modified version of the earlier examples, which modifies the control structure:

//Upper limits of integration for K dimensional multivariate distribution
x = { 0  0 };

//Identity matrix, indicates
//zero correlation between variables
R = { 1 0,
      0 1 };
				
//Define non-centrality vector 
m  = { 0, 0 };	
						
//Define control structure				
struct cdfmControl ctl;

//Fill control structure with default values
ctl = cdfmControlCreate();

//Adjust tolerance
ctl.absErrorTolerance = 1e-4;
ctl.relErrorTolerance = 1e-4;

//Calculate cumulative probability of
//both variables being ≤ 0
{p, err, retcode} = cdfMvne(ctl, x, R, m );

With any structure that is in a loaded library (cdfmControl is loaded by default), after you declare a variable to be an instance of the structure, for example:

//Declare 'ctl' to be a cdfmControl structure
struct cdfmControl ctl;

when you enter the name of the structure instance, followed by the 'dot operator':

ctl.

you will get an autocomplete list, containing the names of all members of the structure.

If you right-click on cdfmControlCreate() in the GAUSS Editor and select 'Open function definition', it will show you the code for the procedure. In this case it is just a few lines, applying the default settings.

aptech

1,773

Your Answer

3 Answers

0

Here are some working examples from the GAUSS 17 command reference page for cdfmvne
Example 1

//Upper limits of integration for K dimensional multivariate distribution
x = { 0  0 };

//Identity matrix, indicates
//zero correlation between variables
R = { 1 0,
      0 1 };
				
//Define non-centrality vector 
m  = { 0, 0 };	
						
//Define control structure				
struct cdfmControl ctl;
ctl = cdfmControlCreate();

//Calculate cumulative probability of
//both variables being ≤ 0
{p, err, retcode} = cdfMvne(ctl, x, R, m );

//Calculate joint probablity of two
//variables with zero correlation,
//both, being ≤ 0
p2 = cdfn(0) .* cdfn(0);

Both p and p2 should equal 0.25.

Example 2: Compute the multivariate normal cdf at 3 separate pairs of upper limits

//Upper limits of integration
//x1 ≤ -1 and x2 ≤ -1.1
//x1 ≤ 0 and x2 ≤ 0.1
//x1 ≤ 1 and x2 ≤ 1.1
x = {  -1   -1.1,
        0    0.1,
        1    1.1 };

//Correlation matrix
R = {   1  0.31,
     0.31     1 };
				
//Define non-centrality vector 
m  = { 0, 0 };
        				
//Define control structure
struct cdfmControl ctl;
ctl = cdfmControlCreate();
				
//Calculate cumulative probability of
//each pair of upper limits
{ p, err, retcode }  = cdfMvne(ctl, x, R, m);
0

Hi,

Thank you for your answer. However, those are the examples I already had and they are not helping. My question is how I can modify the attributes of cdfmControlCreate() to be able to set the error tolerance myself. If I understand correctly, those examples you shared are using the default error tolerance.

And also, are cdfMvn or cdfMvne using multi-threading?

What is the default tolerance for cdfMvn and cdfMvne?

Thank you very much,

Sebastian

 

0

The default values for the cdfmControl structure are:

  • Maximum evaluations: 5e5
  • Absolute error tolerance: 1e-6
  • Relative error tolerance: 1e-12

You can set the members of the cdfmControl structure using the '.' operator. Here is a modified version of the earlier examples, which modifies the control structure:

//Upper limits of integration for K dimensional multivariate distribution
x = { 0  0 };

//Identity matrix, indicates
//zero correlation between variables
R = { 1 0,
      0 1 };
				
//Define non-centrality vector 
m  = { 0, 0 };	
						
//Define control structure				
struct cdfmControl ctl;

//Fill control structure with default values
ctl = cdfmControlCreate();

//Adjust tolerance
ctl.absErrorTolerance = 1e-4;
ctl.relErrorTolerance = 1e-4;

//Calculate cumulative probability of
//both variables being ≤ 0
{p, err, retcode} = cdfMvne(ctl, x, R, m );

With any structure that is in a loaded library (cdfmControl is loaded by default), after you declare a variable to be an instance of the structure, for example:

//Declare 'ctl' to be a cdfmControl structure
struct cdfmControl ctl;

when you enter the name of the structure instance, followed by the 'dot operator':

ctl.

you will get an autocomplete list, containing the names of all members of the structure.

If you right-click on cdfmControlCreate() in the GAUSS Editor and select 'Open function definition', it will show you the code for the procedure. In this case it is just a few lines, applying the default settings.


You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.