示例#1
0
t, p = stats.ttest_rel(exp2_econ_part, exp3_econ_part)
print('Economic decision making:\nt=%s, p=%s ' % (t, p))

# -----------------
# 3. Prepare figure
# -----------------

# Figure properties
fig_ratio = 0.65
fig_witdh = 15
linewidth = 1
markersize = 2
fontsize = 6

# Create figure
f = plt.figure(figsize=cm2inch(fig_witdh, fig_ratio * fig_witdh))

# Create plot grid
gs0 = gridspec.GridSpec(18, 16, left=0.075, right=0.99, top=0.95, bottom=0.08, hspace=100, wspace=10)

# ----------------------------
# 4. Plot task trial schematic
# ----------------------------

# Create subplot grid and axis
gs00 = gridspec.GridSpecFromSubplotSpec(1, 8, subplot_spec=gs0[0:7, 0:8], wspace=0)
ax_0 = plt.Subplot(f, gs00[:])
f.add_subplot(ax_0)

# Picture paths
path = ['gb_figures/patches.png', 'gb_figures/fix_cross.png', 'gb_figures/fractals.png',
示例#2
0
# Figure properties
low_alpha = 0.3
medium_alpha = 0.6
high_alpha = 1
blue_1 = '#46b3e6'
blue_2 = '#4d80e4'
blue_3 = '#2e279d'
green_1 = '#94ed88'
green_2 = '#52d681'
green_3 = '#00ad7c'
fig_ratio = 0.65
fig_witdh = 15
fig_heigth = 10

# Create figure
f = plt.figure(figsize=cm2inch(fig_witdh, fig_heigth))

# Create plot grid
gs = gridspec.GridSpec(nrows=4,
                       ncols=6,
                       left=0.1,
                       right=0.99,
                       wspace=1.5,
                       top=0.95,
                       bottom=0.1,
                       hspace=0.5)

# -----------------------------
# 3. Plot posterior predictions
# -----------------------------
            for i in range(0, len(p_hat.o)):

                # Set current agent variables
                agent.c_t = np.asarray(C_t[t])  # coefficient
                agent.o_t = p_hat.o[
                    i]  # observation todo: adjust for sampling-based validation

                # p_{t-1}(\mu|r_t = 0, o_t) analytical result
                agent.learn(p_hat.r_e[r])
                pdf_mu_giv_r_t_o_t[:, i, r] = np.polyval(agent.c_t, p_hat.mu)

        # Initialize figure
        # -----------------
        fig_width = 15
        fig_height = 20
        f = plt.figure(figsize=cm2inch(fig_width, fig_height))

        ax_0 = plt.subplot2grid((4, 4), (0, 0), colspan=2)
        ax_1 = plt.subplot2grid((4, 4), (0, 2))
        ax_2 = plt.subplot2grid((4, 4), (0, 3))
        ax_3 = plt.subplot2grid((4, 4), (1, 0), colspan=2)
        ax_4 = plt.subplot2grid((4, 4), (1, 2), colspan=2)
        ax_5 = plt.subplot2grid((4, 4), (2, 0), colspan=2)
        ax_6 = plt.subplot2grid((4, 4), (2, 2), colspan=2)
        ax_7 = plt.subplot2grid((4, 4), (3, 0))
        ax_8 = plt.subplot2grid((4, 4), (3, 1))
        ax_9 = plt.subplot2grid((4, 4), (3, 2))
        ax_10 = plt.subplot2grid((4, 4), (3, 3))
        barcolor = "slategray"

        # p_t(\mu)