CAR_prior function

CAR prior

CAR prior

Defines the prior of a structural block as a Conditional Autoregressive (CAR) prior.

CAR_prior( block, adj.matrix, scale, rho, sum.zero = FALSE, var.index = 1:block$n )

Arguments

  • block: dlm_block object: The structural block.
  • adj.matrix: matrix: The adjacency matrix.
  • scale: numeric: The tau parameter for the CAR model (see references).
  • rho: numeric: The rho parameter for the CAR model (see references).
  • sum.zero: Bool: If true, all latent states will add to 0.
  • var.index: integer: The index of the variables from which to set the prior.

Returns

A dlm_block object with the desired prior.

Details

The filtering algorithm used in this package requires a proper prior for the latent space. As such, this implementation of the CAR prior imposes a zero-sum constraint in the regional effects. The discount factor must be the same for all variables whose prior is being modified.

For a revision of the CAR prior, see \insertCite AlexCar;textualkDGLM.

For the details about the implementation see \insertCite ArtigoPacote;textualkDGLM.

Examples

# Creating an arbitrary adjacency matrix adj.matrix <- matrix( c( 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0 ), 5, 5, byrow = TRUE ) polynomial_block(mu = 1, D = 0.95) |> block_mult(5) |> CAR_prior(scale = 9, rho = 1, adj.matrix = adj.matrix)

References

\insertAllCited

See Also

Auxiliary functions for creating structural blocks polynomial_block, regression_block, harmonic_block, TF_block.

Other auxiliary functions for defining priors.: joint_prior(), zero_sum_prior()

  • Maintainer: Silvaneo dos Santos Jr.
  • License: GPL (>= 3)
  • Last published: 2025-03-20