rho_sampler: An R6 class for sampling the spatial autoregressive parameter...

rho_samplerR Documentation

An R6 class for sampling the spatial autoregressive parameter ρ

Description

An R6 class for sampling the spatial autoregressive parameter ρ

An R6 class for sampling the spatial autoregressive parameter ρ

Format

An R6Class generator object

Details

This class samples the spatial autoregressive parameter using either a tuned random-walk Metropolis-Hastings or a griddy Gibbs step. Use the rho_priors class for setup.

For the Griddy-Gibbs algorithm see Ritter and Tanner (1992).

Public fields

rho_prior

The current rho_priors

curr_rho

The current value of ρ

curr_W

The current spatial weight matrix W; an n by n matrix.

curr_A

The current spatial filter matrix I - ρ W.

curr_AI

The inverse of curr_A

curr_logdet

The current log-determinant of curr_A

curr_logdets

A set of log-determinants for various values of ρ. See the rho_priors function for settings of step site and other parameters of the grid.

Methods

Public methods


Method new()

Usage
rho_sampler$new(rho_prior, W = NULL)
Arguments
rho_prior

The list returned by rho_priors

W

An optional starting value for the spatial weight matrix W


Method stopMHtune()

Function to stop the tuning of the Metropolis-Hastings step. The tuning of the Metropolis-Hastings step is usually carried out until half of the burn-in phase. Call this function to turn it off.

Usage
rho_sampler$stopMHtune()

Method setW()

Usage
rho_sampler$setW(newW, newLogdet = NULL, newA = NULL, newAI = NULL)
Arguments
newW

The updated spatial weight matrix W.

newLogdet

An optional value for the log determinant corresponding to newW and curr_rho.

newA

An optional value for the spatial projection matrix using newW and curr_rho.

newAI

An optional value for the matrix inverse of newA.


Method sample()

Usage
rho_sampler$sample(Y, mu, sigma)
Arguments
Y

The n by T matrix of responses.

mu

The n by T matrix of means.

sigma

The variance parameter σ^2.


Method sample_Griddy()

Usage
rho_sampler$sample_Griddy(Y, mu, sigma)
Arguments
Y

The n by T matrix of responses.

mu

The n by T matrix of means.

sigma

The variance parameter σ^2.


Method sample_MH()

Usage
rho_sampler$sample_MH(Y, mu, sigma)
Arguments
Y

The n by T matrix of responses.

mu

The n by T matrix of means.

sigma

The variance parameter σ^2.

References

Ritter, C., and Tanner, M. A. (1992). Facilitating the Gibbs sampler: The Gibbs stopper and the griddy-Gibbs sampler. Journal of the American Statistical Association, 87(419), 861-868.


estimateW documentation built on Dec. 6, 2022, 5:11 p.m.