Exemplo n.º 1
0
time_col = count_stats_df.columns[1]
day_col = count_stats_df.columns[2]
count_col = count_stats_df.columns[3]
mean_col = count_stats_df.columns[4]

count_rm = pg.rm_anova2(dv=count_col,
                        within=[day_col, time_col],
                        subject=anim_col,
                        data=count_stats_df)
pg.print_table(count_rm)

count_rm_name = save_test_dir / "02_count_rm.csv"
count_rm.to_csv(count_rm_name)

count_ph = aprep.tukey_pairwise_ph(count_stats_df,
                                   hour_col=time_col,
                                   dep_var=count_col,
                                   protocol_col=day_col)
count_ph_name = save_test_dir / "02_count_ph.csv"
count_ph.to_csv(count_ph_name)

# Q3 Does duration of episodes change between day?
# repeated two way anova of duration ~ Time*day | anim

mean_rm = pg.rm_anova2(dv=mean_col,
                       within=[day_col, time_col],
                       subject=anim_col,
                       data=count_stats_df)
pg.print_table(mean_rm)
mean_name = save_test_dir / "03_mean_rm.csv"
mean_rm.to_csv(mean_name)
Exemplo n.º 2
0
if not os.path.exists(mean_test_dir):
    os.mkdir(mean_test_dir)

mean_anova = pg.mixed_anova(
    dv=dep_var,
    between=condition_col,
    within=hour_col,
    subject=anim_col,
    data=split_relabel
)
pg.print_table(mean_anova)
mean_anova_str = mean_test_dir / anova_str
mean_anova.to_csv(mean_anova_str)

mean_posthoc = prep.tukey_pairwise_ph(
    split_relabel,
    protocol_col=condition_col
)
mean_ph_str = mean_test_dir / ph_str
mean_posthoc.to_csv(mean_ph_str)


# Q3 Does the condition affect the total activity per day
# Two way mixed anova of activity ~ condition*day
# Posthoc test of activity ~ conditin | day

tot_day_col = tot_cols[1]
tot_test_dir = save_test_dir / "03_total_activity"
if not os.path.exists(tot_test_dir):
    os.mkdir(tot_test_dir)

Exemplo n.º 3
0
    count_ph.to_csv(count_dir / ph_str)
    count_stats_dict[curr_label] = count_ph

    mean = mean_cols[-1]
    mean_anova = pg.anova(dv=mean, between=condition_col, data=curr_mean)
    pg.print_table(mean_anova)
    mean_ph = pg.pairwise_tukey(dv=mean, between=condition_col, data=curr_mean)
    pg.print_table(mean_ph)
    mean_anova.to_csv(mean_dir / anova_str)
    mean_ph.to_csv(mean_dir / ph_str)
    mean_stats_dict[curr_label] = mean_ph

    duration_col = hist_cols[-2]
    no_eps = hist_cols[-1]
    hist_posthoc = prep.tukey_pairwise_ph(curr_hist,
                                          protocol_col=condition_col,
                                          hour_col=duration_col,
                                          dep_var=no_eps)
    hist_posthoc.to_csv(hist_dir / ph_str)
    hist_stats_dict[curr_label] = hist_posthoc

count_stats_df = pd.concat(count_stats_dict)
mean_stats_df = pd.concat(mean_stats_dict)
hist_stats_df = pd.concat(hist_stats_dict)

### Step 3 plot all ############################################################

# plotting constants
conditions = exp_data.index.get_level_values(0).unique()
condition_col = col_names[0]
day_col = col_names[1]
animal_col = col_names[2]