Skip to contents

log f = sum_{k <= K} beta_k phi_k - log Z, with the NUMBER of terms K itself random. That randomness is the entire adaptation mechanism: a fixed K ties the rate to whatever smoothness the basis can express, while a prior on K with fast enough decay lets the posterior settle on the K matching the truth and attain n^(-s/(2s+1)) for every s without knowing s. The exponential link buys positivity and normalisation, so the coefficients need no constraint.

Usage

Ghosalfrsdensity(x, grid = NULL, K = NULL, s = NULL, seed = 0, n_draws = 150)

Arguments

x

Numeric vector of observations; at least 5, with spread.

grid

Evaluation points; 200 equispaced over the range if NULL.

K

Fixed number of terms; drawn from the prior when NULL, which is the adaptive case.

s

Smoothness at which to report the minimax rate.

seed

Seed for the deterministic draws.

n_draws

Monte Carlo draws over K and the coefficients.

Value

List with grid, density, K_fixed, K_drawn_mean, rate, adaptive, prior_on_K, mass, n, method.

Details

Formula: pi(K) proportional to exp(-c K log K); for each draw f(g) proportional to exp(sum_j beta_j cos(pi j z(g))), renormalised by the trapezoid rule, and the reported density is the draw average.

References

Ghosal & van der Vaart (2017), Fundamentals of Nonparametric Bayesian Inference, CUP, sections 10.4 and 10.4.1.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Ghosalfrsdensity(V)
#> $grid
#>   [1] 1.000000 1.035176 1.070352 1.105528 1.140704 1.175879 1.211055 1.246231
#>   [9] 1.281407 1.316583 1.351759 1.386935 1.422111 1.457286 1.492462 1.527638
#>  [17] 1.562814 1.597990 1.633166 1.668342 1.703518 1.738693 1.773869 1.809045
#>  [25] 1.844221 1.879397 1.914573 1.949749 1.984925 2.020101 2.055276 2.090452
#>  [33] 2.125628 2.160804 2.195980 2.231156 2.266332 2.301508 2.336683 2.371859
#>  [41] 2.407035 2.442211 2.477387 2.512563 2.547739 2.582915 2.618090 2.653266
#>  [49] 2.688442 2.723618 2.758794 2.793970 2.829146 2.864322 2.899497 2.934673
#>  [57] 2.969849 3.005025 3.040201 3.075377 3.110553 3.145729 3.180905 3.216080
#>  [65] 3.251256 3.286432 3.321608 3.356784 3.391960 3.427136 3.462312 3.497487
#>  [73] 3.532663 3.567839 3.603015 3.638191 3.673367 3.708543 3.743719 3.778894
#>  [81] 3.814070 3.849246 3.884422 3.919598 3.954774 3.989950 4.025126 4.060302
#>  [89] 4.095477 4.130653 4.165829 4.201005 4.236181 4.271357 4.306533 4.341709
#>  [97] 4.376884 4.412060 4.447236 4.482412 4.517588 4.552764 4.587940 4.623116
#> [105] 4.658291 4.693467 4.728643 4.763819 4.798995 4.834171 4.869347 4.904523
#> [113] 4.939698 4.974874 5.010050 5.045226 5.080402 5.115578 5.150754 5.185930
#> [121] 5.221106 5.256281 5.291457 5.326633 5.361809 5.396985 5.432161 5.467337
#> [129] 5.502513 5.537688 5.572864 5.608040 5.643216 5.678392 5.713568 5.748744
#> [137] 5.783920 5.819095 5.854271 5.889447 5.924623 5.959799 5.994975 6.030151
#> [145] 6.065327 6.100503 6.135678 6.170854 6.206030 6.241206 6.276382 6.311558
#> [153] 6.346734 6.381910 6.417085 6.452261 6.487437 6.522613 6.557789 6.592965
#> [161] 6.628141 6.663317 6.698492 6.733668 6.768844 6.804020 6.839196 6.874372
#> [169] 6.909548 6.944724 6.979899 7.015075 7.050251 7.085427 7.120603 7.155779
#> [177] 7.190955 7.226131 7.261307 7.296482 7.331658 7.366834 7.402010 7.437186
#> [185] 7.472362 7.507538 7.542714 7.577889 7.613065 7.648241 7.683417 7.718593
#> [193] 7.753769 7.788945 7.824121 7.859296 7.894472 7.929648 7.964824 8.000000
#> 
#> $density
#>   [1] 0.1599237 0.1599125 0.1598787 0.1598226 0.1597442 0.1596438 0.1595217
#>   [8] 0.1593781 0.1592134 0.1590281 0.1588227 0.1585976 0.1583535 0.1580909
#>  [15] 0.1578105 0.1575131 0.1571992 0.1568698 0.1565255 0.1561671 0.1557955
#>  [22] 0.1554115 0.1550159 0.1546096 0.1541934 0.1537682 0.1533349 0.1528943
#>  [29] 0.1524472 0.1519944 0.1515369 0.1510753 0.1506105 0.1501432 0.1496743
#>  [36] 0.1492043 0.1487340 0.1482641 0.1477953 0.1473281 0.1468631 0.1464009
#>  [43] 0.1459421 0.1454871 0.1450364 0.1445905 0.1441498 0.1437147 0.1432855
#>  [50] 0.1428626 0.1424463 0.1420368 0.1416345 0.1412396 0.1408522 0.1404726
#>  [57] 0.1401009 0.1397372 0.1393817 0.1390345 0.1386957 0.1383653 0.1380433
#>  [64] 0.1377298 0.1374249 0.1371284 0.1368405 0.1365610 0.1362900 0.1360274
#>  [71] 0.1357731 0.1355271 0.1352894 0.1350598 0.1348382 0.1346247 0.1344190
#>  [78] 0.1342212 0.1340311 0.1338486 0.1336737 0.1335062 0.1333461 0.1331932
#>  [85] 0.1330475 0.1329089 0.1327774 0.1326527 0.1325350 0.1324240 0.1323198
#>  [92] 0.1322224 0.1321315 0.1320473 0.1319696 0.1318985 0.1318339 0.1317758
#>  [99] 0.1317243 0.1316793 0.1316408 0.1316089 0.1315835 0.1315648 0.1315527
#> [106] 0.1315474 0.1315488 0.1315570 0.1315722 0.1315943 0.1316235 0.1316599
#> [113] 0.1317035 0.1317544 0.1318127 0.1318786 0.1319522 0.1320335 0.1321227
#> [120] 0.1322198 0.1323251 0.1324385 0.1325603 0.1326905 0.1328292 0.1329766
#> [127] 0.1331327 0.1332977 0.1334716 0.1336545 0.1338465 0.1340477 0.1342582
#> [134] 0.1344779 0.1347070 0.1349455 0.1351934 0.1354508 0.1357175 0.1359937
#> [141] 0.1362792 0.1365741 0.1368782 0.1371916 0.1375140 0.1378454 0.1381856
#> [148] 0.1385344 0.1388918 0.1392574 0.1396310 0.1400124 0.1404013 0.1407973
#> [155] 0.1412002 0.1416095 0.1420248 0.1424458 0.1428718 0.1433026 0.1437374
#> [162] 0.1441758 0.1446172 0.1450609 0.1455064 0.1459529 0.1463997 0.1468461
#> [169] 0.1472914 0.1477347 0.1481752 0.1486122 0.1490447 0.1494720 0.1498930
#> [176] 0.1503070 0.1507131 0.1511103 0.1514977 0.1518745 0.1522397 0.1525925
#> [183] 0.1529319 0.1532572 0.1535675 0.1538619 0.1541398 0.1544003 0.1546428
#> [190] 0.1548665 0.1550710 0.1552555 0.1554196 0.1555627 0.1556846 0.1557848
#> [197] 0.1558630 0.1559191 0.1559528 0.1559640
#> 
#> $K_fixed
#> NULL
#> 
#> $K_drawn_mean
#> [1] 1.313333
#> 
#> $rate
#> [1] 0.5
#> 
#> $adaptive
#> [1] TRUE
#> 
#> $prior_on_K
#> [1] "pi(K) proportional to exp(-c K log K)"
#> 
#> $mass
#> [1] 1
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "Finite random series (Sec. 10.4.1); the prior on K is what makes it adaptive"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"