Main driver for bbl inference
bbl(
formula,
data,
weights,
xlevels = NULL,
verbose = 1,
method = "pseudo",
novarOk = FALSE,
testNull = TRUE,
prior.count = 1,
...
)
Formula for modeling
Data for fitting
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
List of factor levels for predictors. If NULL
,
will be inferred from data with factor levels ordered alphanumerically.
Output verbosity level. Will be send to down-stream function calls with one level lower
BB inference algorithm; pseudo-likelihood inference ('pseudo'
)
or mean field ('mf'
)
If TRUE
, will proceed with predictors having only one
level
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 for computing single predictor and pairwise frequencies
Other parameters to mlestimate
.
A list of class bbl
with the following elements:
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.
List of vectors containing predictor levels.
The terms
of formula
input.
Vector of response groups.
Name of the response variable.
Matrix of logicals whose elements record whether
formula
includes interaction between the two predictors.
Model data frame derived from formula
and data
.
Log likelihood.
Vector log partition function. Used in predict
.
Vector of integral weights (frequencies).
Function call.
Degrees of freedom.
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.
10.18637/jss.v101.i05
# NOT RUN {
titanic <- as.data.frame(Titanic)
b <- bbl(Survived ~ (Class + Sex + Age)^2, data = titanic, weights = Freq)
b
# }
Run the code above in your browser using DataLab