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
#include <RcppDist.h>

using namespace Rcpp;

// FOUR PARAMETER BETA DISTRIBUTION

// [[Rcpp::export]]
List test_d4beta(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = d4beta(x, shape1, shape2, a, b, true),
        _["VectorNoLog"] = d4beta(x, shape1, shape2, a, b),
        _["DoubleLog"] = d_4beta(x[0], shape1, shape2, a, b, 1),
        _["DoubleNoLog"] = d_4beta(x[0], shape1, shape2, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_p4beta(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = p4beta(x, shape1, shape2, a, b, true, true),
        _["VectorNoLog"] = p4beta(x, shape1, shape2, a, b),
        _["DoubleLog"] = p_4beta(x[0], shape1, shape2, a, b, 1, 1),
        _["DoubleNoLog"] = p_4beta(x[0], shape1, shape2, a, b),
        _["VectorLogNoLower"] = p4beta(x, shape1, shape2, a, b, false, true),
        _["VectorNoLogNoLower"] = p4beta(x, shape1, shape2, a, b, false),
        _["DoubleLogNoLower"] = p_4beta(x[0], shape1, shape2, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_4beta(x[0], shape1, shape2, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_q4beta_nolog(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = q4beta(x, shape1, shape2, a, b),
        _["DoubleNoLog"] = q_4beta(x[0], shape1, shape2, a, b),
        _["VectorNoLogNoLower"] = q4beta(x, shape1, shape2, a, b, false),
        _["DoubleNoLogNoLower"] = q_4beta(x[0], shape1, shape2, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_q4beta_log(NumericVector x, double shape1, double shape2,
        double a, double b) {
    return List::create(
        _["VectorLog"] = q4beta(x, shape1, shape2, a, b, true, true),
        _["DoubleLog"] = q_4beta(x[0], shape1, shape2, a, b, 1, 1),
        _["VectorLogNoLower"] = q4beta(x, shape1, shape2, a, b, false, true),
        _["DoubleLogNoLower"] = q_4beta(x[0], shape1, shape2, a, b, 0, 1)
    );
} // nocov



// LOCATION-SCALE T DISTRIBUTION

// [[Rcpp::export]]
List test_dlst(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = dlst(x, df, mu, sigma, true),
        _["VectorNoLog"] = dlst(x, df, mu, sigma),
        _["DoubleLog"] = d_lst(x[0], df, mu, sigma, 1),
        _["DoubleNoLog"] = d_lst(x[0], df, mu, sigma)
    );
} // nocov

// [[Rcpp::export]]
List test_plst(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = plst(x, df, mu, sigma, true, true),
        _["VectorNoLog"] = plst(x, df, mu, sigma),
        _["DoubleLog"] = p_lst(x[0], df, mu, sigma, 1, 1),
        _["DoubleNoLog"] = p_lst(x[0], df, mu, sigma),
        _["VectorLogNoLower"] = plst(x, df, mu, sigma, false, true),
        _["VectorNoLogNoLower"] = plst(x, df, mu, sigma, false),
        _["DoubleLogNoLower"] = p_lst(x[0], df, mu, sigma, 0, 1),
        _["DoubleNoLogNoLower"] = p_lst(x[0], df, mu, sigma, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qlst_nolog(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorNoLog"] = qlst(x, df, mu, sigma),
        _["DoubleNoLog"] = q_lst(x[0], df, mu, sigma),
        _["VectorNoLogNoLower"] = qlst(x, df, mu, sigma, false),
        _["DoubleNoLogNoLower"] = q_lst(x[0], df, mu, sigma, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qlst_log(NumericVector x, double df, double mu, double sigma) {
    return List::create(
        _["VectorLog"] = qlst(x, df, mu, sigma, true, true),
        _["DoubleLog"] = q_lst(x[0], df, mu, sigma, 1, 1),
        _["VectorLogNoLower"] = qlst(x, df, mu, sigma, false, true),
        _["DoubleLogNoLower"] = q_lst(x[0], df, mu, sigma, 0, 1)
    );
} // nocov



// TRUNCATED NORMAL DISTRIBUTION

// [[Rcpp::export]]
List test_dtruncnorm(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = dtruncnorm(x, mu, sigma, a, b, true),
        _["VectorNoLog"] = dtruncnorm(x, mu, sigma, a, b),
        _["DoubleLog"] = d_truncnorm(x[0], mu, sigma, a, b, 1),
        _["DoubleNoLog"] = d_truncnorm(x[0], mu, sigma, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptruncnorm(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = ptruncnorm(x, mu, sigma, a, b, true, true),
        _["VectorNoLog"] = ptruncnorm(x, mu, sigma, a, b),
        _["DoubleLog"] = p_truncnorm(x[0], mu, sigma, a, b, 1, 1),
        _["DoubleNoLog"] = p_truncnorm(x[0], mu, sigma, a, b),
        _["VectorLogNoLower"] = ptruncnorm(x, mu, sigma, a, b, false, true),
        _["VectorNoLogNoLower"] = ptruncnorm(x, mu, sigma, a, b, false),
        _["DoubleLogNoLower"] = p_truncnorm(x[0], mu, sigma, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_truncnorm(x[0], mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtruncnorm_nolog(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtruncnorm(x, mu, sigma, a, b),
        _["DoubleNoLog"] = q_truncnorm(x[0], mu, sigma, a, b),
        _["VectorNoLogNoLower"] = qtruncnorm(x, mu, sigma, a, b, false),
        _["DoubleNoLogNoLower"] = q_truncnorm(x[0], mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtruncnorm_log(NumericVector x, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = qtruncnorm(x, mu, sigma, a, b, true, true),
        _["DoubleLog"] = q_truncnorm(x[0], mu, sigma, a, b, 1, 1),
        _["VectorLogNoLower"] = qtruncnorm(x, mu, sigma, a, b, false, true),
        _["DoubleLogNoLower"] = q_truncnorm(x[0], mu, sigma, a, b, 0, 1)
    );
} // nocov



// TRUNCATED T DISTRIBUTION

// [[Rcpp::export]]
List test_dtrunct(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = dtrunct(x, df, a, b, true),
        _["VectorNoLog"] = dtrunct(x, df, a, b),
        _["DoubleLog"] = d_trunct(x[0], df, a, b, 1),
        _["DoubleNoLog"] = d_trunct(x[0], df, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptrunct(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = ptrunct(x, df, a, b, true, true),
        _["VectorNoLog"] = ptrunct(x, df, a, b),
        _["DoubleLog"] = p_trunct(x[0], df, a, b, 1, 1),
        _["DoubleNoLog"] = p_trunct(x[0], df, a, b),
        _["VectorLogNoLower"] = ptrunct(x, df, a, b, false, true),
        _["VectorNoLogNoLower"] = ptrunct(x, df, a, b, false),
        _["DoubleLogNoLower"] = p_trunct(x[0], df, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_trunct(x[0], df, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunct_nolog(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtrunct(x, df, a, b),
        _["DoubleNoLog"] = q_trunct(x[0], df, a, b),
        _["VectorNoLogNoLower"] = qtrunct(x, df, a, b, false),
        _["DoubleNoLogNoLower"] = q_trunct(x[0], df, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunct_log(NumericVector x, double df, double a, double b) {
    return List::create(
        _["VectorLog"] = qtrunct(x, df, a, b, true, true),
        _["DoubleLog"] = q_trunct(x[0], df, a, b, 1, 1),
        _["VectorLogNoLower"] = qtrunct(x, df, a, b, false, true),
        _["DoubleLogNoLower"] = q_trunct(x[0], df, a, b, 0, 1)
    );
} // nocov



// TRUNCATED LOCATION-SCALE T DISTRIBUTION

// [[Rcpp::export]]
List test_dtrunclst(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = dtrunclst(x, df, mu, sigma, a, b, true),
        _["VectorNoLog"] = dtrunclst(x, df, mu, sigma, a, b),
        _["DoubleLog"] = d_trunclst(x[0], df, mu, sigma, a, b, 1),
        _["DoubleNoLog"] = d_trunclst(x[0], df, mu, sigma, a, b)
    );
} // nocov

// [[Rcpp::export]]
List test_ptrunclst(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = ptrunclst(x, df, mu, sigma, a, b, true, true),
        _["VectorNoLog"] = ptrunclst(x, df, mu, sigma, a, b),
        _["DoubleLog"] = p_trunclst(x[0], df, mu, sigma, a, b, 1, 1),
        _["DoubleNoLog"] = p_trunclst(x[0], df, mu, sigma, a, b),
        _["VectorLogNoLower"] = ptrunclst(x, df, mu, sigma, a, b, false, true),
        _["VectorNoLogNoLower"] = ptrunclst(x, df, mu, sigma, a, b, false),
        _["DoubleLogNoLower"] = p_trunclst(x[0], df, mu, sigma, a, b, 0, 1),
        _["DoubleNoLogNoLower"] = p_trunclst(x[0], df, mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunclst_nolog(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorNoLog"] = qtrunclst(x, df, mu, sigma, a, b),
        _["DoubleNoLog"] = q_trunclst(x[0], df, mu, sigma, a, b),
        _["VectorNoLogNoLower"] = qtrunclst(x, df, mu, sigma, a, b, false),
        _["DoubleNoLogNoLower"] = q_trunclst(x[0], df, mu, sigma, a, b, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtrunclst_log(NumericVector x, double df, double mu, double sigma,
        double a, double b) {
    return List::create(
        _["VectorLog"] = qtrunclst(x, df, mu, sigma, a, b, true, true),
        _["DoubleLog"] = q_trunclst(x[0], df, mu, sigma, a, b, 1, 1),
        _["VectorLogNoLower"] = qtrunclst(x, df, mu, sigma, a, b, false, true),
        _["DoubleLogNoLower"] = q_trunclst(x[0], df, mu, sigma, a, b, 0, 1)
    );
} // nocov



// FOUR PARAMETER BETA DISTRIBUTION

// [[Rcpp::export]]
List test_dtri(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = dtri(x, a, b, c, true),
        _["VectorNoLog"] = dtri(x, a, b, c),
        _["DoubleLog"] = d_tri(x[0], a, b, c, 1),
        _["DoubleNoLog"] = d_tri(x[0], a, b, c)
    );
} // nocov

// [[Rcpp::export]]
List test_ptri(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = ptri(x, a, b, c, true, true),
        _["VectorNoLog"] = ptri(x, a, b, c),
        _["DoubleLog"] = p_tri(x[0], a, b, c, 1, 1),
        _["DoubleNoLog"] = p_tri(x[0], a, b, c),
        _["VectorLogNoLower"] = ptri(x, a, b, c, false, true),
        _["VectorNoLogNoLower"] = ptri(x, a, b, c, false),
        _["DoubleLogNoLower"] = p_tri(x[0], a, b, c, 0, 1),
        _["DoubleNoLogNoLower"] = p_tri(x[0], a, b, c, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtri_nolog(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorNoLog"] = qtri(x, a, b, c),
        _["DoubleNoLog"] = q_tri(x[0], a, b, c),
        _["VectorNoLogNoLower"] = qtri(x, a, b, c, false),
        _["DoubleNoLogNoLower"] = q_tri(x[0], a, b, c, 0)
    );
} // nocov

// [[Rcpp::export]]
List test_qtri_log(NumericVector x, double a, double b, double c) {
    return List::create(
        _["VectorLog"] = qtri(x, a, b, c, true, true),
        _["DoubleLog"] = q_tri(x[0], a, b, c, 1, 1),
        _["VectorLogNoLower"] = qtri(x, a, b, c, false, true),
        _["DoubleLogNoLower"] = q_tri(x[0], a, b, c, 0, 1)
    );
} // nocov



// MULTIVARIATE NORMAL DISTRIBUTION

// [[Rcpp::export]]
List test_dmvnorm(arma::mat x, arma::vec mu, arma::mat S) {
    return List::create(
        _["Log"] = dmvnorm(x, mu, S, true),
        _["NoLog"] = dmvnorm(x, mu, S, false)
    );
} // nocov



// MULTIVARIATE T DISTRIBUTION

// [[Rcpp::export]]
List test_dmvt(arma::mat x, arma::vec mu, arma::mat S, double df) {
    return List::create(
        _["Log"] = dmvt(x, mu, S, df, true),
        _["NoLog"] = dmvt(x, mu, S, df, false)
    );
} // nocov



// WISHART DISTRIBUTION

// [[Rcpp::export]]
List test_dwish(arma::mat x, int df, arma::mat S) {
    return List::create(
        _["Log"] = dwish(x, df, S, true),
        _["NoLog"] = dwish(x, df, S, false)
    );
} // nocov



// INVERSE WISHART DISTRIBUTION

// [[Rcpp::export]]
List test_diwish(arma::mat x, int df, arma::mat S) {
    return List::create(
        _["Log"] = diwish(x, df, S, true),
        _["NoLog"] = diwish(x, df, S, false)
    );
} // nocov