In [0]:
import numpy as np
import pandas as pd
from scipy.stats import binom
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
rawdata = pd.read_csv('https://raw.githubusercontent.com/tomfaulkenberry/physNumComparisonTask/master/results/processed.csv')
data = rawdata.query('response_time < 2000')
data.head()
Out[2]:
In [10]:
fig, ax = plt.subplots()
ax.hist(data.response_time[data.congruity=='congruent'], bins=30, color='blue', edgecolor='black', label='Congruent trials')
ax.hist(data.response_time[data.congruity=='incongruent'], bins=30, color='white', edgecolor='black', alpha=0.8, label='Incongruent trials')
ax.set_xlabel('Response time (ms)', fontsize=14)
ax.legend()
plt.show()
In [0]:
In [0]:
binom.pmf(3, 10, 0.2)
Out[0]:
In [0]:
fig, ax = plt.subplots()
Y = np.arange(0,10)
P = binom.pmf(Y, 10, 0.2)
ax.bar(Y,P)
ax.set_xlabel('$y$', fontsize=14)
ax.set_ylabel('$p(y\mid \\theta=0.2)$', fontsize=14)
plt.show()
In [0]:
fig, ax = plt.subplots()
Y = np.arange(0,10)
P = binom.pmf(Y, 10, 0.7)
ax.bar(Y,P)
ax.set_xlabel('$y$', fontsize=14)
ax.set_ylabel('$p(y\mid \\theta=0.7)$', fontsize=14)
plt.show()
In [0]:
def L(x):
return(binom.pmf(7, 10, x))
fig, ax = plt.subplots(figsize=(8,5))
Theta = np.linspace(0,1,100)
ax.plot(Theta, L(Theta))
ax.set_xlabel('$\\theta$', fontsize=14)
ax.set_ylabel('$L(\\theta \mid y=7)$', fontsize=14)
plt.show()