root/tolp/trunk/tol/stdlib/math/stat/models/bayesian/bysMcmc/_structs.tol @ 600

Revision 600, 11.7 kB (checked in by vdebuen, 9 years ago)

Bsr.TruncatedNormal

  • Property svn:eol-style set to native
Line 
1/////////////////////////////////////////////////////////////////////////////
2// LIBRARY: StdtLib (Standard Library of TOL)
3// FILE: structs.tol
4// PURPOSE: Structures needed to handle with Stat::Bys
5/////////////////////////////////////////////////////////////////////////////
6
7
8/////////////////////////////////////////////////////////////////////////////
9//Configuration of Bayesian Inference report
10/////////////////////////////////////////////////////////////////////////////
11Struct BysInf.Report.Config
12{
13//parameters for method RCODA::raftery.diag(...)
14  Real raftery.diag.q_,   //the quantile to be estimated
15  Real raftery.diag.r_,   //the margin of error
16  Real raftery.diag.s_,   //the probability for interval (q-r,q+r)
17  Real raftery.diag.eps_, //precision required for estimate of convergence
18//Autocorrelation function parameters                                 
19  Real acf.lag_,
20//histogram parameters                                 
21  Real histogram.parts_,
22//kerDens parameters                                 
23  Real kerDens.points_
24};
25
26
27/////////////////////////////////////////////////////////////////////////////
28//Returned Bayesian Inference statistics
29/////////////////////////////////////////////////////////////////////////////
30Struct BysInf.Coda.Summary.Stats
31{
32  Text varName_,  //Parameter identifier
33  Real mean_,     //Sample average
34  Real sd_,       //Sample standar deviation
35  Real naive.se_, //Naive estimator of standard error of sample mean
36  Real tmser.se_, //Standard error of sample mean filtered of autocorrelation
37  Real q.001_,    //   1/1000 sample quantile
38  Real q.025_,    //  25/1000 sample quantile
39  Real q.250_,    // 250/1000 sample quantile
40  Real q.500_,    // 500/1000 sample quantile (median)
41  Real q.750_,    // 750/1000 sample quantile
42  Real q.975_,    // 975/1000 sample quantile
43  Real q.999_     // 999/1000 sample quantile
44}; 
45
46/////////////////////////////////////////////////////////////////////////////
47//Returned test of significance of parameters
48/////////////////////////////////////////////////////////////////////////////
49Struct BysInf.Param.Signif
50{
51  //Parameter identifier
52  Text varName_,   
53  //p-value for two-tailed test (null hypothesis - median is equal to 0)
54  Real pValue.isZero_, 
55  //p-value for left-tailed test (null hypothesis - median is positive)
56  Real pValue.isPos_, 
57  //p-value for right-tailed test (null hypothesis - median is negative)
58  Real pValue.isNeg_
59}; 
60
61
62/////////////////////////////////////////////////////////////////////////////
63//Bayesian Diagnostics with method RCODA::raftery.diag
64/////////////////////////////////////////////////////////////////////////////
65Struct BysInf.Coda.Diag.Raftery
66{
67  Text   varName_,     //Parameter identifier
68  Real   length_,      //L The number of calculated simulations
69  Real   burnin_,      //M the length of burn-in
70  Real   size_,        //N the required sample size
71  Real   size.min_,    //Nmin the minimum sample size based on zero acf
72  Real   dep.factor_,  //I = (M+N)/Nmin: the dependence factor
73  Real   remain_       //1-Max(0,Min(1,(L-M)/(N-M))): the complementary ratio 
74                       //of avalaible and required lengths after skiping
75                       //burn-in
76};
77
78/////////////////////////////////////////////////////////////////////////////
79//Comparing Coda.Diag.Raftery information about two reports
80/////////////////////////////////////////////////////////////////////////////
81Struct StRepCmp.Coda.Diag.Raftery
82{ 
83  Text varName_, 
84  Real rep1.length, 
85  Real rep2.length,
86  Real rep1.burnin, 
87  Real rep2.burnin,
88  Real rep1.size, 
89  Real rep2.size,
90  Real rep1.size.min, 
91  Real rep2.size.min,
92  Real rep1.dep.factor, 
93  Real rep2.dep.factor,
94  Real rep1.remain, 
95  Real rep2.remain
96};
97
98/////////////////////////////////////////////////////////////////////////////
99//Comparing Coda.Summary.Stats information about two reports
100/////////////////////////////////////////////////////////////////////////////
101Struct StRepCmp.Coda.Summary.Stats
102{ 
103  Text varName_,                    //Variable name
104  Real diff_,                       //difference between averages a1-a2
105  Real diff.rel_,                   //relative difference |a1-a2|/|a1|
106  Real diff.K.sigmas.tmser_,        //standarized difference |a1-a2|/(ts1)
107  Real mannWhitneyUtest.bothtails_, //pvalue of two tails Mann-Whitney U test
108  Real mannWhitneyUtest.lefttail_,  //pvalue of left tail Mann-Whitney U test
109  Real mannWhitneyUtest.righttail_, //pvalue of right tail Mann-Whitney U test
110  Real rep1.mean_,       //a1: average for 1-st report 
111  Real rep2.mean_,       //a2: average for 2-nd report   
112  Real rep1.sd_,         //s1: standard error for 1-st report
113  Real rep2.sd_,         //s2: standard error for 2-st report
114  Real rep1.naive.se_,   //ns1=s1/Sqrt(N1) sampling deviation of average
115  Real rep2.naive.se_,   //ns2=s2/Sqrt(N2) sampling deviation of average
116  Real rep1.tmser.se_,   //ts1=s1*(1-r1)/((1+r1)*Sqrt(N1)) uncorrelated smp.dev.
117  Real rep2.tmser.se_,   //ts2=s2*(1-r2)/((1+r2)*Sqrt(N2)) uncorrelated smp.dev.
118  Real rep1.q.001_,      //Quantile 0.001 for 1-st report 
119  Real rep2.q.001_,      //Quantile 0.001 for 2-st report
120  Real rep1.q.025_,     
121  Real rep2.q.025_,
122  Real rep1.q.250_,
123  Real rep2.q.250_,
124  Real rep1.q.500_,
125  Real rep2.q.500_,
126  Real rep1.q.750_,
127  Real rep2.q.750_,
128  Real rep1.q.975_,
129  Real rep2.q.975_,
130  Real rep1.q.999_,
131  Real rep2.q.999_
132};
133
134
135/////////////////////////////////////////////////////////////////////////////
136//Comparing ACF information about two reports
137/////////////////////////////////////////////////////////////////////////////
138Struct StRepCmp.AcfByVar
139{ 
140  Real lag, 
141  Real rep1.acf, 
142  Real rep2.acf, 
143  Real sigma.1, 
144  Real sigma.2, 
145  Real sigma.3, 
146  Real sigma_1, 
147  Real sigma_2, 
148  Real sigma_3 
149};
150
151/////////////////////////////////////////////////////////////////////////////
152//Comparing ACF information about two reports
153/////////////////////////////////////////////////////////////////////////////
154Struct StRepCmp.Acf
155{ 
156  Text varName_, 
157  Real lag, 
158  Real rep1.acf, 
159  Real rep2.acf, 
160  Real sigma.1, 
161  Real sigma.2, 
162  Real sigma.3, 
163  Real sigma_1, 
164  Real sigma_2, 
165  Real sigma_3
166};
167
168/////////////////////////////////////////////////////////////////////////////
169//Structure for ARMA param handling
170/////////////////////////////////////////////////////////////////////////////
171Struct ArmaParamDescStruct
172(
173  Text name,
174  Real resBlockNum,
175  Real factorNum,
176  Text arma,
177  Real degree,
178  Real coef,
179  Real numEvalDens
180);
181
182/////////////////////////////////////////////////////////////////////////////
183//Parameter information in a BSR model definition
184/////////////////////////////////////////////////////////////////////////////
185Struct Bsr.Param.Info
186{
187  Text Name,              // Unique identidier of the parameter
188  Real InitValue,         // Given by user initial value or ?
189  Real Prior.LowerBound,  // Prior minimum feasible value or -1/0
190  Real Prior.UpperBound   // Prior minimum feasible value or +1/0
191}; 
192
193/////////////////////////////////////////////////////////////////////////////
194//Truncated normal info
195/////////////////////////////////////////////////////////////////////////////
196Struct Bsr.TruncatedNormal
197{
198  Text Name,              // Unique identidier of the parameter
199  Real Nu,
200  Real Sigma,
201  Real LowerBound,
202  Real UpperBound
203};
204
205/////////////////////////////////////////////////////////////////////////////
206//Parameter information about linear parameters for simplified API used in
207//BysMcmc::Bsr::Gibbs::EstimOneNode
208/////////////////////////////////////////////////////////////////////////////
209Struct Bsr.OneNode.LinearParamInfo
210{
211  Text Name,              // Unique identidier of the parameter
212  Real InitValue,         // Given by user initial value or ?
213  Real Prior.LowerBound,  // Prior minimum feasible value or -1/0
214  Real Prior.UpperBound,  // Prior minimum feasible value or +1/0
215  Real Prior.Average,
216  Real Prior.Sigma,
217  Real Prior.SigmaWeight,
218  Real Prior.Missing.SigmaFactor, 
219  Real Prior.Missing.LowerBound, 
220  Real Prior.Missing.UpperBound
221};
222
223/////////////////////////////////////////////////////////////////////////////
224//Sigma Inverse-Gamma prior information in a BSR model
225//Described in Bayesian Data Analisys (Gelman-Carlin-Stern-Rubin) Second
226//Edition, section 14.8, subsection "Prior information about variance
227//parameters"  page 384
228/////////////////////////////////////////////////////////////////////////////
229Struct Bsr.Sigma.Prior.InverseGamma
230{
231  Real Sigma2, // Residuals square average: sigma0^2
232  Real Weight  // Relative weight of prior versus data : n0/(n0+n) 
233}; 
234
235/////////////////////////////////////////////////////////////////////////////
236//Missing value with optional normal prior information in a BSR model
237/////////////////////////////////////////////////////////////////////////////
238Struct Bsr.Missing.Info
239{
240  Text Name,              // Unique identidier of the missing value
241  Real Prior.Average,     // Prior average or initial value
242  Real Prior.Sigma,       // Prior standard deviation or +1/0
243  Real Prior.LowerBound,  // Prior minimum feasible value or -1/0
244  Real Prior.UpperBound   // Prior minimum feasible value or +1/0
245}; 
246
247/////////////////////////////////////////////////////////////////////////////
248//Order restriction over parameters in a BSR model
249// Lower <= Upper
250/////////////////////////////////////////////////////////////////////////////
251Struct Bsr.OrderRelation.Info
252{
253  Text Lower, //Left parameter
254  Text Upper  //Right parameter
255}; 
256
257/////////////////////////////////////////////////////////////////////////////
258//Linear combination term over a parameter of a BSR model
259// Coefficient * Parameter
260/////////////////////////////////////////////////////////////////////////////
261Struct Bsr.LinearCombTerm
262{
263  Real Coefficient, 
264  Text Parameter
265}; 
266
267/////////////////////////////////////////////////////////////////////////////
268//Generic restriction over parameters in a BSR model
269// LowerBound <= c_1 * alfa_1 + ... + c_n * alfa_n <= UpperBound
270/////////////////////////////////////////////////////////////////////////////
271Struct Bsr.GenericConstraint.Info
272{
273  Real LowerBound, //Left border value or -1/0
274  Set  LinearComb, //A set of Bsr.LinearCombTerm
275  Real UpperBound  //Right border value or +1/0
276}; 
277
278Struct Bsr.DynHlm.DBNode
279{
280  Text NodeType,
281  Text Node
282};
283
284Struct Bsr.DynHlm.DBStrConstrBorder
285{
286  Real LowerBound, //Left border value or -1/0
287  Real NumInequation,
288  Real UpperBound  //Right border value or +1/0
289};
290
291Struct Bsr.DynHlm.DBStrObsOutput
292{
293  Text id_series, 
294  Real missingPriorSigmaFactor, 
295  Real missingPriorLowerBound, 
296  Real missingPriorUpperBound, 
297  Date firstDate, 
298  Date lastDate,
299  Real sigma,
300  Real sigmaPriorWeight
301};
302
303Struct Bsr.DynHlm.DBStrObsInput
304{
305  Text id_parameter, 
306  Text id_series, 
307  Real missingPriorSigmaFactor, 
308  Real missingPriorLowerBound, 
309  Real missingPriorUpperBound, 
310  Real paramInitValue, 
311  Real paramPriorLowerBound, 
312  Real paramPriorUpperBound
313};
314Struct Bsr.DynHlm.DBStrObsTransFun
315{
316  Text id_transferFunction, 
317  Text te_omega,
318  Text te_delta,
319  Text id_series, 
320  Real missingPriorSigmaFactor, 
321  Real missingPriorLowerBound, 
322  Real missingPriorUpperBound, 
323  Real paramInitValue, 
324  Real paramPriorLowerBound, 
325  Real paramPriorUpperBound
326};
327Struct Bsr.DynHlm.DBStrARIMA
328{
329  Real period,
330  Text AR, 
331  Text MA, 
332  Text DIF
333} ;   
334Struct Bsr.DynHlm.DBStrLatEqu
335{
336  Real nu_equation, 
337  Real sigma_factor
338};
339Struct Bsr.DynHlm.DBStrLatOutput
340{
341  Real nu_equation, 
342  Text child, 
343  Real coef
344};
345Struct Bsr.DynHlm.DBStrLatInput
346{
347  Real nu_equation, 
348  Text father, 
349  Real coef
350};
351Struct Bsr.DynHlm.DBStrPriEqu
352{
353  Real nu_equation, 
354  Real average, 
355  Real sigma , 
356  Real sigmaPriorWeight
357};
358Struct Bsr.DynHlm.DBStrPriOutput
359{
360  Real nu_equation, 
361  Text child, 
362  Real coef
363};
364Struct Bsr.DynHlm.DBStrNonLinFlt
365{
366  Text node,
367  Text nameBlock
368};
369
Note: See TracBrowser for help on using the browser.