Skip to contents

f = sum_k z_k phi_k with INDEPENDENT coefficients. Independence plus a decaying coefficient variance is what makes the series converge almost surely, so the decay rate is not a tuning choice but the thing that decides whether the prior lives on a function space at all.

Usage

Ghosalrandombasisexpansion(x, n_terms = 12, seed = 42, decay = 1.5)

Arguments

x

Evaluation points.

n_terms

Number of basis terms.

seed

Seed for the deterministic draws.

decay

Coefficient decay exponent, positive.

Value

List with estimate (mean of f), f, coefficients, method.

Details

Formula: z_k = Z_k (k+1)^(-decay), Z_k iid N(0, 1); f(x) = sum_k z_k cos(pi (k+1) x).

References

Ghosal & van der Vaart (2017), Fundamentals of Nonparametric Bayesian Inference, CUP, section 2.1.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Ghosalrandombasisexpansion(V)
#> $estimate
#> [1] -0.4001719
#> 
#> $f
#> [1] -0.9176764  0.1173326 -0.9176764  0.1173326 -0.9176764  0.1173326 -0.9176764
#> [8]  0.1173326
#> 
#> $coefficients
#>  [1]  0.414719750 -0.315329395  0.332860345  0.068202555 -0.096635072
#>  [6] -0.121035282 -0.061857581  0.011510396 -0.078840245 -0.025770816
#> [11]  0.007257308 -0.017749316
#> 
#> $method
#> [1] "random cosine-basis expansion (GvdV 2017 sec. 2.1)"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"