bm_harmonics | R Documentation |
Constructs a mapper for cos
/sin
functions of orders 1 (if
intercept
is TRUE
, otherwise 0) through order
. The total number of
basis functions is intercept + 2 * order
.
Optionally, each order can be given a non-unit scaling, via the scaling
vector, of length intercept + order
. This can be used to
give an effective spectral prior. For example, let
scaling = 1 / (1 + (0:4)^2) x <- seq(0, 1, length.out = 11) bmh1 = bm_harmonics(order = 4, interval = c(0, 1)) u1 <- ibm_eval( bmh1, input = x, state = rnorm(9, sd = rep(scaling, c(1, 2, 2, 2, 2))) )
Then, with
bmh2 = bm_harmonics(order = 4, scaling = scaling) u2 = ibm_eval(bmh2, input = x, state = rnorm(9))
the stochastic properties of u1
and u2
will be the same, with
scaling^2
determining the variance for each frequency contribution.
The period for the first order harmonics is shifted and scaled to match
interval
.
bm_harmonics(order = 1, scaling = 1, intercept = TRUE, interval = c(0, 1))
bru_mapper_harmonics(...)
## S3 method for class 'bm_harmonics'
ibm_n(mapper, inla_f = FALSE, ...)
## S3 method for class 'bm_harmonics'
ibm_jacobian(mapper, input, state = NULL, inla_f = FALSE, ...)
order |
For |
scaling |
For |
intercept |
logical; For |
interval |
numeric length-2 vector specifying a domain interval.
Default |
... |
Arguments passed on to other methods |
mapper |
A mapper S3 object, inheriting from |
inla_f |
logical; when |
input |
Data input for the mapper. |
state |
A vector of latent state values for the mapping,
of length |
bru_mapper, bru_mapper_generics
Other mappers:
bm_aggregate()
,
bm_collect()
,
bm_const()
,
bm_factor()
,
bm_fmesher()
,
bm_index()
,
bm_linear()
,
bm_logsumexp()
,
bm_marginal()
,
bm_matrix()
,
bm_mesh_B()
,
bm_multi()
,
bm_pipe()
,
bm_repeat()
,
bm_scale()
,
bm_shift()
,
bm_sum()
,
bm_taylor()
,
bru_get_mapper()
,
bru_mapper()
,
bru_mapper.fm_mesh_1d()
,
bru_mapper.fm_mesh_2d()
,
bru_mapper_generics
m <- bm_harmonics(2)
ibm_eval2(m, input = c(0, pi / 4, pi / 2, 3 * pi / 4), 1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.