6.7.11.6.1. statsmodels.sandbox.regression.treewalkerclass.RU2NMNL

class statsmodels.sandbox.regression.treewalkerclass.RU2NMNL(endog, exog, tree, paramsind)[source]

Nested Multinomial Logit with Random Utility 2 parameterization

Parameters:

endog : array

not used in this part

exog : dict_like

dictionary access to data where keys correspond to branch and leaf names. The values are the data arrays for the exog in that node.

tree : nested tuples and lists

each branch, tree or subtree, is defined by a tuple (branch_name, [subtree1, subtree2, ..., subtreek]) Bottom branches have as subtrees the list of leaf names.

paramsind : dictionary

dictionary that maps branch and leaf names to the names of parameters, the coefficients for exogs)

Notes

endog needs to be encoded so it is consistent with self.leaves, which defines the columns for the probability array. The ordering in leaves is determined by the ordering of the tree. In the dummy encoding of endog, the columns of endog need to have the same order as self.leaves. In the integer encoding, the integer for a choice has to correspond to the index in self.leaves. (This could be made more robust, by handling the endog encoding internally by leaf names, if endog is defined as categorical variable with associated category level names.)

Attributes

branches  
leaves  
paramsnames  
parinddict  

Methods

get_probs(params) obtain the probability array given an array of parameters
__init__(endog, exog, tree, paramsind)[source]

6.7.11.6.1.1. Methods

__init__(endog, exog, tree, paramsind)
calc_prob(tree[, parent]) walking a tree bottom-up based on dictionary
get_probs(params) obtain the probability array given an array of parameters