#Read in the ANT data (see ?ANT).
data(ANT)
head(ANT)
ezPrecis(ANT)
#Run an ANOVA on the mean correct RT data.
mean_rt_anova = ezANOVA(
data = ANT[ANT$error==0,]
, dv = .(rt)
, wid = .(subnum)
, within = .(cue,flank)
, between = .(group)
)
#Show the ANOVA & assumption tests.
print(mean_rt_anova)
#Plot the main effect of group.
group_plot = ezPlot(
data = ANT[ANT$error==0,]
, dv = .(rt)
, wid = .(subnum)
, between = .(group)
, x = .(group)
, do_lines = FALSE
, x_lab = 'Group'
, y_lab = 'RT (ms)'
)
#Show the plot.
print(group_plot)
#Re-plot the main effect of group, using the levels
##argument to re-arrange/rename levels of group
group_plot = ezPlot(
data = ANT[ANT$error==0,]
, dv = .(rt)
, wid = .(subnum)
, between = .(group)
, x = .(group)
, do_lines = FALSE
, x_lab = 'Group'
, y_lab = 'RT (ms)'
, levels = list(
group = list(
new_order = c('Treatment','Control')
, new_names = c('Treatment
Group','Control
Group')
)
)
)
#Show the plot.
print(group_plot)
#Plot the cue*flank interaction.
cue_by_flank_plot = ezPlot(
data = ANT[ANT$error==0,]
, dv = .(rt)
, wid = .(subnum)
, within = .(cue,flank)
, x = .(flank)
, split = .(cue)
, x_lab = 'Flanker'
, y_lab = 'RT (ms)'
, split_lab = 'Cue'
)
#Show the plot.
print(cue_by_flank_plot)
#Plot the cue*flank interaction by collapsing the cue effect to
##the difference between None & Double
cue_by_flank_plot2 = ezPlot(
data = ANT[ ANT$error==0 & (ANT$cue %in% c('None','Double')) ,]
, dv = .(rt)
, wid = .(subnum)
, within = .(flank)
, diff = .(cue)
, reverse_diff = TRUE
, x = .(flank)
, x_lab = 'Flanker'
, y_lab = 'RT Effect (None - Double, ms)'
)
#Show the plot.
print(cue_by_flank_plot2)
#Plot the group*cue*flank interaction.
group_by_cue_by_flank_plot = ezPlot(
data = ANT[ANT$error==0,]
, dv = .(rt)
, wid = .(subnum)
, within = .(cue,flank)
, between = .(group)
, x = .(flank)
, split = .(cue)
, col = .(group)
, x_lab = 'Flanker'
, y_lab = 'RT (ms)'
, split_lab = 'Cue'
)
#Show the plot.
print(group_by_cue_by_flank_plot)
#Plot the group*cue*flank interaction in both error rate and mean RT.
group_by_cue_by_flank_plot_both = ezPlot(
data = list(
ANT
, ANT[ANT$error==0,]
)
, dv = .(error,rt)
, wid = .(subnum)
, within = .(cue,flank)
, between = .(group)
, x = .(flank)
, split = .(cue)
, col = .(group)
, x_lab = 'Flanker'
, split_lab = 'Cue'
, dv_labs = c('ER (%)', 'RT (ms)')
, row_y_free = TRUE
)
#Show the plot.
print(group_by_cue_by_flank_plot_both)
Run the code above in your browser using DataLab