Investigation: What is a theory?#
A theory constrains possible explanations of a phenomenon. A computational implementation exposes those constraints, but fitting existing observations does not uniquely identify the underlying mechanism. Useful theory comparison asks where predictions diverge.
Question. Compare linear and saturating accounts of practice effects. They can look similar over a narrow range of practice but disagree outside it.
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)
practice <- seq(0, 2, length.out=25)
linear <- function(x) 700 - 40*x
saturating <- function(x) 700 - 100*(1-exp(-.5*x))
observed <- saturating(practice) + rnorm(length(practice),0,12)
plot(practice, observed, xlab="Practice (arbitrary units)", ylab="Reaction time (ms)")
lines(practice,linear(practice),lty=2)
lines(practice,saturating(practice),lty=1)
legend("topright", c("Linear candidate","Saturating candidate"),lty=c(2,1))
Choose a discriminating condition#
These functions are prespecified candidates, not fitted estimates. Compare their predictions before generating new observations. Ask whether extending practice changes fatigue, strategy, or the measurement itself.
new_practice <- seq(0,10,length.out=100)
matplot(new_practice,cbind(linear(new_practice),saturating(new_practice)),type="l",lty=c(2,1),col=c("black","blue"),xlab="Practice",ylab="Predicted reaction time (ms)")
data.frame(practice=c(2,6,10), linear=linear(c(2,6,10)), saturating=saturating(c(2,6,10)))
Interpret and verify#
Design a new observation that distinguishes the candidate theories before inspecting its result.
Failure to consider: Extrapolation may discriminate theories only if the new condition is scientifically meaningful and the measurement remains comparable.
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.
Use openness to record where each prediction came from; turn the prediction into a testable model next.
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