forked from johannesgerer/jburkardt-m
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asa266.html
569 lines (527 loc) · 16.9 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
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
<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 MATLAB 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">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</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 = "../../m_src/asa032/asa032.html">
ASA032</a>,
a MATLAB library which
evaluates the incomplete Gamma integral.
</p>
<p>
<a href = "../../m_src/asa066/asa066.html">
ASA066</a>,
a MATLAB library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../m_src/asa091/asa091.html">
ASA091</a>,
a MATLAB library which
evaluates the percentage points of the Chi-Squared distribution.
</p>
<p>
<a href = "../../m_src/asa103/asa103.html">
ASA103</a>,
a MATLAB library which
evaluates the digamma or psi function.
</p>
<p>
<a href = "../../m_src/asa111/asa111.html">
ASA111</a>,
a MATLAB library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../m_src/asa121/asa121.html">
ASA121</a>,
a MATLAB library which
evaluates the trigamma function.
</p>
<p>
<a href = "../../m_src/asa147/asa147.html">
ASA147</a>,
a MATLAB library which
evaluates the incomplete Gamma function.
</p>
<p>
<a href = "../../m_src/asa239/asa239.html">
ASA239</a>,
a MATLAB library which
evaluates the percentage points of the Chi-Squared distribution
and the incomplete Gamma function.
</p>
<p>
<a href = "../../m_src/asa241/asa241.html">
ASA241</a>,
a MATLAB library which
evaluates the percentage points of the normal distribution.
</p>
<p>
<a href = "../../m_src/asa245/asa245.html">
ASA245</a>,
a MATLAB library which
evaluates the logarithm of the Gamma function.
</p>
<p>
<a href = "../../m_src/normal/normal.html">
NORMAL</a>,
a MATLAB library which
samples the normal distribution.
</p>
<p>
<a href = "../../m_src/prob/prob.html">
PROB</a>,
a MATLAB library which
evaluates the PDF, CDF, mean and variance for a number of probability
density functions.
</p>
<p>
<a href = "../../m_src/test_values/test_values.html">
TEST_VALUES</a>,
a MATLAB library which
contains sample values
for a number of distributions.
</p>
<p>
<a href = "../../m_src/toms291/toms291.html">
TOMS291</a>,
a MATLAB library which
evaluates the logarithm of the Gamma function.
</p>
<p>
<a href = "../../m_src/uniform/uniform.html">
UNIFORM</a>,
a MATLAB 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 = "alngam.m">alngam.m</a>,
computes the logarithm of the gamma function;
</li>
<li>
<a href = "alnorm.m">alnorm.m</a>,
computes the cumulative density of the standard normal distribution.;
</li>
<li>
<a href = "alogam.m">alogam.m</a>,
computes the logarithm of the Gamma function;
</li>
<li>
<a href = "digamma.m">digamma.m</a>,
calculates DIGAMMA ( X ) = d ( LOG ( GAMMA ( X ) ) ) / dX;
</li>
<li>
<a href = "dirichlet_check.m">dirichlet_check.m</a>,
checks the parameters of the Dirichlet PDF;
</li>
<li>
<a href = "dirichlet_estimate.m">dirichlet.m</a>,
estimates the parameters of a Dirichlet distribution;
</li>
<li>
<a href = "dirichlet_mean.m">dirichlet_mean.m</a>,
returns the means of the Dirichlet PDF;
</li>
<li>
<a href = "dirichlet_mix_mean.m">dirichlet_mix_mean.m</a>,
returns the means of a Dirichlet mixture PDF;
</li>
<li>
<a href = "dirichlet_mix_sample.m">dirichlet_mix_sample.m</a>,
samples a Dirichlet mixture PDF;
</li>
<li>
<a href = "dirichlet_sample.m">dirichlet_sample.m</a>,
samples the Dirichlet PDF;
</li>
<li>
<a href = "dirichlet_variance.m">dirichlet_variance.m</a>,
returns the variances of the Dirichlet PDF;
</li>
<li>
<a href = "exponential_01_sample.m">exponential_01_sample.m</a>,
samples the Exponential PDF with parameter 1;
</li>
<li>
<a href = "exponential_cdf_inv.m">exponential_cdf_inv.m</a>,
inverts the Exponential CDF;
</li>
<li>
<a href = "gamain.m">gamain.m</a>,
computes the incomplete gamma ratio;
</li>
<li>
<a href = "gamma_sample.m">gamma_sample.m</a>,
samples the gamma PDF;
</li>
<li>
<a href = "gammad.m">gammad.m</a>,
computes the Incomplete Gamma Integral;
</li>
<li>
<a href = "gammds.m">gammds.m</a>,
computes the incomplete Gamma integral;
</li>
<li>
<a href = "lngamma.m">lngamma.m</a>,
computes Log(Gamma(X)) using a Lanczos approximation;
</li>
<li>
<a href = "normal_01_sample.m">normal_01_sample.m</a>,
samples the standard normal PDF;
</li>
<li>
<a href = "normp.m">normp.m</a>,
computes the CDF of the standard normal distribution;
</li>
<li>
<a href = "nprob.m">nprob.m</a>,
computes the CDF of the standard normal distribution;
</li>
<li>
<a href = "ppchi2.m">ppchi2.m</a>,
evaluates the percentage points of the Chi-squared PDF;
</li>
<li>
<a href = "ppnd.m">ppnd.m</a>,
produces the normal deviate value corresponding to lower tail area = P;
</li>
<li>
<a href = "r4_normal_01_cdf_inverse.m">r4_normal_01_cdf_inverse.m</a>,
inverts the standard normal CDF;
</li>
<li>
<a href = "r4poly_val_horner.m">r4poly_val_horner.m</a>,
evaluates a polynomial in standard form.;
</li>
<li>
<a href = "r8_gamma_log.m">r8_gamma_log.m</a>,
calculates Log(Gamma(X));
</li>
<li>
<a href = "r8_normal_01.m">r8_normal_01.m</a>,
returns a unit pseudonormal R8;
</li>
<li>
<a href = "r8_normal_01_cdf_inverse.m">r8_normal_01_cdf_inverse.m</a>,
inverts the standard normal CDF;
</li>
<li>
<a href = "r8_psi.m">r8_psi.m</a>,
evaluates the function Psi(X);
</li>
<li>
<a href = "r8_uniform_01.m">r8_uniform_01.m</a>,
returns a unit pseudorandom R8;
</li>
<li>
<a href = "r8col_mean.m">r8col_mean.m</a>,
returns the column means of an R8COL;
</li>
<li>
<a href = "r8col_variance.m">r8col_variance.m</a>,
returns the column variances of an R8COL;
</li>
<li>
<a href = "r8poly_val_horner.m">r8poly_val_horner.m</a>,
evaluates a polynomial in standard form.;
</li>
<li>
<a href = "r8vec_unit_sum.m">r8vec_unit_sum.m</a>,
normalizes an R8VEC to have unit norm;
</li>
<li>
<a href = "timestamp.m">timestamp.m</a>,
returns the current YMDHMS date as a timestamp;
</li>
<li>
<a href = "trigamma.m">trigamma.m</a>,
calculates trigamma(x) = d**2 log(gamma(x)) / dx**2;
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "asa266_test.m">asa266_test.m</a>,
calls all the tests.
</li>
<li>
<a href = "asa266_test_output.txt">asa266_test_output.txt</a>,
the output file.
</li>
<li>
<a href = "asa266_test01.m">asa266_test01.m</a>,
tests ALNORM, NORMP, NPROB.
</li>
<li>
<a href = "asa266_test02.m">asa266_test02.m</a>,
tests PPND, R4_NORMAL_01_CDF_INVERSE, R8_NORMAL_01_CDF_INVERSE.
</li>
<li>
<a href = "asa266_test03.m">asa266_test03.m</a>,
tests DIGAMMA, R8_PSI.
</li>
<li>
<a href = "asa266_test04.m">asa266_test04.m</a>,
tests TRIGAMMA.
</li>
<li>
<a href = "asa266_test05.m">asa266_test05.m</a>,
tests ALNGAM, ALOGAM, R8_GAMMA_LOG, LNGAMMA;
</li>
<li>
<a href = "asa266_test06.m">asa266_test06.m</a>,
tests GAMAIN, GAMMDS, GAMMAD.
</li>
<li>
<a href = "asa266_test07.m">asa266_test07.m</a>,
tests PPCHI2.
</li>
<li>
<a href = "asa266_test08.m">asa266_test08.m</a>,
tests DIRICHLET_ESTIMATE, DIRICHLET_MEAN, DIRICHLET_VARIANCE.
</li>
<li>
<a href = "asa266_test09.m">asa266_test09.m</a>,
tests DIRICHLET_ESTIMATE, DIRICHLET_MEAN, DIRICHLET_VARIANCE, DIRICHLET_SAMPLE.
</li>
<li>
<a href = "asa266_test10.m">asa266_test10.m</a>,
tests DIRICHLET_MIX_SAMPLE, DIRICHLET_MIX_MEAN, DIRICHLET_MIX_VARIANCE.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../m_src.html">
the MATLAB source codes</a>.
</p>
<hr>
<i>
Last revised on 04 August 2010.
</i>
<!-- John Burkardt -->
</body>
</html>