Fix RegressionResult.bayesfactor_beta_zero for categorical terms

This commit is contained in:
RunasSudo 2022-10-16 02:49:43 +11:00
parent 78944c7966
commit 4340be165b
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A
1 changed files with 5 additions and 1 deletions

View File

@ -145,10 +145,14 @@ class RegressionResult:
"""
Compute Bayes factor testing the hypothesis that the given beta is 0
Requires statsmodels regression
term: Raw name (from statsmodels, available via RegressionResult.raw_result) of term to be tested
"""
# FIXME: Allow specifying our renamed terms
# Get parameters required for AFBF
params = pd.Series({term.raw_name.replace('[', '_').replace(']', '_'): term.beta.point for term in self.terms.values()})
params = pd.Series({raw_name.replace('[', '_').replace(']', '_'): beta for raw_name, beta in self.raw_result.params.items()})
cov = self.raw_result.cov_params()
# Compute BF matrix