ordregr_lpost: Log-posterior function for a proportional odds model

View source: R/ordregr_lpost.R

ordregr_lpostR Documentation

Log-posterior function for a proportional odds model

Description

Log-posterior function for a proportional odds model

Usage

ordregr_lpost(
  y,
  nc,
  Xcal,
  theta,
  descending = FALSE,
  prior = list(mean = NULL, Prec = NULL),
  gradient = TRUE,
  Hessian = TRUE
)

Arguments

y

Vector containing the ordinal response (coded using integers in 1:nc).

nc

(optional) Maximum value of y.

Xcal

Design matrix.

theta

Vector c(alpha,beta) with intercepts <alpha> and regression parameters <beta>.

descending

Logical indicating if the odds of the response taking a value in the upper scale should be preferred over values in the lower scale.

prior

(optional) List given the mean and Prec(ision) of the regression parameters.

gradient

Logical indicating if the gradient of the log-posterior should be computed.

Hessian

Logical indicating if the Hessian of the log-posterior should be computed.

Value

The log-posterior with the following attributes:

  • Salpha : ⁠ ⁠gradient wrt intercepts 'alpha'.

  • Sbeta : ⁠ ⁠gradient wrt regression parameters 'beta'.

  • grad : ⁠ ⁠gradient wrt c(alpha,beta).

  • Halpha : ⁠ ⁠Hessian wrt intercepts 'alpha'.

  • Hbeta : ⁠ ⁠Hessian wrt regression parameters 'beta'.

  • Hba : ⁠ ⁠cross-derivatives (Hessian) submatrix wrt 'alpha' & 'beta'.

  • Hessian : ⁠ ⁠Hessian wrt c(alpha,beta).

  • dtheta : ⁠ ⁠step in a Newton-Raphson iteration: solve(-Hessian,grad).

References

Lambert, P. and Gressani, 0. (2023) Penalty parameter selection and asymmetry corrections to Laplace approximations in Bayesian P-splines models. Statistical Modelling. <doi:10.1177/1471082X231181173>. Preprint: <arXiv:2210.01668>.


ordgam documentation built on Sept. 14, 2023, 5:07 p.m.