fn.one.rep.y: Perform a single Metropolis-Hastings step

Description Usage Arguments Details Value

View source: R/fn_one_rep_y.R

Description

Performs a single Metropolis-Hastings step for the restricted likelihood method

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
fn.one.rep.y(
  y.curr,
  Beta,
  sig,
  l1obs,
  s1obs,
  X,
  log.prop.den.curr,
  proj,
  fn.psi,
  fn.chi,
  psi,
  scaleEst,
  maxit = 400
)

fn.one.rep.y2(
  y.curr,
  Beta,
  sig,
  l1obs,
  s1obs,
  X,
  log.prop.den.curr,
  proj,
  Qt,
  fn.psi,
  fn.chi,
  psi,
  scaleEst,
  maxit = 400
)

Arguments

y.curr

current data vector

Beta

vector of regression coefficient parameters

sig

sigma-the standard deviation parameter

l1obs

conditioning statistic-estimate of Beta from observed data

s1obs

conditioning statistic-estimate of sigma from observed data

X

regression design matrix (i)

log.prop.den.curr

value of the proposal density for the current data vector (free of other parameters so it can be saved from iteration to iteration to save computation time)

proj

the projection matrix onto the deviation space (aka the least squares residual space)

fn.psi

custom psi function returning psi(x) or psi'(x) defining M-estimator for location ; default is fn.psi.huber

fn.chi

custom chi function returning chi(x) or chi'(x) defining M-estimator for scale; default (and currently only capability) is fn.chi.prop2

psi

psi function returning psi(x)/x. Must match fn.spi, but currently no warning is thrown.

scaleEst

'Huber' (default and currently only capability).

maxit

max iterations for the estimation of the summary statistics

Qt

Q transpose where Q is the orthonormalized X

Details

Two equivalent versions, the second uses fn.attenuation2 and is faster. This function is designed for use within an MCMC sampler. Many of the inputs are iteration dependent. The input log.prop.den.curr is designed as a time saver. Since this is free of other parameters it can be saved from iteration to iteration to save computation time. Note the use of both fn.psi (custom in the brlm package) and psi (from the MASS package). This is poor coding and should be corrected.

Value

list y.curr: the new (if accepted) or same (if rejected) data vector, a: indicator of acceptance of proposed value 1 if accepted, 0 if rejected, log.prop.den.curr: proposal density on log scale of the returned data vector, rat: MH ratio, log.rat1: log ratio of proposal densities


jrlewi/brlm documentation built on March 17, 2021, 1:10 a.m.