forked from johannesgerer/jburkardt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asa266.html
487 lines (444 loc) · 13.8 KB
/
asa266.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<html>
<head>
<title>
ASA266 - Estimating the Parameters of a Dirichlet PDF
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
ASA266 <br> Estimating the Parameters of a Dirichlet PDF
</h1>
<hr>
<p>
<b>ASA266</b>
is a C++ library which
estimates the parameters of a Dirichlet probability density function.
</p>
<p>
<b>ASA266</b> is Applied Statistics Algorithm 266. Source code for many
Applied Statistics Algorithms is available through
<a href = "http://lib.stat.cmu.edu/apstat">STATLIB</a>.
</p>
<p>
The assumption is that a given process is governed by a Dirichlet
distribution with parameters ALPHA(I), I = 1 to N, positive quantities
which are required to sum to 1. Each observation of the process yields
a vector of N data values. After a number of observations of this sort,
it is desired to estimate the the underlying parameters ALPHA of
the Dirichlet distribution.
</p>
<p>
There are a considerable number of routines required to get DIRICH
to work. In some cases, there are several versions of the routines,
and they all were included, in order to provide a way to check
results. Most of the routines are themselves Applied Statistics
Algorithms, and their source code is available through
<a href = "http://lib.stat.cmu.edu/apstat">STATLIB</a>.
</p>
<p>
Also included is a routine DIRICHLET_SAMPLE, with which experiments
can be carried out. Values for the parameters ALPHA can be chosen,
and data generated by DIRICHLET_SAMPLE. Then DIRICH can analyze this
data and attempt to determine the values of ALPHA.
</p>
<p>
Another routine, DIRICHLET_MIX_SAMPLE, allows you to sample a
probability distribution that is a weighted mixture of Dirichlet
distributions.
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>ASA266</b> is available in
<a href = "../../c_src/asa266/asa266.html">a C version</a> and
<a href = "../../cpp_src/asa266/asa266.html">a C++ version</a> and
<a href = "../../f77_src/asa266/asa266.html">a FORTRAN77 version</a> and
<a href = "../../f_src/asa266/asa266.html">a FORTRAN90 version</a> and
<a href = "../../m_src/asa266/asa266.html">a MATLAB version.</a>
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../cpp_src/asa032/asa032.html">
ASA032</a>,
a C++ library which
evaluates the incomplete Gamma integral.
</p>
<p>
<a href = "../../cpp_src/asa066/asa066.html">
ASA066</a>,
a C++ library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../cpp_src/asa091/asa091.html">
ASA091</a>,
a C++ library which
evaluates the percentage points of the Chi-Squared distribution.
</p>
<p>
<a href = "../../cpp_src/asa103/asa103.html">
ASA103</a>,
a C++ library which
evaluates the digamma or psi function.
</p>
<p>
<a href = "../../cpp_src/asa111/asa111.html">
ASA111</a>,
a C++ library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../cpp_src/asa121/asa121.html">
ASA121</a>,
a C++ library which
evaluates the trigamma function.
</p>
<p>
<a href = "../../cpp_src/asa147/asa147.html">
ASA147</a>,
a C++ library which
evaluates the incomplete Gamma function.
</p>
<p>
<a href = "../../cpp_src/asa239/asa239.html">
ASA239</a>,
a C++ library which
evaluates the percentage points of the Chi-Squared distribution
and the incomplete Gamma function.
</p>
<p>
<a href = "../../cpp_src/asa241/asa241.html">
ASA241</a>,
a C++ library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../cpp_src/asa245/asa245.html">
ASA245</a>,
a C++ library which
evaluates the logarithm of the Gamma function.
</p>
<p>
<a href = "../../cpp_src/normal/normal.html">
NORMAL</a>,
a C++ library which
samples the normal distribution.
</p>
<p>
<a href = "../../cpp_src/prob/prob.html">
PROB</a>,
a C++ library which
evaluates the PDF, CDF, mean and variance for a number of probability
density functions.
</p>
<p>
<a href = "../../cpp_src/test_values/test_values.html">
TEST_VALUES</a>,
a C++ library which
contains sample values
for a number of distributions.
</p>
<p>
<a href = "../../cpp_src/toms291/toms291.html">
TOMS291</a>,
a C++ library which
evaluates the logarithm of the Gamma function.
</p>
<p>
<a href = "../../cpp_src/uniform/uniform.html">
UNIFORM</a>,
a C++ library which
samples the uniform distribution.
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
AG Adams,<br>
Algorithm 39:
Areas Under the Normal Curve,<br>
Computer Journal,<br>
Volume 12, Number 2, May 1969, pages 197-198.
</li>
<li>
Joachim Ahrens, Ulrich Dieter,<br>
Computer Methods for Sampling from Gamma, Beta, Poisson and
Binomial Distributions,<br>
Computing,<br>
Volume 12, Number 3, September 1974, pages 223-246.
</li>
<li>
Joachim Ahrens, Ulrich Dieter,<br>
Generating Gamma Variates by a Modified Rejection Technique,<br>
Communications of the ACM,<br>
Volume 25, Number 1, January 1982, pages 47-54.
</li>
<li>
Jerry Banks, editor,<br>
Handbook of Simulation,<br>
Wiley, 1998,<br>
ISBN: 0471134031,<br>
LC: T57.62.H37.
</li>
<li>
JD Beasley, SG Springer,<br>
Algorithm AS 111:
The Percentage Points of the Normal Distribution,<br>
Applied Statistics,<br>
Volume 26, Number 1, 1977, pages 118-121.
</li>
<li>
Jose Bernardo,<br>
Algorithm AS 103:
Psi ( Digamma ) Function,<br>
Applied Statistics,<br>
Volume 25, Number 3, 1976, pages 315-317.
</li>
<li>
Donald Best, DE Roberts,<br>
Algorithm AS 91:
The Percentage Points of the Chi-Squared Distribution,<br>
Applied Statistics,<br>
Volume 24, Number 3, 1975, pages 385-390.
</li>
<li>
G Bhattacharjee,<br>
Algorithm AS 32:
The Incomplete Gamma Integral,<br>
Applied Statistics,<br>
Volume 19, Number 3, 1970, pages 285-287.
</li>
<li>
William Cody, Kenneth Hillstrom,<br>
Chebyshev Approximations for the Natural Logarithm of the
Gamma Function,<br>
Mathematics of Computation,<br>
Volume 21, Number 98, April 1967, pages 198-203.
</li>
<li>
William Cody, Anthony Strecok, Henry Thacher,<br>
Chebyshev Approximations for the Psi Function,<br>
Mathematics of Computation,<br>
Volume 27, Number 121, January 1973, pages 123-127.
</li>
<li>
John Hart, Ward Cheney, Charles Lawson, Hans Maehly,
Charles Mesztenyi, John Rice, Henry Thacher,
Christoph Witzgall,<br>
Computer Approximations,<br>
Wiley, 1968,<br>
LC: QA297.C64.
</li>
<li>
David Hill,
Algorithm AS 66:
The Normal Integral,<br>
Applied Statistics,<br>
Volume 22, Number 3, 1973, pages 424-427.
</li>
<li>
Cornelius Lanczos,<br>
A precision approximation of the gamma function,<br>
SIAM Journal on Numerical Analysis, B,<br>
Volume 1, 1964, pages 86-96.
</li>
<li>
Chi Leung Lau,<br>
Algorithm AS 147:
A Simple Series for the Incomplete Gamma Integral,<br>
Applied Statistics,<br>
Volume 29, Number 1, 1980, pages 113-114.
</li>
<li>
Allan Mcleod,<br>
Algorithm AS 245:
A Robust and Reliable Algorithm for the Logarithm
of the Gamma Function,<br>
Applied Statistics,<br>
Volume 38, Number 2, 1989, pages 397-402.
</li>
<li>
A. Naryanan,<br>
Algorithm AS 266:
Maximum Likelihood Estimation of the Parameters of the
Dirichlet Distribution,<br>
Applied Statistics,<br>
Volume 40, Number 2, 1991, pages 365-374.
</li>
<li>
Malcolm Pike, David Hill,<br>
Algorithm 291:
Logarithm of Gamma Function,<br>
Communications of the ACM,<br>
Volume 9, Number 9, September 1966, page 684.
</li>
<li>
BE Schneider,<br>
Algorithm AS 121:
Trigamma Function,<br>
Applied Statistics,<br>
Volume 27, Number 1, 1978, pages 97-99.
</li>
<li>
BL Shea,<br>
Algorithm AS 239:
Chi-squared and Incomplete Gamma Integral,<br>
Applied Statistics,<br>
Volume 37, Number 3, 1988, pages 466-473.
</li>
<li>
Michael Wichura,<br>
Algorithm AS 241:
The Percentage Points of the Normal Distribution,<br>
Applied Statistics,<br>
Volume 37, Number 3, 1988, pages 477-484.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "asa266.cpp">asa266.cpp</a>, the source code.
</li>
<li>
<a href = "asa266.hpp">asa266.hpp</a>, the include file.
</li>
<li>
<a href = "asa266.sh">asa266.sh</a>,
BASH commands to compile the source code.
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "asa266_prb.cpp">asa266_prb.cpp</a>
a sample calling program.
</li>
<li>
<a href = "asa266_prb.sh">asa266_prb.sh</a>,
BASH commands to compile and run the sample program.
</li>
<li>
<a href = "asa266_prb_output.txt">asa266_prb_output.txt</a>,
the output file.
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>ALNGAM</b> computes the logarithm of the gamma function.
</li>
<li>
<b>ALNORM</b> computes the cumulative density of the standard normal distribution.
</li>
<li>
<b>ALOGAM</b> computes the logarithm of the Gamma function.
</li>
<li>
<b>DIGAMMA</b> calculates DIGAMMA ( X ) = d ( LOG ( GAMMA ( X ) ) ) / dX
</li>
<li>
<b>DIRICHLET_CHECK</b> checks the parameters of the Dirichlet PDF.
</li>
<li>
<b>DIRICHLET_VARIANCE</b> returns the variances of the Dirichlet PDF.
</li>
<li>
<b>EXPONENTIAL_01_SAMPLE</b> samples the Exponential PDF with parameters 0, 1.
</li>
<li>
<b>EXPONENTIAL_CDF_INV</b> inverts the Exponential CDF.
</li>
<li>
<b>GAMAIN</b> computes the incomplete gamma ratio.
</li>
<li>
<b>GAMMAD</b> computes the Incomplete Gamma Integral
</li>
<li>
<b>GAMMDS</b> computes the incomplete Gamma integral.
</li>
<li>
<b>LNGAMMA</b> computes Log(Gamma(X)) using a Lanczos approximation.
</li>
<li>
<b>NORMP</b> computes the cumulative density of the standard normal distribution.
</li>
<li>
<b>NPROB</b> computes the cumulative density of the standard normal distribution.
</li>
<li>
<b>PPCHI2</b> evaluates the percentage points of the Chi-squared PDF.
</li>
<li>
<b>PPND</b> produces the normal deviate value corresponding to lower tail area = P.
</li>
<li>
<b>PPND16</b> inverts the standard normal CDF.
</li>
<li>
<b>R8_ABS</b> returns the absolute value of an R8.
</li>
<li>
<b>R8_EPSILON</b> returns the R8 round off unit.
</li>
<li>
<b>R8_GAMMA_LOG</b> evaluates the logarithm of the gamma function.
</li>
<li>
<b>R8_HUGE</b> returns a "huge" R8.
</li>
<li>
<b>R8_MIN</b> returns the minimum of two R8's.
</li>
<li>
<b>R8_UNIFORM</b> returns a pseudorandom R8 scaled to [A,B].
</li>
<li>
<b>R8COL_MEAN</b> returns the column means of an R8COL.
</li>
<li>
<b>R8COL_VARIANCE</b> returns the variances of an R8COL.
</li>
<li>
<b>R8POLY_VALUE</b> evaluates a polynomial.
</li>
<li>
<b>R8VEC_SUM</b> returns the sum of an R8VEC.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
<li>
<b>TRIGAMMA</b> calculates trigamma(x) = d^2 log(gamma(x)) / dx^2
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../cpp_src.html">
the C++ source codes</a>.
</p>
<hr>
<i>
Last revised on 05 June 2013.
</i>
<!-- John Burkardt -->
</body>
<!-- Initial HTML skeleton created by HTMLINDEX. -->
</html>