Investigation: Telling your data story#
Scientific communication links a question to evidence and a qualified conclusion. A clear narrative should expose uncertainty and alternative explanations rather than conceal them. Every reported number should be traceable to a reproducible output.
Question. Generate a coefficient table and figure from one fitted model, then write technical and public-facing summaries with compatible claims.
Before running: write the result you expect and what would challenge it. Data are simulated unless explicitly identified otherwise.
# Open this notebook from book/notebooks (or book/exercises).
course_path <- if (file.exists("../R/course.R")) "../R/course.R" else "book/R/course.R"
stopifnot(file.exists(course_path))
source(course_path)
set.seed(432)
d <- simulate_trials()
# Item aggregation makes the conditional target explicit: these participants, new items.
items <- aggregate(rt~item+frequency+length,d,mean)
fit <- lm(rt~frequency+length,items)
ci <- confint(fit)
result <- data.frame(term=names(coef(fit)),estimate=unname(coef(fit)),lower=ci[,1],upper=ci[,2])
result
plot(items$frequency,items$rt,pch=16,xlab="Word frequency (simulated units)",ylab="Mean RT across participants (ms)")
new <- data.frame(frequency=seq(1,7,length.out=50),length=mean(items$length))
lines(new$frequency,predict(fit,new),lwd=2)
b <- result[result$term=="frequency",]
cat(sprintf("In this simulated study, a one-unit higher word-frequency value was associated with %.1f ms change in mean RT after adjustment for length (model-based 95%% interval %.1f to %.1f ms).
",b$estimate,b$lower,b$upper))
ledger <- data.frame(claim=c("frequency association","uncertainty","causation","all populations"),evidence=c("coefficient table","model-based interval conditional on assumptions","not established by this fit","not evaluated"))
ledger
In this simulated study, a one-unit higher word-frequency value was associated with -27.7 ms change in mean RT after adjustment for length (model-based 95% interval -33.6 to -21.9 ms).
| claim | evidence |
|---|---|
| <chr> | <chr> |
| frequency association | coefficient table |
| uncertainty | model-based interval conditional on assumptions |
| causation | not established by this fit |
| all populations | not evaluated |
Write for two audiences#
Use the same estimate and uncertainty in a technical paragraph and an accessible summary. Describe the simulation, aggregation, adjustment, and target. This interval relies on the item-level regression model and does not include every source of population uncertainty.
Saved faulty draft: “Our neuroscience experiment proves that frequent words improve everyone’s cognition.” Explain the invented study description, causal overclaim, construct substitution, and population overreach. An AI-generated caption must be checked against the actual plot and outputs; never invent citations or participant details.
Interpret and verify#
Create a claim-to-evidence ledger and audit an AI-style draft sentence by sentence. Distinguish planned analyses from exploratory deviations.
Failure to consider: A fluent summary can convert an association into a causal claim, omit exclusions, or invent a citation. Style does not validate the underlying analysis.
Report the target, the numerical result with its units, the relevant uncertainty, and one limitation. Distinguish what is established by the simulation from what would require real data.
AI audit: critique the saved faulty claim in the companion exercise before using any live assistant. If you use AI, record the relevant suggestion, your independent check, and the final decision.
Communicate the preceding audit and invite independent scrutiny in the final chapter.
sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS 15.7.7
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
locale:
[1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] fansi_1.0.3 crayon_1.5.1 digest_0.6.29
[4] utf8_1.2.2 IRdisplay_1.1 repr_1.1.4
[7] lifecycle_1.0.1 jsonlite_1.8.0 evaluate_0.15
[10] pillar_1.8.0 rlang_1.0.6 cli_3.3.0
[13] uuid_1.1-0 vctrs_0.4.1 IRkernel_1.3.0.9000
[16] tools_4.2.1 glue_1.6.2 fastmap_1.1.0
[19] compiler_4.2.1 base64enc_0.1-3 pbdZMQ_0.3-7
[22] htmltools_0.5.3