forked from johannesgerer/jburkardt-f
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bdmlib.html
317 lines (291 loc) · 8.85 KB
/
bdmlib.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
<html>
<head>
<title>
BDMLIB - Estimate Dirichlet Mixture Weights
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
BDMLIB <br> Estimate Dirichlet Mixture Weights
</h1>
<hr>
<p>
<b>BDMLIB</b>
is a FORTRAN90 library which
estimates the weights
W in a Dirichlet mixture PDF (probability density function)
by analyzing events that were generated by the mixture.
</p>
<p>
To generate "events", first one of the component Dirichlet PDF's
is chosen based on the weights W. Then the Dirichlet PDF, whose
parameters ALPHA are known, is used to generate a probability
vector P. This probability vector is then used with the multinomial
PDF to generate an integer vector X, which is the result.
</p>
<p>
Now, we assume that we are watching this process, and have no
knowledge of the weights W. Simply by observing the result vectors
X, we will try to estimate the values of the W's.
A pseudo-Bayesian process is used to do this.
</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">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/asa266/asa266.html">
ASA266</a>,
a FORTRAN90 library which
evaluates various properties of a Dirichlet distribution.
</p>
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Joachim Ahrens, Ulrich Dieter,<br>
Computer Methods for Sampling From the
Exponential and Normal Distributions,<br>
Communications of the ACM,<br>
Volume 15, Number 10, October 1972, pages 873-882.
</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>
Joachim Ahrens, Klaus-Dieter Kohrt, Ulrich Dieter,<br>
Algorithm 599:
Sampling from Gamma and Poisson Distributions,<br>
ACM Transactions on Mathematical Software,<br>
Volume 9, Number 2, June 1983, pages 255-257.
</li>
<li>
Jerry Banks, editor,<br>
Handbook of Simulation,<br>
Wiley, 1998,<br>
ISBN: 0471134031,<br>
LC: T57.62.H37.
</li>
<li>
Carl Branden, John Tooze,<br>
Introduction to Protein Structure,<br>
Second Edition,<br>
Garland Publishing, 1999,<br>
ISBN: 0815323050,<br>
LC: QP551.B7635.
</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>
Luc Devroye,<br>
Non-Uniform Random Variate Generation,<br>
Springer, 1986,<br>
ISBN: 0387963057,<br>
LC: QA274.D48.
</li>
<li>
Brian Everitt, David Hand,<br>
Finite Mixture Distributions,<br>
Chapman and Hall, 1981.
</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>
William Kennedy, James Gentle,<br>
Statistical Computing,<br>
Marcel Dekker, 1980,<br>
ISBN: 0824768981,<br>
LC: QA276.4.K46.
</li>
<li>
Kenneth Lange,<br>
Mathematical and Statistical Methods for Genetic Analysis,<br>
Springer, 1997,<br>
ISBN: 0387953892,<br>
LC: QH438.4.M33.L36.
</li>
<li>
AFM Smith, Udi Makov,<br>
A Quasi-Bayes Sequential Procedure for Mixtures,<br>
Journal of the Royal Statistical Society,<br>
Volume 40, Number 1, B, 1978, pages 106-112.
</li>
</ol>
</p>
<h3 align = "center">
Source Code:
</h3>
<p>
<ul>
<li>
<a href = "bdmlib.f90">bdmlib.f90</a>, the source code;
</li>
<li>
<a href = "bdmlib.sh">bdmlib.sh</a>,
commands to compile the source code;
</li>
</ul>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<ul>
<li>
<a href = "bdmlib_prb.f90">bdmlib_prb.f90</a>,
a sample program;
</li>
<li>
<a href = "bdmlib_prb.sh">bdmlib_prb.sh</a>,
commands to compile, link and run the sample program;
</li>
<li>
<a href = "mixture.txt">mixture.txt</a>, data defining the mixture;
</li>
<li>
<a href = "bdmlib_prb_output.txt">bdmlib_prb_output.txt</a>,
the output file;
</li>
</ul>
</p>
<h3 align = "center">
List of Routines:
</h3>
<p>
<ul>
<li>
<b>AMINO_PRINT</b> prints the amino acid parameters.
</li>
<li>
<b>BINOMIAL_SAMPLE</b> samples the Binomial PDF.
</li>
<li>
<b>CH_CAP</b> capitalizes a single character.
</li>
<li>
<b>CH_EQI</b> is a case insensitive comparison of two characters for equality.
</li>
<li>
<b>CH_NEXT</b> "reads" space-separated characters from a string, one at a time.
</li>
<li>
<b>CH_TO_AMINO_NAME</b> converts a character to an amino acid name.
</li>
<li>
<b>CH_TO_DIGIT</b> returns the integer value of a base 10 digit.
</li>
<li>
<b>COMP_PARAM_PRINT</b> prints the parameters for the mixture components.
</li>
<li>
<b>DIRICHLET_MEAN</b> returns the means of the Dirichlet PDF.
</li>
<li>
<b>DIRICHLET_MIX_CHECK</b> checks the parameters of a Dirichlet mixture PDF.
</li>
<li>
<b>DIRICHLET_MULTINOMIAL_PDF</b> evaluates a Dirichlet Multinomial PDF.
</li>
<li>
<b>DIRICHLET_SAMPLE</b> samples the Dirichlet PDF.
</li>
<li>
<b>DISCRETE_CDF_INV</b> inverts the Discrete CDF.
</li>
<li>
<b>DISCRETE_SAMPLE</b> samples the Discrete PDF.
</li>
<li>
<b>EVENT_PROCESS</b> updates the mixture weight distribution parameters.
</li>
<li>
<b>EXPONENTIAL_01_CDF_INV</b> inverts the Exponential 01 CDF.
</li>
<li>
<b>EXPONENTIAL_01_SAMPLE</b> samples the Exponential PDF with parameter 1.
</li>
<li>
<b>EXPONENTIAL_CDF_INV</b> inverts the Exponential CDF.
</li>
<li>
<b>EXPONENTIAL_SAMPLE</b> samples the Exponential PDF.
</li>
<li>
<b>GAMMA_LOG</b> calculates the natural logarithm of GAMMA ( X ) for positive X.
</li>
<li>
<b>GAMMA_SAMPLE</b> samples the Gamma PDF.
</li>
<li>
<b>I4_NEXT</b> "reads" integers from a string, one at a time.
</li>
<li>
<b>MIXTURE_READ</b> reads the Dirichlet mixture parameters from a file.
</li>
<li>
<b>MULTINOMIAL_SAMPLE</b> samples the Multinomial PDF.
</li>
<li>
<b>NORMAL_01_SAMPLE</b> samples the Normal 01 PDF.
</li>
<li>
<b>R4_NEXT</b> "reads" real numbers from a string, one at a time.
</li>
<li>
<b>R4_RANDOM</b> returns a random real in a given range.
</li>
<li>
<b>R4VEC_PRINT</b> prints a real vector, with an optional title.
</li>
<li>
<b>R4VEC_UNIT_SUM</b> normalizes a real vector to have unit sum.
</li>
<li>
<b>S_BEGIN</b> is TRUE if one string matches the beginning of the other.
</li>
<li>
<b>S_TO_I4</b> reads an integer value from a string.
</li>
<li>
<b>S_TO_R4</b> reads a real number from a string.
</li>
<li>
<b>TIMESTAMP</b> prints the current YMDHMS date as a time stamp.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../f_src.html">
the FORTRAN90 source codes</a>.
</p>
<hr>
<i>
Last revised on 19 December 2008.
</i>
<!-- John Burkardt -->
</body>
</html>