Home – BBR Software

Hierarchical Modeling in BBR

Introduction

Suppose the data we observe are broken down into groups; canonical examples are students in different schools or patients in different hospitals. To take advantage of this hopefully relevant information, we want to build separate models for groups. However these models should not be completely independent of each other; we want model parameter estimates to "borrow statistical strength" from each other. Bayesian model for this situation would be hierarchical: second level prior will squeeze together similar parameters for different groups. Exact formulations can be found here.

Setting Priors

Hierachical model parameters form a matrix, where each individual parameter corersponds to a group and a feature or intercept. There are two levels of priors. Level 1 priors correspond to each feature or intercept and play the same role as in the regular case, i.e. squeeze parameter values towards the prior mode. Level 2 priors squeeze together parameter values of different groups corresponding to the same feature. There is no need to supply prior mode value for the Level 2, only the variance.

Current implementations has the following limitations:

Cross-validation is performed if for either Level 1 or Level 2 priors more than one variance value is specified (options -V and --gvar below); it is then performed for all combinations of Level 1 and Level 2 prior variances specified.

If no prior variance for Level 2 is specified (options --gvar below is missing), then modeling is performed in non-hierarchical fashion, and grouping information (dummy variables in the data file) are ignored.

Command-line options for BBRtrain

All regular BBRtrain options are in effect; here are the ones specific for hierarchical modeling:

-g <integer>, --groups <integer> Number of groups, i.e. number of dummy variables in the data file

--gvar <number[,number]*>, Level 2 prior variance values; if more than one, cross-validation will be used

Data File Format

Data file line for hierarchical modeling has the following format:

<label> <dummy variables> { <feature_id>:<value>}*

Dummy variables is what distinguishes this format from that of regular BBR. Dummy variables is a row of 0 or 1 values, space delimited, same number of values for each line in the file; semicolon syntax is not used for dummies. Each position in the dummies row corresponds to a group, and the value 1 or 0 indicates whether the case belongs or does not belong to the group. Training and test files should both have the same number of dummy positions.