12 June 2018 10:58:32 AM WISHART_TEST C version Test the WISHART library. INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_UNIT_SAMPLE_TEST: WISHART_UNIT_SAMPLE samples unit Wishart matrices by: W = wishart_unit_sample ( n, df ); wishart_unit_sample ( 5, 8 ): Col: 0 1 2 3 4 Row 0: 4.696837 -2.059752 -3.834800 -0.622254 2.517262 1: -2.059752 5.839295 3.259846 -1.166522 -1.178525 2: -3.834800 3.259846 9.881191 3.410092 -3.723197 3: -0.622254 -1.166522 3.410092 5.150597 -2.123609 4: 2.517262 -1.178525 -3.723197 -2.123609 17.390168 wishart_unit_sample ( 5, 8 ): Col: 0 1 2 3 4 Row 0: 5.020823 1.471580 3.739249 -0.296867 -0.229552 1: 1.471580 5.772217 0.307906 -0.823420 -4.336069 2: 3.739249 0.307906 7.107092 -1.642546 1.502318 3: -0.296867 -0.823420 -1.642546 1.937990 1.241622 4: -0.229552 -4.336069 1.502318 1.241622 5.854560 wishart_unit_sample ( 5, 5 ): Col: 0 1 2 3 4 Row 0: 2.823058 -0.837351 1.233088 1.780998 0.113968 1: -0.837351 4.101549 -0.300706 -1.743824 -2.382228 2: 1.233088 -0.300706 7.496379 -3.423896 -0.786605 3: 1.780998 -1.743824 -3.423896 4.308049 1.157257 4: 0.113968 -2.382228 -0.786605 1.157257 1.738565 wishart_unit_sample ( 3, 5 ): Col: 0 1 2 Row 0: 0.519611 0.869653 -1.459082 1: 0.869653 3.463674 -3.366001 2: -1.459082 -3.366001 5.184372 Eigenvectors of previous matrix: Col: 0 1 2 Row 0: -0.215348 -0.252157 0.943421 1: -0.594100 0.800565 0.078364 2: 0.775030 0.543611 0.322206 Eigenvalues of previous matrix: 0: 8.170001 1: 0.904129 2: 0.093528 INITIALIZE - Note: The RNGLIB package has been initialized. BARTLETT_UNIT_SAMPLE_TEST: BARTLETT_UNIT_SAMPLE samples unit Bartlett matrices by: T = bartlett_unit_sample ( n, df ); bartlett_unit_sample ( 5, 8 ): Col: 0 1 2 3 4 Row 0: 2.167219 -0.950413 -1.769457 -0.287121 1.161517 1: 0.000000 2.221713 0.710322 -0.647881 -0.033579 2: 0.000000 0.000000 2.499131 1.345367 -0.657865 3: 0.000000 0.000000 0.000000 1.684754 -0.550110 4: 0.000000 0.000000 0.000000 0.000000 3.912098 bartlett_unit_sample ( 5, 8 ): Col: 0 1 2 3 4 Row 0: 2.240719 0.656744 1.668772 -0.132487 -0.102446 1: 0.000000 2.311040 -0.340994 -0.318649 -1.847129 2: 0.000000 0.000000 2.050857 -0.746084 0.508771 3: 0.000000 0.000000 0.000000 1.123503 0.907029 4: 0.000000 0.000000 0.000000 0.000000 1.162166 bartlett_unit_sample ( 5, 5 ): Col: 0 1 2 3 4 Row 0: 1.680196 -0.498365 0.733896 1.059995 0.067830 1: 0.000000 1.962952 0.033135 -0.619251 -1.196373 2: 0.000000 0.000000 2.637552 -1.585297 -0.302077 3: 0.000000 0.000000 0.000000 0.536491 -0.250480 4: 0.000000 0.000000 0.000000 0.000000 0.385571 bartlett_unit_sample ( 3, 5 ): Col: 0 1 2 Row 0: 0.720841 1.206443 -2.024140 1: 0.000000 1.417099 -0.652030 2: 0.000000 0.000000 0.813686 Eigenvectors of previous matrix: Col: 0 1 2 Row 0: -0.215348 -0.252157 0.943421 1: -0.594100 0.800565 0.078364 2: 0.775030 0.543611 0.322206 Eigenvalues of previous matrix: 0: 8.170001 1: 0.904129 2: 0.093528 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST03: Verify that, if using the same set of random numbers, W = T' * T, where W = wishart_unit_sample ( n, df ); T = bartlett_unit_sample ( n, df ); INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 0 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST04: We can compute sample Wishart matrices by: W = wishart_sample ( n, df, sigma ); wishart_sample ( 5, 8, Identity ): Col: 0 1 2 3 4 Row 0: 4.696837 -2.059752 -3.834800 -0.622254 2.517262 1: -2.059752 5.839295 3.259846 -1.166522 -1.178525 2: -3.834800 3.259846 9.881191 3.410092 -3.723197 3: -0.622254 -1.166522 3.410092 5.150597 -2.123609 4: 2.517262 -1.178525 -3.723197 -2.123609 17.390168 wishart_sample ( 5, 8, Identity ): Col: 0 1 2 3 4 Row 0: 5.020823 1.471580 3.739249 -0.296867 -0.229552 1: 1.471580 5.772217 0.307906 -0.823420 -4.336069 2: 3.739249 0.307906 7.107092 -1.642546 1.502318 3: -0.296867 -0.823420 -1.642546 1.937990 1.241622 4: -0.229552 -4.336069 1.502318 1.241622 5.854560 wishart_sample ( 5, 8, diag(1,2,3,4,5) ): Col: 0 1 2 3 4 Row 0: 5.410030 -1.639315 2.956615 4.930983 0.352785 1: -1.639315 14.865728 -0.678348 -6.188877 -10.247528 2: 2.956615 -0.678348 11.997220 0.677447 -4.682642 3: 4.930983 -6.188877 0.677447 17.497387 6.533590 4: 0.352785 -10.247528 -4.682642 6.533590 16.695469 Set covariance SIGMA: Col: 0 1 2 Row 0: 25.000000 5.000000 15.000000 1: 5.000000 17.000000 11.000000 2: 15.000000 11.000000 49.000000 wishart_sample ( 3, 3, sigma ): Col: 0 1 2 Row 0: 64.106741 51.459713 -39.456494 1: 51.459713 48.816352 -38.638283 2: -39.456494 -38.638283 34.738229 Eigenvectors of previous matrix: Col: 0 1 2 Row 0: 0.659767 0.702857 -0.265894 1: 0.585267 -0.258670 0.768474 2: -0.471348 0.662633 0.582021 Eigenvalues of previous matrix: 0: 137.944019 1: 7.969735 2: 1.747569 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST05: We can compute sample Bartlett matrices by: T = bartlett_sample ( n, df, sigma ); bartlett_sample ( 5, 8, Identity ): Col: 0 1 2 3 4 Row 0: 2.167219 -0.950413 -1.769457 -0.287121 1.161517 1: 0.000000 2.221713 0.710322 -0.647881 -0.033579 2: 0.000000 0.000000 2.499131 1.345367 -0.657865 3: 0.000000 0.000000 0.000000 1.684754 -0.550110 4: 0.000000 0.000000 0.000000 0.000000 3.912098 bartlett_sample ( 5, 8, Identity ): Col: 0 1 2 3 4 Row 0: 2.240719 0.656744 1.668772 -0.132487 -0.102446 1: 0.000000 2.311040 -0.340994 -0.318649 -1.847129 2: 0.000000 0.000000 2.050857 -0.746084 0.508771 3: 0.000000 0.000000 0.000000 1.123503 0.907029 4: 0.000000 0.000000 0.000000 0.000000 1.162166 bartlett_sample ( 5, 8, diag(1,2,3,4,5) ): Col: 0 1 2 3 4 Row 0: 2.325947 -0.704795 1.271145 2.119989 0.151674 1: 0.000000 3.790645 0.057391 -1.238501 -2.675172 2: 0.000000 0.000000 3.221509 -0.604154 -1.465745 3: 0.000000 0.000000 0.000000 3.332288 0.604181 4: 0.000000 0.000000 0.000000 0.000000 2.646219 Set covariance SIGMA: Col: 0 1 2 Row 0: 25.000000 5.000000 15.000000 1: 5.000000 17.000000 11.000000 2: 15.000000 11.000000 49.000000 bartlett_sample ( 3, 3, sigma ): Col: 0 1 2 Row 0: 8.006669 6.427107 -4.927954 1: 0.000000 2.740192 -2.542084 2: 0.000000 0.000000 1.997826 Eigenvectors of previous matrix: Col: 0 1 2 Row 0: 0.659767 0.702857 -0.265894 1: 0.585267 -0.258670 0.768474 2: -0.471348 0.662633 0.582021 Eigenvalues of previous matrix: 0: 137.944019 1: 7.969735 2: 1.747569 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST06: Verify that, if using the same set of random numbers, W = T'' * T, where W = wishart_sample ( n, df, sigma ); T = bartlett_sample ( n, df, sigma ); Covariance SIGMA: Col: 0 1 2 Row 0: 25.000000 5.000000 15.000000 1: 5.000000 17.000000 11.000000 2: 15.000000 11.000000 49.000000 INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 2.38323e-14 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST07: For given values of N, DF, SIGMA, the random matrices from the Wishart distribution: W = wishart_sample ( n, df, sigma ); should have mean DF * SIGMA. Fix N = 3 Fix DF = 5 Fix covariance SIGMA: Col: 0 1 2 Row 0: 25.000000 5.000000 15.000000 1: 5.000000 17.000000 11.000000 2: 15.000000 11.000000 49.000000 W_Average / DF: Col: 0 1 2 Row 0: 24.716112 4.613295 14.540540 1: 4.613295 16.961239 10.673099 2: 14.540540 10.673099 47.892142 Frobenius norm of SIGMA-W_average/DF = 1.49815 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST08: Verify that, if using the same set of random numbers, inverse(W) = M, where W = wishart_unit_sample ( n, df ); M = wishart_unit_sample_inverse ( n, df ); INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 9.07904e-16 INITIALIZE - Note: The RNGLIB package has been initialized. WISHART_TEST09: Verify that, if using the same set of random numbers, inverse(W) = M, where W = wishart_sample ( n, df, sigma ); M = wishart_sample_inverse ( n, df, sigma ); INITIALIZE - Note: The RNGLIB package has been initialized. INITIALIZE - Note: The RNGLIB package has been initialized. Frobenius norm of error is 1.83084e-15 WISHART_TEST Normal end of execution. 12 June 2018 10:58:32 AM