bmixlm: Binary Mixture of Linear Models

View source: R/bmixlm.R

bmixlmR Documentation

Binary Mixture of Linear Models

Description

Fits a binary mixture of linear models in which the probability of class membership is related to the covariates through a probit regression model.

Usage

bmixlm(
  formula1,
  formula2,
  formulap,
  data,
  nsamp = 1000,
  nthin = 3,
  tau.prior = c(0.01, 0.01),
  start = list(sigma = c(1e-04, 1e-04))
)

Arguments

formula1

An object of class formula: a symbolic description of the linear model for the first component

formula2

An object of class formula: a symbolic description of the linear model for the second component

formulap

An object of class formula: a symbolic description of the probit model for the probability an observation is

data

A dataframe containing the variables from the model.

nsamp

Number of samples to draw.

nthin

The thinning rate.

tau.prior

Parameters of the (common) Gamma prior for the precision of the two models.

start

A list of initial values for sigma, betap and b

Details

The model assumes the observations are drawn from a two component mixture, where each component is described by a different linear model. The probability that an individual observation is a member of one component or the other is modelled by a probit regression.

The model is fit by Gibbs sampling, assuming uniform priors for the regression coefficients of the two linear model and the probit regression, and a (common) Gamma prior for the precision (inverse variance) of the two linear models. The probit component of the model is sampled by the method of Albert and Chib.

Value

An object of class bmixlm with columns

  • call: the matched call

  • nsamp: the number of samples retained after thinning

  • beta1: matrix of samples of the coefficients of the first linear model

  • beta2: matrix of samples of the coefficients of the second linear model

  • betap: matrix of samples of the coefficients of the probit model

  • sigma: two column matrix of samples of the standard deviations of the errors for the two models

  • data: the input dataframe

  • pW: effective degrees of freedom for the fitted model

  • WAIC: WAIC for the fitted model

  • restart: final sigma, betap and b for restart purposes

References

Albert, J. H., & Chib, S. (1993). Bayesian analysis of binary and polychotomous response data. Journal of the American statistical Association, 88(422), 669-679.


SWotherspoon/bmixlm documentation built on June 10, 2025, 6:47 a.m.