predictAll: Predicted Values for a 'bmixlm' Object

View source: R/bmixlm.R

predictAllR Documentation

Predicted Values for a bmixlm Object

Description

Return the full range of predicted values that can be computed from the model when the responses are available for the prediction data set.

Usage

predictAll(
  object,
  type = c("mean", "samples"),
  data = NULL,
  standardize = FALSE,
  ...
)

Arguments

object

An object of class bmixlm

type

Whether to return the posterior means or samples from the posterior.

data

A dataframe for which predictions are required

standardize

Whether to standardize the residuals.

...

Currently unused.

Details

This function returns the predicted values that are conditional only on the responses for the data to which the model is fitted:

  • the predicted values for the two component linear models

  • the posterior predictive probability p of membership of the second component

together with the predicted values conditional on the responses from both the data to which the model is fitted, and the prediction data set:

  • the residuals or prediction error given the observed response in the prediction data

  • the posterior probability q of membership of the second component,

The posterior predictive probability p predicts the probability that a new response will be drawn from the second component, the posterior probability q predicts the probability that the observed response was drawn from the second component.

If type="mean" the function returns posterior means as a dataframe, otherwise it returns samples from the posterior as a list of arrays.

Value

Returns a list or dataframe with elements

  • y: vector of responses from data

  • y1: predicted values for the first component model

  • y2: predicted values for the second component model

  • r1: residuals for the first component model

  • r2: residuals for the second component model

  • p: posterior predictive probabilities of membership of the second component

  • q: posterior probabilities of membership of the second component

If type="mean" return a dataframe of posterior means is returned, and if type="samples" return a list of arrays of samples from the posterior.


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