R/update_sigma.ab_fc.R

update_sigma.ab_fc <- function(Y, Z, X, beta, sigma.squared, a, b) {
  # Hyperparameters
  V_sigma.ab <- diag(c(1,1))
  n_sigma.ab <- 3
  # Find n
  n <- dim(Y)[1]
  # Create matrix from a and b for use in new parameters
  abmat <- matrix(c(
    sum(a^2),
    sum(a*b),
    sum(a*b),
    sum(b^2)
  ), ncol=2)
  # New parameters
  Snew <- solve(solve(V_sigma.ab) + abmat)
  nunew <- n_sigma.ab + n
  # Calculate the new value and return
  return(solve(amen::rwish(S0=Snew, nu=nunew)))
}
ianmtaylor1/amen2 documentation built on June 1, 2019, 4:55 a.m.