Learn R Programming

psychtm (version 2021.1.0)

gibbs_logistic: Fit logistic regression model

Description

gibbs_logistic() is used to fit a Bayesian logistic regression model using Gibbs sampling.

Usage

gibbs_logistic(
  formula,
  data,
  m = 100,
  burn = 0,
  thin = 1,
  mu0 = NULL,
  sigma0 = NULL,
  eta_start = NULL,
  proposal_sd = NULL,
  verbose = FALSE,
  display_progress = FALSE
)

Arguments

formula

An object of class formula: a symbolic description of the model to be fitted.

data

An optional data frame containing the variables in the model.

m

The number of iterations to run the Gibbs sampler (default: 100).

burn

The number of iterations to discard as the burn-in period (default: 0).

thin

The period of iterations to keep after the burn-in period (default: 1).

mu0

An optional p x 1 mean vector for the prior on the regression coefficients. See 'Details'.

sigma0

A p x p variance-covariance matrix for the prior on the regression coefficients. See 'Details'.

eta_start

A p x 1 vector of starting values for the regression coefficients.

proposal_sd

The proposal standard deviations for drawing the regression coefficients, N(0, proposal_sd(j)), \(j = 1, \ldots, p\) (default: 2.38 for all coefficients).

verbose

Should parameter draws be output during sampling? (default: FALSE).

display_progress

Show progress bar? (default: FALSE). Do not use with verbose = TRUE.

Value

An object of class '>Logistic.

Details

For mu0, by default, we use a vector of \(p\) 0s for \(p\) regression coefficients.

For sigma0, by default, we use a \(p\) x \(p\) diagonal matrix with diagonal elements (variances) of 6.25.

See Also

Other Gibbs sampler: gibbs_mlr(), gibbs_sldax()

Examples

Run this code
# NOT RUN {
data(mtcars)
m1 <- gibbs_logistic(vs ~ hp, data = mtcars)

# }

Run the code above in your browser using DataLab