Document template

Exercise 1

Create a new papaja document from the R Markdown templates.
File > New File > R Markdown... > From Template

Exercise 2

Locate the example manuscript in the folder exercises/3_papaja_example_manuscript and open the file manuscript.pdf or manuscript.docx.

Populate the YAML front matter of your papaja document by transfering the metadata from the example manuscript.
The manuscript contains no note or contributorship information. The notefield and each author’s role field can simply be omitted.
title: "Distorted estimates of implicit and explicit learning in applications of the process-dissociation procedure to the SRT task"
shorttitle: "Distorted PD estimates in sequence learning"

author: 
  - name: "Christoph Stahl"
    affiliation: ""
    corresponding: yes
    address: "Herbert-Lewin-Straße 2, 50931 Köln"
    email: "christoph.stahl@uni-koeln.de"
  - name: "Marius Barth"
    affiliation: ""
  - name: "Hilde Haider"
    affiliation: ""

affiliation:
  - id: ""
    institution: "University of Cologne"

authornote: |
  This work was funded by Deutsche Forschungsgemeinschaft grants STA-1269/1-1 and HA-5447/8-1.

abstract: |
  We investigated potential biases affecting the validity of the process-dissociation (PD) procedure when applied to sequence learning.
  Participants were or were not exposed to a serial reaction time task (SRTT) with two types of pseudo-random materials.
  Afterwards, participants worked on a free or cued generation task under inclusion and exclusion instructions.
  Results showed that pre-experimental response tendencies,
  non-associative learning of location frequencies,
  and the usage of cue locations introduced bias to PD estimates.
  These biases may lead to erroneous conclusions regarding the presence of implicit and explicit knowledge.
  Potential remedies for these problems are discussed.

keywords: "implicit learning, serial reaction time task, process-dissociation procedure, response bias"
wordcount: "8,167"

Exercise 3

Make your manuscript preprint-ready: Hide line numbers and add a “DRAFT” watermark.
Use the draft and linenumbers options in the YAML front matter.
draft: yes
linenumbers: no
Try the single-column single-spaced document style by using the "doc" class option.
classoption: "doc"

Citations

Exercise 4

Copy the introduction of the example manuscript into your document. Use the visual editor or the RStudio addin citr to insert citations.
Don’t forget to add the bibliography file(s) to your YAML front matter.

Add the the bibliography files to the YAML front matter:

bibliography: ["references.bib", "r-references.bib"]

The following is an examplary excerpt of what you citations could look like:

One of the most frequently utilized paradigms in the field of implicit learning is the serial reaction time task (SRTT) originating from @nissen_attentional_1987. [...] Even with more sensitive tests including the recently introduced wagering task [@dienes_gambling_2010; @haider_old_2011;  @persaud_postdecision_2007] or the process-dissociation procedure [@destrebecqz_can_2001; @haider_old_2011; @jacoby_process_1991], explicit knowledge of the sequence is rare.

Report statistical analyses

Exercise 5

Locate and open the R-script analyses.R and data folder data accompanying the example manuscript in the folder exercises/3_papaja_example_manuscript.

Use apa_print() to report the results of one or more analysis using in-line code chunks in your papaja document.

Use the section comments (e.g., ## ----setup----) to split the R script into meaningful code chunks and use the section headings as chunk names.

You may omit parts of the R script that are not necessary for the analysis you are trying to insert into your document.

The following is a minimal example of how to report one hypothesis test of one of the analyses.

```{r setup}
# load packages
library("papaja")
library("afex")
```

```{r prepare-data}
acquisition <- readRDS("data/acquisition-task.rds")
```

```{r acquisition-rt}
# within the permuted-material group, high vs. low frequency locations can be distinguished
tmp.perm <- acquisition[
  acquisition$error == 0 &
  acquisition$trial > 1 &
  acquisition$included_participant &
  acquisition$material == "Permuted" &
  !is.na(acquisition$frequency),
]

permuted_aov <- aov_ez(
  data = tmp.perm
  , dv = "SRI"
  , within = c("block", "frequency")
  , id = "id"
)

permuted_res <- apa_print(permuted_aov)
```
The effect of *frequency* was significant, `r permuted_res$full_result$frequency`.
Add the corresponding plot that visualizes the results to your document.
```{r acquisition-rt-plot}
apa_lineplot(
  data = tmp.perm
  , id = "id"
  , dv = "SRI"
  , factors = c("block", "frequency")
  , dispersion = wsci
  , ylab = ""
  , args_lines = list(lty = c("solid", "solid"))
  , args_points = list(pch = c(21, 21))
  , args_legend = list(legend = c("High", "Low"), title = "Location frequency")
  , ylim = c(475, 650)
  , jit = .05
)
```

Rendering tables

Exercise 6

Locate the section proportion-correct-table-appendix at the end of the R-script analyses.R.

Render the table of descriptive statistics for the generation task in your papaja document with apa_table().
Use the arguments col_spanners and midrules to structure the table. To add a caption, use the argument caption. See ?apa_table.
```{r proportion-correct-table}
tmp <- generation[
  generation$included_participant &
  generation$repetition == 0 &
  generation$post_repetition == 0,
]

# calculate proportion of regular transitions per participant
agg <- aggregate(
  formula = correct_SOC ~ material + generation + order + PD_instruction + id
  , data = tmp
  , FUN = mean
  , na.rm = TRUE
)

# calculate condition means and standard errors
means <- aggregate(
  formula = cbind(M = correct_SOC) ~ material + generation + order + PD_instruction
  , data = agg
  , FUN = mean
)
SEs <- aggregate(
  formula = cbind(`SE` = correct_SOC) ~ material + generation + order + PD_instruction
  , data = agg
  , FUN = se
)

# merge means and CI width
tab <- merge(means, SEs)

# bind Inclusion and Exclusion side-by-side
tab <- cbind(tab[tab$PD_instruction == "Inclusion", ], tab[tab$PD_instruction == "Exclusion", c("M", "SE")])
tab$PD_instruction <- NULL

tab$material <- gsub(tab$material, pattern = "-", replacement = " ", fixed = TRUE)
tab$generation <- as.character(tab$generation)
tab$generation[duplicated(paste0(tab$material, tab$generation))] <- ""
tab$material[duplicated(tab$material)] <- ""

apa_table( tab , row.names = FALSE , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7)) , midrules = c(4, 8, 12) , caption = "Means (M) and standard errors (SE) of proportion of correctly generated second-order conditionals (SOCs)." , placement = NULL )
```

Place the table in the appendix of your document. To start an appendix, use the following special heading:

# (APPENDIX) Appendix {-}
\newpage

# References

::: {#refs custom-style="Bibliography"}
:::


\newpage

# (APPENDIX) Appendix {-}


```{r proportion-correct-table-appendix}
apa_table(
  tab
  , row.names = FALSE
  , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7))
  , midrules = c(4, 8, 12)
  , caption = "Means (M) and standard errors (SE) of proportion of correctly generated second-order
    conditionals (SOCs)."
  , placement = NULL
)
```

Captions and cross-referencing

Exercise 7

Use a text-reference for your table caption and reference the table in the body of the text.
Text reference definitions must be on their own line, surrounded by empty lines, and start with (ref:reference-name).
(ref:table-caption) Means ($M$) and standard errors ($\mathit{SE}$) of proportion of correctly generated second-order conditionals (SOCs).
```{r proportion-correct-table} apa_table( tab , row.names = FALSE , col_spanners = list(Inclusion = c(4, 5), Exclusion = c(6, 7)) , midrules = c(4, 8, 12)
, caption = "(ref:table-caption)"
, placement = NULL ) ```