# Implementing the Bayesian Information Criterion (BIC) Using PyKalman

I'm trying to use pykalman to do a Kalman filter on financial data and it seems to be generally working very well. However, when I attempt to extend the code using BIC $\mathrm{BIC} = {-2 \cdot \ln{\hat L} + k \cdot \ln(n)}$ I'm having trouble getting reasonable results.

The KalmanFilter class has a method called loglikelihood which I thought would calculate $\ln{\hat L}$; however, I looked into the code a bit and it seems to running the filter agai,n which is a bit odd. I'm not sure if I'm passing the correct data which might be the issue. I'm passing the observations resulting from the Kalman smoother calculated parameters $(\alpha, \beta)$

$\alpha + \beta r_m$


Is that correct? Any insight/examples on implementing BIC using pykalman?

• If this is really about using this particular software, it's off-topic here. Is there a statistical question here. Please see advice in the Help Center. – Nick Cox May 22 '15 at 16:09
• Somewhere in between honestly. I thought this community would be the most likely to understand and implement BIC as I have asked some related more theoretical questions here on the subject, but I was definitely not sure if this question wouldn't be better on the quant finance se or the main se. – rhaskett May 22 '15 at 16:56