Skip to content

Commit 818e64e

Browse files
committed
Tentative solution: post-hoc contrast for positional interaction
1 parent c83e494 commit 818e64e

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

code/analysisWordLevelPrePostRevisedReadAloudBeta.R

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,3 +421,78 @@ write_table_html_to_disk(
421421
hesitation_adjacent_misproduction_table_5_logistic_wordfreq_with_absents_as_median_no_psg_bobyqa,
422422
tables_core_pre_post
423423
)
424+
425+
426+
# attempt to identify post-hoc contrasts for the interaction
427+
# credit to @jessb0t
428+
library(openxlsx)
429+
model_pre_post <- hesitation_adjacent_misproduction_model_5_logistic_wordfreq_with_absents_as_median_no_psg_bobyqa
430+
summary_pre_post <- summary(model_pre_post)
431+
432+
em_pre_post_presence_of_adj_hes <-
433+
emmeans(model_pre_post,
434+
pairwise ~ adjacent_hesitation_present_in_direction_looked,
435+
adjust="fdr", pbkrtest.limit = 4000)
436+
437+
em_pre_post_direction_searched <-
438+
emmeans(model_pre_post,
439+
pairwise ~ direction_searched_for_potential_hesitation_predictor,
440+
adjust="fdr", pbkrtest.limit = 4000)
441+
442+
em_pre_post_presence_of_adj_hes_x_direction_searched <-
443+
emmeans(model_pre_post,
444+
pairwise ~ adjacent_hesitation_present_in_direction_looked|direction_searched_for_potential_hesitation_predictor,
445+
adjust="fdr", pbkrtest.limit = 4000)
446+
447+
em_pre_post_direction_searched_x_presence_of_adj_hes <-
448+
emmeans(model_pre_post,
449+
pairwise ~ direction_searched_for_potential_hesitation_predictor|adjacent_hesitation_present_in_direction_looked,
450+
adjust="fdr", pbkrtest.limit = 4000)
451+
452+
workbook <- createWorkbook()
453+
addWorksheet(workbook, sheetName="model-summary")
454+
writeData(workbook,
455+
sheet="model-summary",
456+
summary_pre_post$coefficients,
457+
rowNames=TRUE)
458+
459+
addWorksheet(workbook, sheetName="emmeans-presence_of_adj_hes")
460+
writeData(workbook,
461+
sheet="emmeans-presence_of_adj_hes",
462+
em_pre_post_presence_of_adj_hes$contrasts,
463+
rowNames=TRUE)
464+
465+
addWorksheet(workbook, sheetName="emmeans-direction_searched")
466+
writeData(workbook,
467+
sheet="emmeans-direction_searched",
468+
em_pre_post_direction_searched$contrasts,
469+
rowNames=TRUE)
470+
471+
addWorksheet(workbook, sheetName="emmeans-presadjhesXdirsearched")
472+
writeData(workbook, sheet="emmeans-presadjhesXdirsearched",
473+
em_pre_post_presence_of_adj_hes_x_direction_searched$contrasts,
474+
rowNames=TRUE)
475+
476+
addWorksheet(workbook, sheetName="emmeans-dirsearchedXpresadjhes")
477+
writeData(workbook,
478+
sheet="emmeans-dirsearchedXpresadjhes",
479+
em_pre_post_direction_searched_x_presence_of_adj_hes$contrasts,
480+
rowNames=TRUE)
481+
482+
# addWorksheet(workbook, sheetName="summary-stats-pre-post")
483+
# writeData(workbook,
484+
# sheet="summary-stats-emo",
485+
# dfT_acc_emo,
486+
# rowNames=TRUE)
487+
#
488+
# addWorksheet(workbook, sheetName="summary-stats-chnsxemo")
489+
# writeData(workbook,
490+
# sheet="summary-stats-chnsxemo",
491+
# dfT_acc_speaker_mean,
492+
# rowNames=TRUE)
493+
494+
saveWorkbook(workbook,
495+
paste0(results_path,
496+
"/tables/summary_pre_post_",
497+
Sys.Date(), ".xlsx",
498+
collapse=NULL))
14.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)