29 June 2014 09:02:12 AM ASA266_PRB: C++ version Test the ASA266 library. TEST01 ALNORM, NORMP, and NPROB are routines that compute the cumulative density function for the normal distribution. X CDF1 1-CDF1 CDF2 1-CDF2 PDF2 CDF3 1-CDF3 PDF3 0 0.5 0.5 0.5 0.5 0.398942 0.5 0.5 0.398942 0.2 0.57926 0.42074 0.57926 0.42074 0.391043 0.57926 0.42074 0.391043 0.4 0.655422 0.344578 0.655422 0.344578 0.36827 0.655422 0.344578 0.36827 0.6 0.725747 0.274253 0.725747 0.274253 0.333225 0.725747 0.274253 0.333225 0.8 0.788145 0.211855 0.788145 0.211855 0.289692 0.788145 0.211855 0.289692 1 0.841345 0.158655 0.841345 0.158655 0.241971 0.841345 0.158655 0.241971 1.2 0.88493 0.11507 0.88493 0.11507 0.194186 0.88493 0.11507 0.194186 1.4 0.919243 0.0807567 0.919243 0.0807567 0.149727 0.919243 0.0807567 0.149727 1.6 0.945201 0.0547993 0.945201 0.0547993 0.110921 0.945201 0.0547993 0.110921 1.8 0.96407 0.0359303 0.96407 0.0359303 0.0789502 0.96407 0.0359303 0.0789502 2 0.97725 0.0227501 0.97725 0.0227501 0.053991 0.97725 0.0227501 0.053991 2.2 0.986097 0.0139034 0.986097 0.0139034 0.0354746 0.986097 0.0139034 0.0354746 2.4 0.991802 0.00819754 0.991802 0.00819754 0.0223945 0.991802 0.00819754 0.0223945 2.6 0.995339 0.00466119 0.995339 0.00466119 0.013583 0.995339 0.00466119 0.013583 2.8 0.997445 0.00255513 0.997445 0.00255513 0.00791545 0.997445 0.00255513 0.00791545 3 0.99865 0.0013499 0.99865 0.0013499 0.00443185 0.99865 0.0013499 0.00443185 TEST02 PPND, PPND16 compute the percentage points of the normal distribution. CDF PPND(CDF) PPND16(CDF) 0.1 -1.28155 -1.28155 0.2 -0.841621 -0.841621 0.3 -0.524401 -0.524401 0.4 -0.253347 -0.253347 0.5 0 0 0.6 0.253347 0.253347 0.7 0.524401 0.524401 0.8 0.841621 0.841621 0.9 1.28155 1.28155 TEST03 digamma(X) = d ( Log ( Gamma ( X ) ) ) / dX. DIGAMMA and R8_PSI compute the digamma function: X DIGAMMA R8_PSI 0.1 -10.4238 -10.4238 0.2 -5.28904 -5.28904 0.3 -3.50252 -3.50252 0.4 -2.56138 -2.56138 0.5 -1.96351 -1.96351 0.6 -1.54062 -1.54062 0.7 -1.22002 -1.22002 0.8 -0.965009 -0.965009 0.9 -0.754927 -0.754927 1 -0.577216 -0.577216 TEST04 TRIGAMMA computes the trigamma function: trigamma(X) = d^2 ( Log ( Gamma ( X ) ) ) / dX^2. X TRIGAMMA 0.1 101.433 0.2 26.2674 0.3 12.2454 0.4 7.27536 0.5 4.9348 0.6 3.63621 0.7 2.83405 0.8 2.29947 0.9 1.92254 1 1.64493 TEST05 ALNGAM ALOGAM, R8_GAMMA_LOG, and LNGAMMA compute the logarithm of the gamma function. X ALNGAM ALOGAM R8_GAMMA_LOG LNGAMMA 0.1 2.25271 2.25271 2.25271 2.25271 0.2 1.52406 1.52406 1.52406 1.52406 0.3 1.0958 1.0958 1.0958 1.0958 0.4 0.796678 0.796678 0.796678 0.796678 0.5 0.572365 0.572365 0.572365 0.572365 0.6 0.398234 0.398234 0.398234 0.398234 0.7 0.260867 0.260867 0.260867 0.260867 0.8 0.15206 0.15206 0.15206 0.15206 0.9 0.0663762 0.0663762 0.0663762 0.0663762 1 0 -1.99501e-11 0 6.66134e-16 TEST06 GAMAIN, GAMMDS and GAMMAD compute the incomplete Gamma integral. X P GAMMDS GAMMAD GAMAIN 0.1 0.1 0.827552 0.827552 0.827552 0.1 0.2 0.676043 0.676043 0.676043 0.1 0.3 0.545913 0.545913 0.545913 0.1 0.4 0.436236 0.436236 0.436236 0.1 0.5 0.345279 0.345279 0.345279 0.1 0.6 0.270899 0.270899 0.270899 0.1 0.7 0.210824 0.210824 0.210824 0.1 0.8 0.16284 0.16284 0.16284 0.1 0.9 0.124895 0.124895 0.124895 0.1 1 0.0951626 0.0951626 0.0951626 0.2 0.1 0.87942 0.87942 0.87942 0.2 0.2 0.764435 0.764435 0.764435 0.2 0.3 0.657507 0.657507 0.657507 0.2 0.4 0.560104 0.560104 0.560104 0.2 0.5 0.472911 0.472911 0.472911 0.2 0.6 0.396022 0.396022 0.396022 0.2 0.7 0.329108 0.329108 0.329108 0.2 0.8 0.271553 0.271553 0.271553 0.2 0.9 0.222566 0.222566 0.222566 0.2 1 0.181269 0.181269 0.181269 0.3 0.1 0.908358 0.908358 0.908358 0.3 0.2 0.816527 0.816527 0.816527 0.3 0.3 0.726957 0.726957 0.726957 0.3 0.4 0.64149 0.64149 0.64149 0.3 0.5 0.561422 0.561422 0.561422 0.3 0.6 0.487583 0.487583 0.487583 0.3 0.7 0.420417 0.420417 0.420417 0.3 0.8 0.36006 0.36006 0.36006 0.3 0.9 0.306407 0.306407 0.306407 0.3 1 0.259182 0.259182 0.259182 0.4 0.1 0.927574 0.927574 0.927574 0.4 0.2 0.852337 0.852337 0.852337 0.4 0.3 0.776381 0.776381 0.776381 0.4 0.4 0.701441 0.701441 0.701441 0.4 0.5 0.628907 0.628907 0.628907 0.4 0.6 0.559835 0.559835 0.559835 0.4 0.7 0.494986 0.494986 0.494986 0.4 0.8 0.434858 0.434858 0.434858 0.4 0.9 0.379725 0.379725 0.379725 0.4 1 0.32968 0.32968 0.32968 0.5 0.1 0.941402 0.941402 0.941402 0.5 0.2 0.878775 0.878775 0.878775 0.5 0.3 0.813812 0.813812 0.813812 0.5 0.4 0.748019 0.748019 0.748019 0.5 0.5 0.682689 0.682689 0.682689 0.5 0.6 0.618901 0.618901 0.618901 0.5 0.7 0.557515 0.557515 0.557515 0.5 0.8 0.499192 0.499192 0.499192 0.5 0.9 0.444406 0.444406 0.444406 0.5 1 0.393469 0.393469 0.393469 0.6 0.1 0.951832 0.951832 0.951832 0.6 0.2 0.899123 0.899123 0.899123 0.6 0.3 0.843211 0.843211 0.843211 0.6 0.4 0.78535 0.78535 0.78535 0.6 0.5 0.726678 0.726678 0.726678 0.6 0.6 0.668198 0.668198 0.668198 0.6 0.7 0.610769 0.610769 0.610769 0.6 0.8 0.555101 0.555101 0.555101 0.6 0.9 0.501764 0.501764 0.501764 0.6 1 0.451188 0.451188 0.451188 0.7 0.1 0.959945 0.959945 0.959945 0.7 0.2 0.91522 0.91522 0.91522 0.7 0.3 0.866863 0.866863 0.866863 0.7 0.4 0.815892 0.815892 0.815892 0.7 0.5 0.763276 0.763276 0.763276 0.7 0.6 0.709908 0.709908 0.709908 0.7 0.7 0.656589 0.656589 0.656589 0.7 0.8 0.604021 0.604021 0.604021 0.7 0.9 0.552799 0.552799 0.552799 0.7 1 0.503415 0.503415 0.503415 0.8 0.1 0.966395 0.966395 0.966395 0.8 0.2 0.928202 0.928202 0.928202 0.8 0.3 0.886215 0.886215 0.886215 0.8 0.4 0.841245 0.841245 0.841245 0.8 0.5 0.794097 0.794097 0.794097 0.8 0.6 0.745541 0.745541 0.745541 0.8 0.7 0.696301 0.696301 0.696301 0.8 0.8 0.647032 0.647032 0.647032 0.8 0.9 0.59832 0.59832 0.59832 0.8 1 0.550671 0.550671 0.550671 0.9 0.1 0.971607 0.971607 0.971607 0.9 0.2 0.938827 0.938827 0.938827 0.9 0.3 0.902253 0.902253 0.902253 0.9 0.4 0.862521 0.862521 0.862521 0.9 0.5 0.820288 0.820288 0.820288 0.9 0.6 0.776205 0.776205 0.776205 0.9 0.7 0.730906 0.730906 0.730906 0.9 0.8 0.684986 0.684986 0.684986 0.9 0.9 0.638996 0.638996 0.638996 0.9 1 0.59343 0.59343 0.59343 1 0.1 0.975873 0.975873 0.975873 1 0.2 0.94762 0.94762 0.94762 1 0.3 0.915674 0.915674 0.915674 1 0.4 0.880526 0.880526 0.880526 1 0.5 0.842701 0.842701 0.842701 1 0.6 0.80274 0.80274 0.80274 1 0.7 0.761188 0.761188 0.761188 1 0.8 0.718571 0.718571 0.718571 1 0.9 0.675392 0.675392 0.675392 1 1 0.632121 0.632121 0.632121 TEST07 PPCHI2 computes the percentage points of the chi squared distribution. CDF PPCHI2(CDF) For Chi^2 parameter value = 1 0.1 0.0157908 0.2 0.0641848 0.3 0.148472 0.4 0.274996 0.5 0.454936 0.6 0.708326 0.7 1.07419 0.8 1.64237 0.9 2.70554 For Chi^2 parameter value = 2 0.1 0.210721 0.2 0.446287 0.3 0.71335 0.4 1.02165 0.5 1.38629 0.6 1.83258 0.7 2.40795 0.8 3.21888 0.9 4.60517 For Chi^2 parameter value = 3 0.1 0.584374 0.2 1.00517 0.3 1.42365 0.4 1.86917 0.5 2.36597 0.6 2.94617 0.7 3.66487 0.8 4.64163 0.9 6.25139 For Chi^2 parameter value = 4 0.1 1.06362 0.2 1.64878 0.3 2.1947 0.4 2.75284 0.5 3.35669 0.6 4.04463 0.7 4.87843 0.8 5.98862 0.9 7.77944 For Chi^2 parameter value = 5 0.1 1.61031 0.2 2.34253 0.3 2.99991 0.4 3.6555 0.5 4.35146 0.6 5.13187 0.7 6.06443 0.8 7.28928 0.9 9.23636 For Chi^2 parameter value = 6 0.1 2.20413 0.2 3.07009 0.3 3.82755 0.4 4.57015 0.5 5.34812 0.6 6.21076 0.7 7.23114 0.8 8.55806 0.9 10.6446 For Chi^2 parameter value = 7 0.1 2.83311 0.2 3.82232 0.3 4.67133 0.4 5.49323 0.5 6.34581 0.6 7.28321 0.7 8.38343 0.8 9.80325 0.9 12.017 For Chi^2 parameter value = 8 0.1 3.48954 0.2 4.59357 0.3 5.52742 0.4 6.42265 0.5 7.34412 0.6 8.35053 0.7 9.52446 0.8 11.0301 0.9 13.3616 For Chi^2 parameter value = 9 0.1 4.16816 0.2 5.38005 0.3 6.39331 0.4 7.35703 0.5 8.34283 0.6 9.41364 0.7 10.6564 0.8 12.2421 0.9 14.6837 TEST08 For samples of a Dirichlet PDF, DIRICHLET_ESTIMATE estimates the parameters. DIRICHLET_MEAN finds the means; DIRICHLET_VARIANCE finds the variances; Sampled data: Col: 0 1 2 Row 0: 0.178 0.346 0.476 1: 0.162 0.307 0.531 2: 0.083 0.448 0.469 3: 0.087 0.474 0.439 4: 0.078 0.503 0.419 5: 0.04 0.456 0.504 6: 0.049 0.363 0.588 7: 0.1 0.317 0.583 8: 0.075 0.394 0.531 9: 0.084 0.445 0.471 10: 0.06 0.435 0.505 11: 0.089 0.418 0.493 12: 0.05 0.485 0.465 13: 0.073 0.378 0.549 14: 0.064 0.562 0.374 15: 0.085 0.465 0.45 16: 0.094 0.388 0.518 17: 0.014 0.449 0.537 18: 0.06 0.544 0.396 19: 0.031 0.569 0.4 20: 0.025 0.491 0.484 21: 0.045 0.613 0.342 22: 0.0195 0.526 0.4545 Observed means, variances are: 0 0.0715435 0.00157825 1 0.45113 0.00656248 2 0.477326 0.00405826 Index, Estimate, Lower Limit, Upper Limit: 0 3.21543 1.89027 4.54058 1 20.3825 11.9282 28.8368 2 21.6852 12.6925 30.678 Expected means, variances are: 0 0.0710071 0.00142525 1 0.450112 0.00534776 2 0.478881 0.0053919 Alpha sum is 45.2832 NORMALIZED VALUES: Index, Estimate, Lower Limit, Upper Limit: 0 0.0710071 0.0417434 0.100271 1 0.450112 0.263413 0.636811 2 0.478881 0.280291 0.677471 Log likelikhood function = 73.125 TEST085 GAMMA_SAMPLE samples a Gamma distribution. A = 0.514995, B = 1.917 1 0.0524575 2 0.00168385 3 0.00327396 4 0.124088 5 0.751609 A = 0.279635, B = 0.125872 1 6.55048 2 0.00629324 3 0.0915894 4 0.00473116 5 3.02342 A = 1.73631, B = 0.962208 1 0.911695 2 1.01452 3 0.694456 4 1.85073 5 0.0887554 A = 0.797351, B = 1.27269 1 0.238995 2 0.987946 3 0.80253 4 0.24839 5 0.773444 A = 0.873242, B = 1.88362 1 0.007078 2 0.0609463 3 0.0640018 4 0.12424 5 0.660474 TEST09 For a Dirichlet distribution, DIRICHLET_SAMPLE samples; DIRICHLET_MEAN finds the means; DIRICHLET_VARIANCE finds the variances; DIRICHLET_ESTIMATE estimates the parameters. Distribution parameters: 0: 3.22 1: 20.38 2: 21.68 Distribution means, variances are: 0 0.0711131 0.00142731 1 0.450088 0.00534807 2 0.478799 0.00539219 Number of samples is 1000 First few samples: 0 0.0351355 0.394756 0.570109 1 0.0533825 0.327197 0.61942 2 0.0166818 0.316682 0.666636 3 0.129758 0.404869 0.465373 4 0.080895 0.434557 0.484548 5 0.105708 0.457503 0.436789 6 0.111376 0.451696 0.436928 7 0.113959 0.591277 0.294763 8 0.102435 0.374654 0.522912 9 0.0251995 0.394451 0.58035 Observed means, variances are: 0 0.068279 0.00133249 1 0.445853 0.00513876 2 0.485868 0.00510117 Index, Estimate, Lower Limit, Upper Limit: 0 3.19442 2.99432 3.39452 1 20.9057 19.5872 22.2241 2 22.7855 21.3484 24.2226 Alpha sum is 46.8856 NORMALIZED VALUES: Index, Estimate, Lower Limit, Upper Limit: 0 0.0681321 0.0638643 0.0724 1 0.445886 0.417766 0.474006 2 0.485981 0.45533 0.516633 Log likelikhood function = 3232.77 TEST10 For a Dirichlet mixture distribution, DIRICHLET_MIX_SAMPLE samples; DIRICHLET_MIX_MEAN computes means; DIRICHLET_MIX_VARIANCE computes variances. Component weight: 0: 3 1: 2 2: 1 Component Parameters Means Variances 0 0 0.05 0.05 0.02375 1 0.2 0.2 0.08 2 0.75 0.75 0.09375 1 0 0.85 0.85 0.06375 1 0.1 0.1 0.045 2 0.05 0.05 0.02375 2 0 0 0 0 1 0.5 0.5 0.125 2 0.5 0.5 0.125 Element means: 0: 0.308333 1: 0.216667 2: 0.475 Number of samples is 200 First few samples: Sample Component X 0 0 0.834665 0.112933 0.0524017 1 0 2.4052e-27 3.11998e-06 0.999997 2 1 0.953697 0.0463033 7.91741e-35 3 2 0 0.839862 0.160138 4 1 0.984848 0.0151511 6.67235e-07 5 1 0.999168 0.000718859 0.000113254 6 1 0.854503 0.121128 0.0243687 7 0 0.0616575 0.13063 0.807713 8 0 8.97e-05 0.608623 0.391288 9 0 1.89725e-09 0.000745398 0.999255 Element Observed mean, variance 0 0.333082 0.159045 1 0.334757 0.155437 2 0.332161 0.156687 ASA266_PRB: Normal end of execution. 29 June 2014 09:02:12 AM