Example: Function call: ksm_max_ni(matrix_mn, matrix_vr, vector_yi, vector_qi, vector_wt).

 

matrix_mn:

 

s1

s2

s3

s4

s5

s6

s7

s8

-1

-31

14

21

5

9

-5

1

 

matrix_vr:

 

s1

s2

s3

s4

s5

s6

s7

s8

1

2

3

4

5

6

7

8

 

vector_yi:

 

id

value

1

2

3

4

5

6

-2

0

1

5

7

11

 

vector_qi:

 

id

value

1

2

3

4

5

6

0.1

0.2

0.15

0.15

0.3

0.1

 

vector_wt:

 

id

value

1

2

3

4

5

6

1

1

1

1

1

1

 

 

Kolmogorov-Smirnov Distance from a Discrete Distribution to a Mixture of Normal Independent Distributions is calculated at point_mn:

 

component_name

value

s1

s2

s3

s4

s5

s6

s7

s8

0.125

0.125

0.125

0.125

0.125

0.125

0.125

0.125

 

MATLAB code (.\Aorda\PSG\MATLAB\Examples\Func_value_ksm_max_ni.m) for function calculation:

 

%Define data:

H1 = [-1 -31 14 21 5 9 -5 1];

H2 = [1 2 3 4 5 6 7 8];

V1 = [-2,0,1,5,7,11];

V2 = [0.1,0.2,0.15,0.15,0.3,0.1];

V3 = [1,1,1,1,1,1];

a = [0.125;0.125;0.125;0.125;0.125;0.125;0.125;0.125];

%Calculation of functions with PSG Subroutine 'mpsg_function_value'

%Create the PSG matrix 'matrix_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(1) = matrix_pack('matrix_1', H1, [], [], []);

%Create the PSG matrix 'matrix_2'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(2) = matrix_pack('matrix_2', H2, [], [], []);

%Create the PSG vector 'vector_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(3) = vector_pack('vector_yi', V1);

%Create the PSG vector 'vector_2'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(4) = vector_pack('vector_qi', V2);

%Create the PSG vector 'vector_3'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(5) = vector_pack('vector_wt', V3);

%Create the PSG point 'point_1'(structure containing header and matrix body) and pack it to structure 'iargstruc_arr':

iargstruc_arr(6) = point_pack('point_1', a, []);

%Calculate ksm_max_ni function at point 'point_1':

val1 = mpsg_function_value('ksm_max_ni(matrix_1,matrix_2,vector_yi,vector_qi,vector_wt)','point_1',iargstruc_arr);

%Display function value:

disp(sprintf('mpsg_function_value = %g', val1));

 

Program output:

 

mpsg_function_value = 2.9832294e-001

 

This function can't be evaluated with PSG Subroutine 'functionvalue' because input matrices include different variables