Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ site_libs/


**/*.quarto_ipynb
.claude/settings.local.json
data/emotikon.rds
data/fggk21_Child.arrow
data/fggk21_Score.arrow
data/fggk21.arrow
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SMLP2026"
uuid = "2d4e6da2-0493-4b51-b329-ae5cd97e516e"
authors = ["Phillip Alday <me@phillipalday.com>", "Douglas Bates <dmbates@gmail.com>", "Reinhold Kliegl <reinhold.kliegl@gmail.com>"]
version = "1.0.0"
authors = ["Phillip Alday <me@phillipalday.com>", "Douglas Bates <dmbates@gmail.com>", "Reinhold Kliegl <reinhold.kliegl@gmail.com>"]

[deps]
AlgebraOfGraphics = "cbdf2221-f076-402e-a563-3d30da359d67"
Expand Down Expand Up @@ -34,6 +34,7 @@ MixedModelsSim = "d5ae56c5-23ca-4a1f-b505-9fc4796fc1fe"
PooledArrays = "2dfb63ee-cc39-5dd5-95bd-886bf059d720"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
RData = "df47a6cb-8c03-5eed-afd8-b6050d6c41da"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
RegressionFormulae = "545c379f-4ec2-4339-9aea-38f2fb6a8ba2"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Expand Down Expand Up @@ -66,6 +67,7 @@ MixedModelsMakie = "0.4"
MixedModelsSerialization = "0.2"
MixedModelsSim = "0.2.7"
RCall = "0.14"
RData = "1.1.0"
Random = "1"
RegressionFormulae = "0.1.3"
StableRNGs = "1.0.3"
Expand Down
5 changes: 4 additions & 1 deletion _metadata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
author: "Phillip Alday, Douglas Bates, and Reinhold Kliegl"
author:
- "Phillip Alday"
- "Douglas Bates"
- "Reinhold Kliegl"
format:
html:
toc: true
Expand Down
113 changes: 64 additions & 49 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ project:
execute-dir: project
output-dir: _build/
render:
- about.qmd
- AoGPlots.qmd
- arrow.qmd
- bootstrap.qmd
- check_emotikon_transform.qmd
- contrasts_fggk21.qmd
- contrasts_kwdyz11.qmd
- fggk21.qmd
- glmm.qmd
- index.qmd
- kb07.qmd
- kkl15.qmd
- kwdyz11.qmd
- largescaledesigned.qmd
- mrk17.qmd
- partial_within.qmd
- pkg.qmd
- profiling.qmd
- selection.qmd
- shrinkageplot.qmd
- singularity.qmd
- sleepstudy.qmd
- sleepstudy_speed.qmd
- transformation.qmd
- useful_packages.qmd
- getting-started/about.qmd
- getting-started/useful_packages.qmd
- getting-started/pkg.qmd
- getting-started/arrow.qmd
- lmm-intro/sleepstudy.qmd
- lmm-intro/singularity.qmd
- model-specification/partial_within.qmd
- model-specification/mrk17.qmd
- model-specification/largescaledesigned.qmd
- contrasts/transformation.qmd
- contrasts/contrasts_fggk21.qmd
- contrasts/contrasts_kwdyz11.qmd
- contrasts/sleepstudy_speed.qmd
- inference/bootstrap.qmd
- inference/profiling.qmd
- inference/kb07.qmd
- inference/power_simulation.qmd
- glmm/glmm.qmd
- visualization/shrinkageplot.qmd
- visualization/AoGPlots.qmd
- examples/emotikon/fggk21.qmd
- examples/emotikon/check_emotikon_transform.qmd
- examples/visual-attention/kwdyz11.qmd
- examples/visual-attention/kkl15.qmd

# editor_options:
# chunk_output_type: console
Expand Down Expand Up @@ -84,33 +84,48 @@ website:
search: true
collapse-level: 1
contents:
- section: "Getting started with Julia"
- section: "Getting Started"
contents:
- useful_packages.qmd
- pkg.qmd
- arrow.qmd
- section: "Worked examples"
- index.qmd
- getting-started/about.qmd
- getting-started/useful_packages.qmd
- getting-started/pkg.qmd
- getting-started/arrow.qmd
- section: "Introduction to Linear Mixed Models"
contents:
- sleepstudy.qmd
- sleepstudy_speed.qmd
- kwdyz11.qmd
- kkl15.qmd
- largescaledesigned.qmd
- mrk17.qmd
- partial_within.qmd
- section: "Contrast coding and transformations"
- lmm-intro/sleepstudy.qmd
- lmm-intro/singularity.qmd
- section: "Model Specification and Random Effects"
contents:
- contrasts_fggk21.qmd
- contrasts_kwdyz11.qmd
- transformation.qmd
- glmm.qmd
- section: "Bootstrap and profiling"
- model-specification/partial_within.qmd
- model-specification/mrk17.qmd
- model-specification/largescaledesigned.qmd
- section: "Contrast Coding and Transformations"
contents:
- bootstrap.qmd
- profiling.qmd
- kb07.qmd
- section: "Visualizations and diagnostics"
- contrasts/transformation.qmd
- contrasts/contrasts_fggk21.qmd
- contrasts/contrasts_kwdyz11.qmd
- contrasts/sleepstudy_speed.qmd
- section: "Inference: Uncertainty Quantification"
contents:
- singularity.qmd
- shrinkageplot.qmd
- AoGPlots.qmd
- inference/bootstrap.qmd
- inference/profiling.qmd
- inference/kb07.qmd
- inference/power_simulation.qmd
- section: "Generalized Linear Mixed Models"
contents:
- glmm/glmm.qmd
- section: "Visualization and Diagnostics"
contents:
- visualization/shrinkageplot.qmd
- visualization/AoGPlots.qmd
- section: "Extended Worked Examples"
contents:
- section: "The Emotikon Project"
contents:
- examples/emotikon/fggk21.qmd
- examples/emotikon/check_emotikon_transform.qmd
- section: "Visual Attention Experiments"
contents:
- examples/visual-attention/kwdyz11.qmd
- examples/visual-attention/kkl15.qmd
5 changes: 0 additions & 5 deletions about.qmd

This file was deleted.

3 changes: 1 addition & 2 deletions contrasts_fggk21.qmd → contrasts/contrasts_fggk21.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,10 @@ using ProgressMeter
using StableRNGs
using Statistics
using StatsBase

using MixedModels: likelihoodratiotest
using SMLP2026: dataset

progress = isinteractive()
const progress = isinteractive()
```

```{julia}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sleepstudy_speed.qmd → contrasts/sleepstudy_speed.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "The sleepstudy: Speed - for a change ..."
title: "The Belenky Sleep Study: Speed Metrics and Between-Group Comparisons"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions data/fggk21.arrow

This file was deleted.

3 changes: 0 additions & 3 deletions data/fggk21_Child.arrow

This file was deleted.

3 changes: 0 additions & 3 deletions data/fggk21_Score.arrow

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Transformed and original metrics in Emotikon
title: "Emotikon: Comparing Original and Transformed Metrics"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
Expand All @@ -25,7 +25,7 @@ using DataFrameMacros
using MixedModels
using MixedModelsMakie
using RCall
using SMLP2026: dataset
using SMLP2026: dataset, FITSDIR
using Serialization
using StatsBase
```
Expand All @@ -44,13 +44,6 @@ describe(dat)

### Data and figure with z-scores based on original metric

```{julia}
# dat_om = rcopy(R"readRDS('./data/fggk21_om.rds')"); #Don't know what the _om is
# @transform!(dat_om, :a1 = :age - 8.5);
# select!(groupby(dat_om, :Test), :, :score => zscore => :zScore);
# describe(dat_om)
```

## LMMs

### Contrasts
Expand Down Expand Up @@ -80,7 +73,7 @@ f1 = @formula zScore ~

```{julia}
m1x = LinearMixedModel(f1, dat; contrasts)
restoreoptsum!(m1x, "./fits/fggk21_m1_optsum.json")
restoreoptsum!(m1x, joinpath(FITSDIR, "fggk21_m1_optsum.json"))
```

```{julia}
Expand All @@ -91,22 +84,22 @@ VarCorr(m1x)

- Command for fitting LMM m1_om = fit(MixedModel, f1, dat_om, contrasts=contr)
- Minimizing 10502 Time: 0 Time: 2:09:40 ( 0.74 s/it)
- Store with: julia> saveoptsum("./fits/fggk21_m1_om_optsum.json", m1_om)
- Only for short-term and when desperate: julia> serialize("./fits/m1_om.jls", m1_om);
- Store with: julia> saveoptsum(joinpath(FITSDIR, "fggk21_m1_om_optsum.json"), m1_om)
- Only for short-term and when desperate: julia> serialize(joinpath(FITSDIR, "m1_om.jls"), m1_om);

#### ... restoreoptsum!()

```{julia}
#| eval: false
m1_om = LinearMixedModel(f1, dat; contrasts);
restoreoptsum!(m1_om, "./fits/fggk21_m1_om_optsum.json");
restoreoptsum!(m1_om, joinpath(FITSDIR, "fggk21_m1_om_optsum.json"));
```

#### ... deserialize()

```{julia}
#| eval: false
m1x_om = deserialize("./fits/m1_om.jls")
m1x_om = deserialize(joinpath(FITSDIR, "m1_om.jls"))
```

```{julia}
Expand Down
16 changes: 11 additions & 5 deletions fggk21.qmd → examples/emotikon/fggk21.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Basics with Emotikon Project
title: "The Emotikon Project: Model Complexification and PCA"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
Expand Down Expand Up @@ -34,9 +34,9 @@ using MixedModelsMakie: simplelinreg
using Random
using Statistics
using StatsBase
using SMLP2026: dataset, fit_or_restore
using SMLP2026: dataset, fit_or_restore, DATADIR

const progress=false
const progress = isinteractive()
```

# Readme
Expand Down Expand Up @@ -849,7 +849,7 @@ bic(m1) # objective(m1) + dof(m1)*log(nobs(m1))
```
+ julia> coeftable(m1) # StatsBase.coeftable: fixed-effects statiscs;
default level=0.95
+ julia> Arrow.write("./data/m_cpx_fe.arrow", DataFrame(coeftable(m1)));
+ julia> Arrow.write(joinpath(DATADIR, "m_cpx_fe.arrow"), DataFrame(coeftable(m1)));
+ julia> coef(m1) # StatsBase.coef - parts of the table
+ julia> fixef(m1) # MixedModels.fixef: not the same as coef()
for rank-deficient case
Expand All @@ -865,7 +865,7 @@ coeftable(m1) # StatsBase.coeftable: fixed-effects statiscs; default level=0.95
```

```{julia}
#Arrow.write("./data/m_cpx_fe.arrow", DataFrame(coeftable(m1)));
#Arrow.write(joinpath(DATADIR, "m_cpx_fe.arrow"), DataFrame(coeftable(m1)));
```

```{julia}
Expand Down Expand Up @@ -1009,6 +1009,12 @@ shrinkageplot!(Figure(; size=(800, 800)), m1, :Cohort)
shrinkageplot!(Figure(; size=(800, 800)), m2, :Cohort)
```

## See Also

- [Mixed Models Tutorial: Contrast Coding](../../contrasts/contrasts_fggk21.qmd) — applies a full range of contrast schemes (effect, Helmert, hypothesis, PCA-based) to the same Emotikon dataset.
- [Emotikon: Comparing Original and Transformed Metrics](check_emotikon_transform.qmd) — investigates whether the age × Sex × Test interaction changes when tasks are analyzed in their original time metric rather than speed.
- [Creating Multi-Panel Plots](../../visualization/AoGPlots.qmd) — reproduces the publication figure from @Fuehner2021 using AlgebraOfGraphics.

::: {#refs}
:::

Expand Down
2 changes: 1 addition & 1 deletion kkl15.qmd → examples/visual-attention/kkl15.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: 'RePsychLing Kliegl, Kuschela, & Laubrock (2015)- Reduction of Model Complexity'
title: "Visual Attention: Replication and Model Reduction (Kliegl et al., 2015)"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
Expand Down
7 changes: 6 additions & 1 deletion kwdyz11.qmd → examples/visual-attention/kwdyz11.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "RePsychLing Kliegl et al. (2011)"
title: "Visual Attention Effects: Kliegl et al. (2011)"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
Expand Down Expand Up @@ -398,6 +398,11 @@ First, the correlation between GM and the spatial effect is well defined.
Second, as discussed throughout this script, the CP between spatial and attraction effect is close to the 1.0 border and clearly not well defined.
Therefore, this CP will be replicated with a larger sample in script `kkl15.jl` [@Kliegl2015].

# See Also

- [Visual Attention: Replication and Model Reduction (Kliegl et al., 2015)](kkl15.qmd) — direct replication and follow-up of this experiment, with an additional focus on reducing model complexity.
- [Contrast Coding of Visual Attention Effects](../../contrasts/contrasts_kwdyz11.qmd) — applies _a priori_ contrast coding to this same dataset to test theoretically motivated hypotheses.

# References

::: {#refs}
Expand Down
4 changes: 2 additions & 2 deletions fits/partial_within_m0.json.zip
Git LFS file not shown
4 changes: 2 additions & 2 deletions fits/partial_within_m1.json.zip
Git LFS file not shown
3 changes: 3 additions & 0 deletions fits/power_simulation_fm1.json.zip
Git LFS file not shown
Loading
Loading