title: How do we calculate likelihood in python?
body: <p>I am working with two datasets and for reproducibility reasons, I am sharing the datasets <a href="https://drive.google.com/open?id=1a2iyQaG3cbBGFjyfGOlMAW3Ym0J1tL1c" rel="nofollow noreferrer">here</a>. </p>
  
  <p>To make it clear of what I am doing - from column 2, I am reading the current row and compare it with the value of the previous row. If it is greater, I keep comparing. If the current value is smaller than the previous row's value, I want to divide the current value (smaller) by the previous value (larger). Accordingly, the following code:</p>
  
  <pre><code>import numpy as np
  import scipy.stats
  import matplotlib.pyplot as plt
  import seaborn as sns
  
  protocols = {}
  
  types = {"data_v": "data_v.csv", "data_r": "data_r.csv"}
  
  for protname, fname in types.items():
      col_time,col_window = np.loadtxt(fname,delimiter=',').T
      trailing_window = col_window[:-1] # "past" values at a given index
      leading_window  = col_window[1:]  # "current values at a given index
      decreasing_inds = np.where(leading_window &lt; trailing_window)[0]
      quotient = leading_window[decreasing_inds]/trailing_window[decreasing_inds]
      quotient_times = col_time[decreasing_inds]
  
      protocols[protname] = {
          "col_time": col_time,
          "col_window": col_window,
          "quotient_times": quotient_times,
          "quotient": quotient,
      }
      plt.figure(); plt.clf()
      diff=quotient_times
      plt.plot(diff,beta_value, ".", label=protname, color="blue")
      plt.ylim(0, 1.0001)
      plt.title(protname)
      plt.xlabel("quotient_times")
      plt.ylabel("quotient")
      plt.legend()
      plt.show()
  </code></pre>
  
  <p>This gives the following plots.</p>
  
  <ul>
  <li><p><strong>Data-V</strong> has a quotient of 0.8 when the <code>quotient_times</code> is less than 3 and the quotient remains 0.5 if the <code>quotient_times</code> is
  greater than 3.</p></li>
  <li><p><strong>Data-R</strong> has a constant <code>quotient</code> of 0.5 no matter what the value of <code>quotient_times</code></p></li>
  </ul>
  
  <p>Based on this requirement, how can we calculate the likelihood of the previous <code>quotient_times</code> and current <code>quotient_times</code> so as to differentiate <code>Data-V</code> from <code>Data-R</code>? The only place they differ is where the <code>quotient_times</code>is <code>&lt;=3.01</code> whereas, both have the same value greater than <code>quotient_times</code>of 3. To simplify the question, <strong>based on Data-V how likely is it that Data-R is > 0.5</strong>?</p>