bbl {bbl}R Documentation

Boltzmann Bayes Learning Inference

Description

Main driver for bbl inference

Usage

bbl(
  formula,
  data,
  weights,
  xlevels = NULL,
  verbose = 1,
  method = "pseudo",
  novarOk = FALSE,
  testNull = TRUE,
  prior.count = 1,
  ...
)

Arguments

formula

Formula for modeling

data

Data for fitting

weights

Vector of weights for each instance in data. Restricted to non-negative integer frequencies, recoding the number of times each row of data must be repeated. If NULL, assumed to be all 1. Fractional weights are not supported. Can be a named column in data

xlevels

List of factor levels for predictors. If NULL, will be inferred from data with factor levels ordered alphanumerically.

verbose

Output verbosity level. Will be send to down-stream function calls with one level lower

method

BB inference algorithm; pseudo-likelihood inference ('pseudo') or mean field ('mf')

novarOk

If TRUE, will proceed with predictors having only one level

testNull

Repeat the inference for the ‘pooled’ sample; i.e., under the null hypothesis of all rows in data belonging to a single group

prior.count

Prior count for computing single predictor and pairwise frequencies

...

Other parameters to mlestimate.

Details

Formula argument and data are used to tabulate xlevels unless explicitly given as list. Data are expected to be factors or integers. This function is a driver interepreting formula and calls bbi.fit. Will stop with error if any predictor has only one level unless novarOk='TRUE'. Use removeConst to remove the non-varying predictors before calling if this happens.

Value

A list of class bbl with the following elements:

coefficients

List of inferred coefficients with elements h, J, h0, and J0. The bias parameter h is a list of length equal to no. of response groups, each of which is a list of the same struture as xlevels: length equal to no. of predictors, containing vectors of length equal to each predictor factor levels: h_i^{(y)}(x) represented by h[[y]][[i]][x]. The interaction parameter J is a list of lists of dimension m \times m, where m is the number of predictors. Each element is a matrix of dimension L_i \times L_j, where L_i and L_j are numbers of factor levels in predictor i and j: J_{ij}^{(y)}(x_1,x_2) represented by J[[y]][[i]][[j]][x1,x2]. All elements of lists are named. The pooled parameters h0 and J0, if computed, are of one less dimension, omitting response group argument.

xlevels

List of vectors containing predictor levels.

terms

The terms of formula input.

groups

Vector of response groups.

groupname

Name of the response variable.

qJ

Matrix of logicals whose elements record whether formula includes interaction between the two predictors.

model

Model data frame derived from formula and data.

lkh

Log likelihood.

lz

Vector log partition function. Used in predict.

weights

Vector of integral weights (frequencies).

call

Function call.

df

Degrees of freedom.

Author(s)

Jun Woo, junwoo035@gmail.com

References

doi: 10.18637/jss.v101.i05

Examples

titanic <- as.data.frame(Titanic)
b <- bbl(Survived ~ (Class + Sex + Age)^2, data = titanic, weights = Freq)
b

[Package bbl version 1.0.0 Index]