title: python function for bayesiasn information criterion (BIC)
body: <p>I am learning about the bayesian information criterion (BIC) to choose the model which represents better a set of data points, and I would like to compute a python function that evaluates the BIC value.</p>
  
  <p>I know the theory and the main equation:<code>BIC=ln(n)k -2ln(L)</code> (from <a href="https://en.wikipedia.org/wiki/Bayesian_information_criterion" rel="nofollow noreferrer">here</a> )
  but I don't understand, practically, what I have to do.</p>
  
  <p>I have a set of data points and a model, but which are the logic passages to implement <code>L</code> in my function?</p>
  
  <ul>
  <li><code>n</code> is the number of data points</li>
  <li><code>k</code> is the number of free parameters in my model</li>
  <li><code>L</code> is the maximized value of the likelihood function of the model which I don't know how to compute</li>
  </ul>
  
  <p>As an alternative, there is a package that has already implemented some BIC function?</p>
  
  <p><strong>UPDATE</strong>
  Thanks to @dang I am looking at an easier equation <a href="https://pypi.org/project/RegscorePy/" rel="nofollow noreferrer">here</a>:</p>
  
  <p><code>BIC = n*log(residual sum of squares/n) + k*log(n)</code></p>
  
  <p>which sounds more familiar, my only question is about the <code>k</code> value, I am not sure that it refers to the number of total parameters or the number of free parameters in my model.</p>
  
  <p>But I have a doubt: according to the Wikipedia page, this second equation is an approximation in the case of "the model errors or disturbances are independent and identically distributed according to a normal distribution".
  Is that approximation reasonable?</p>