185 lines
4.8 KiB
Python
185 lines
4.8 KiB
Python
import sys
|
|
import seaborn as sns
|
|
sys.path.append('/home/fabee/code')
|
|
from matplotlib.pyplot import *
|
|
from scipy import stats
|
|
from numpy import *
|
|
|
|
sns.set_context("talk", font_scale=1.5, rc={"lines.linewidth": 2.5})
|
|
|
|
# define the curves
|
|
x = np.linspace(2, 20, 200)
|
|
n = 16.
|
|
|
|
|
|
X =random.randn(n)*4.+12.5
|
|
fig = figure()
|
|
ax = fig.add_subplot(111)
|
|
ax.set_xlim(5, 18)
|
|
#ax.set_ylim(0, .5)
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
fig.savefig('figs/repetition0.png')
|
|
|
|
# ####################################################3
|
|
fig = figure()
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
|
|
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
|
|
|
|
|
|
ax.set_xlim(5, 18)
|
|
# ax.set_ylim(0, .5)
|
|
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
|
|
ax.legend()
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
|
|
fig.savefig('figs/repetition1.png')
|
|
|
|
|
|
# ####################################################3
|
|
fig = figure()
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
|
|
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
|
|
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
|
|
|
|
ax.set_xlim(5, 18)
|
|
# ax.set_ylim(0, .5)
|
|
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
|
|
ax.legend()
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
|
|
fig.savefig('figs/repetition2.png')
|
|
|
|
# ####################################################3
|
|
fig = figure()
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
xx = linspace(stats.norm.ppf(0.05),stats.norm.ppf(1-0.05),100)
|
|
xx += 10.
|
|
|
|
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
|
|
xx = hstack((xx[0],xx,xx[-1]))
|
|
yy = hstack((0,yy,0))
|
|
|
|
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
|
|
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
|
|
|
|
ax.fill(xx,yy,'c')
|
|
|
|
ax.set_xlim(5, 18)
|
|
# ax.set_ylim(0, .5)
|
|
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
|
|
ax.legend()
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
|
|
fig.savefig('figs/repetition3.png')
|
|
|
|
|
|
# ####################################################3
|
|
fig = figure()
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
xx = linspace(stats.norm.ppf(0.05),stats.norm.ppf(1-0.05),100)
|
|
xx += 10.
|
|
|
|
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
|
|
xx = hstack((xx[0],xx,xx[-1]))
|
|
yy = hstack((0,yy,0))
|
|
|
|
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
|
|
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
|
|
|
|
ax.fill(xx,yy,'c')
|
|
|
|
ax.set_xlim(5, 18)
|
|
# ax.set_ylim(0, .5)
|
|
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45)
|
|
|
|
ax.plot([xx[0],xx[-1]],[0,0],'-g',label=r'$H_0$',lw=4)
|
|
ax.plot([0,xx[0]],[0,0],'-r',label=r'$H_1$',lw=4)
|
|
ax.plot([xx[-1],20],[0,0],'-r',lw=4)
|
|
|
|
ax.legend()
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
|
|
fig.savefig('figs/repetition4.png')
|
|
|
|
|
|
# ####################################################3
|
|
fig = figure()
|
|
|
|
|
|
ax = fig.add_subplot(111)
|
|
|
|
ax.plot(x,-stats.norm.pdf(x,loc=10,scale=4),'orange',label=r'Null distribution of x')
|
|
ax.plot(x,-stats.t.pdf(x,n-1,loc=10,scale=1),'b',label=r'Null distribution of $t$')
|
|
|
|
xx = linspace(0,stats.norm.ppf(0.05)+10.,100)
|
|
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
|
|
xx = hstack((xx[0],xx,xx[-1]))
|
|
yy = hstack((0,yy,0))
|
|
ax.fill(xx,yy,'magenta')
|
|
|
|
xx = linspace(stats.norm.ppf(1-0.05)+10.,20,100)
|
|
yy = -stats.norm.pdf(xx,loc=10.,scale=1)
|
|
xx = hstack((xx[0],xx,xx[-1]))
|
|
yy = hstack((0,yy,0))
|
|
ax.fill(xx,yy,'magenta')
|
|
|
|
ax.set_xlim(5, 18)
|
|
# ax.set_ylim(0, .5)
|
|
|
|
ax.plot([10,10],[-.2,.2],'k-',lw=2)
|
|
ax.text(10,.3,r'stimulus position',rotation=-30);
|
|
ax.plot([12.5,12.5],[-.2,.2],'b-',lw=2)
|
|
ax.text(12.5,.3,r'$\hat\mu$',rotation=-45);
|
|
ax.legend()
|
|
|
|
ax.set_xlabel('x eye position')
|
|
#XKCDify(ax, expand_axes=True,yaxis_loc=0,xaxis_loc=0)
|
|
ax.plot(X,0*X,'ob',label='fixations',mfc='orange',ms=10)
|
|
|
|
fig.savefig('figs/repetition5.png')
|