diff --git a/AoGPlots.qmd b/AoGPlots.qmd index 75194da..68c16c7 100644 --- a/AoGPlots.qmd +++ b/AoGPlots.qmd @@ -4,7 +4,7 @@ title: "Creating multi-panel plots" This notebook shows creating a multi-panel plot similar to Figure 2 of @Fuehner2021. -The data are available from the SMLP2023 example datasets. +The data are available from the SMLP2024 example datasets. ```{julia} #| code-fold: true @@ -14,7 +14,7 @@ using CairoMakie # for displaying static plots using DataFrames using Statistics using StatsBase -using SMLP2023: dataset +using SMLP2024: dataset CairoMakie.activate!(; type="svg") # use SVG (other options include PNG) ``` diff --git a/Project.toml b/Project.toml index 585a4c9..a7ad007 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ -name = "SMLP2023" -uuid = "dc5ec7c6-28fd-4523-b102-f28df6bb352f" -authors = ["Phillip Alday ", "Douglas Bates ", "Reinhold Kliegl ", "Julius Krumbiegel "] +name = "SMLP2024" +uuid = "3c8ca5f6-7797-4ff8-8247-191023d8f95a" +authors = ["Phillip Alday ", "Douglas Bates ", "Reinhold Kliegl "] version = "0.1.0" [deps] diff --git a/README.md b/README.md index 347ec91..8b64b6f 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -# SMLP2023 +# SMLP2024 -SMLP2023: Advanced methods in frequentist statistics with Julia +SMLP2024: Advanced methods in frequentist statistics with Julia -The rendered website version of the course materials is available [here](https://repsychling.github.io/SMLP2023/). +The rendered website version of the course materials is available [here](https://repsychling.github.io/SMLP2024/). This repository uses [Quarto](https://quarto.org). To be able to render all the pages, you will need an appropriate Jupyter kernel installed and the local environment instantiated. ```sh -~/SMLP2023$ julia +~/SMLP2024$ julia julia> using Pkg @@ -23,14 +23,14 @@ julia> installkernel("julia", "--threads=auto", "--project=@.") "~/.local/share/jupyter/kernels/julia-1.9" julia> Pkg.activate(".") - Activating project at `~/SMLP2023` + Activating project at `~/SMLP2024` julia> Pkg.instantiate() < lots of output > julia> exit() -~/SMLP2023$ quarto preview +~/SMLP2024$ quarto preview < lots of output > diff --git a/_quarto.yml b/_quarto.yml index c172257..f1dfe1a 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -1,6 +1,6 @@ project: type: website - title: "SMLP2023" + title: "SMLP2024" execute-dir: project output-dir: _build/ render: @@ -56,9 +56,9 @@ format: fig-height: 6 website: - title: "SMLP2023: Advanced Frequentist Track" - site-url: https://RePsychLing.github.io/SMLP2023 - repo-url: https://github.com/RePsychLing/SMLP2023 + title: "SMLP2024: Advanced Frequentist Track" + site-url: https://RePsychLing.github.io/SMLP2024 + repo-url: https://github.com/RePsychLing/SMLP2024 repo-actions: [edit, issue] # reader-mode: true navbar: @@ -69,7 +69,7 @@ website: # - about.qmd right: - icon: github - href: https://github.com/RePsychLing/SMLP2023 + href: https://github.com/RePsychLing/SMLP2024 page-navigation: true back-to-top-navigation: true sidebar: diff --git a/arrow.qmd b/arrow.qmd index be1d8e1..4e90a05 100644 --- a/arrow.qmd +++ b/arrow.qmd @@ -11,7 +11,7 @@ The columns can be of different types including numeric values, character string An Arrow file can be read or written from R, Python, Julia and many other languages. Somewhat confusingly in R and Python the name `feather`, which refers to an earlier version of the storage format, is used in some function names like `read_feather`. -Internally, the SMLP2023 package uses Arrow to store all of its datasets. +Internally, the SMLP2024 package uses Arrow to store all of its datasets. # The Emotikon data diff --git a/bootstrap.qmd b/bootstrap.qmd index b443e75..7c3609b 100644 --- a/bootstrap.qmd +++ b/bootstrap.qmd @@ -36,7 +36,7 @@ using DataFrames using MixedModels using MixedModelsMakie using Random -using SMLP2023: dataset +using SMLP2024: dataset using AlgebraOfGraphics: AlgebraOfGraphics as AoG CairoMakie.activate!(; type="svg") # use SVG (other options include PNG) diff --git a/contrasts_fggk21.qmd b/contrasts_fggk21.qmd index 8f98798..8401d6f 100644 --- a/contrasts_fggk21.qmd +++ b/contrasts_fggk21.qmd @@ -45,7 +45,7 @@ using DataFrames using DataFrameMacros using MixedModels using ProgressMeter -using SMLP2023: dataset +using SMLP2024: dataset using Statistics using StatsBase diff --git a/contrasts_kwdyz11.qmd b/contrasts_kwdyz11.qmd index 7f64b88..27b34d8 100644 --- a/contrasts_kwdyz11.qmd +++ b/contrasts_kwdyz11.qmd @@ -8,7 +8,7 @@ jupyter: julia-1.9 using Chain using DataFrames using MixedModels -using SMLP2023: dataset +using SMLP2024: dataset using StatsBase using StatsModels diff --git a/fggk21.qmd b/fggk21.qmd index c77dd62..fc46f96 100644 --- a/fggk21.qmd +++ b/fggk21.qmd @@ -33,7 +33,7 @@ using ProgressMeter using Random using Statistics using StatsBase -using SMLP2023: dataset +using SMLP2024: dataset ProgressMeter.ijulia_behavior(:clear) CairoMakie.activate!(; type="svg") diff --git a/glmm.qmd b/glmm.qmd index c596e1d..f7d16d8 100644 --- a/glmm.qmd +++ b/glmm.qmd @@ -14,7 +14,7 @@ using DataFrameMacros using DataFrames using MixedModels using MixedModelsMakie -using SMLP2023: dataset +using SMLP2024: dataset CairoMakie.activate!(; type="svg") diff --git a/index.qmd b/index.qmd index cdf1b45..b3f5288 100644 --- a/index.qmd +++ b/index.qmd @@ -4,7 +4,7 @@ subtitle: "Advanced methods in frequentist statistics with Julia" author: "Phillip Alday, Reinhold Kliegl and Douglas Bates" --- -This site provides materials for the **Advanced frequentist methods** stream of the [Summer School on Statistical Methods](https://vasishth.github.io/smlp2023/) to be held at the University of Potsdam, 11-15 September, 2023. +This site provides materials for the **Advanced frequentist methods** stream of the [Summer School on Statistical Methods](https://vasishth.github.io/smlp2024/) to be held at the University of Potsdam, 11-15 September, 2024. # Installation of tools prior to the course @@ -16,11 +16,11 @@ Because most students in the course will have more experience with [R](https://r We will assume that you have git installed and are able to clone a repository from github. If not, [Happy Git with R](https://happygitwithr.com/) is a good place to learn about git for data science. -This website is built using [quarto](https://quarto.org), described below, from the [repository](https://github.com/RePsychLing/SMLP2023). +This website is built using [quarto](https://quarto.org), described below, from the [repository](https://github.com/RePsychLing/SMLP2024). Clone this repository with, e.g. ```sh -git clone https://github.com/RePsychLing/SMLP2023 +git clone https://github.com/RePsychLing/SMLP2024 ``` ## Julia Programming Language diff --git a/kb07.qmd b/kb07.qmd index f58dd32..f8ee0ee 100644 --- a/kb07.qmd +++ b/kb07.qmd @@ -14,7 +14,7 @@ using DataFrames using MixedModels using ProgressMeter using Random -using SMLP2023: dataset +using SMLP2024: dataset CairoMakie.activate!(; type="svg") diff --git a/kkl15.qmd b/kkl15.qmd index b60e7e7..f218af6 100644 --- a/kkl15.qmd +++ b/kkl15.qmd @@ -15,9 +15,9 @@ This comparison is of interest because a few years after the publication of @Kli Here we also include two additional experimental manipulations of target size and orientation of cue rectangle. A similar analysis was reported in the parsimonious mixed-model paper [@Bates2015]; it was also used in a paper of GAMMs [@Baayen2017]. Data and R scripts of those analyses are also available in [R-package RePsychLing](https://github.com/dmbates/RePsychLing/tree/master/data/). -The analysis is based on log-transformed reaction times `lrt`, indicated by a _boxcox()_ check of model residuals. +The analysis is based on log-transformed reaction times `lrt`, indicated by a _boxcox()_ check of model residuals. -In this vignette we focus on the reduction of model complexity. And we start with a quote: +In this vignette we focus on the reduction of model complexity. And we start with a quote: “Neither the [maximal] nor the [minimal] linear mixed models are appropriate for most repeated measures analysis. Using the [maximal] model is generally wasteful and costly in terms of statiscal power for testing hypotheses. On the other hand, the [minimal] model fails to account for nontrivial correlation among repeated measurements. This results in inflated [T]ype I error rates when non-negligible correlation does in fact exist. We can usually find middle ground, a covariance model that adequately accounts for correlation but is more parsimonious than the [maximal] model. Doing so allows us full control over [T]ype I error rates without needlessly sacrificing power.” @@ -41,7 +41,7 @@ using MixedModels using MixedModelsMakie using ProgressMeter using Random -using SMLP2023: dataset +using SMLP2024: dataset using StatsBase ProgressMeter.ijulia_behavior(:clear) @@ -135,7 +135,7 @@ contrasts = Dict( ```{julia} m_max_rt = let - form = @formula rt ~ 1 + CTR * size * cardinal + + form = @formula rt ~ 1 + CTR * size * cardinal + (1 + CTR * size * cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -143,7 +143,7 @@ end ```{julia} m_cpx_rt = let - form = @formula rt ~ 1 + CTR * size * cardinal + + form = @formula rt ~ 1 + CTR * size * cardinal + (1 + CTR + size + cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -174,7 +174,7 @@ This is the maximum LMM for the design. ```{julia} m_max = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + (1 + CTR * size * cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -201,7 +201,7 @@ Force CPs to zero. ```{julia} m_zcp1 = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + zerocorr(1 + CTR * size * cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -225,7 +225,7 @@ Take out VC for interactions. ```{julia} m_zcp1_rdc = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + zerocorr(1 + CTR + size + cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -252,7 +252,7 @@ gof_summary = let mods = eval.(nms) lrt = MixedModels.likelihoodratiotest(m_zcp1_rdc, m_zcp1, m_max) DataFrame(; - name = nms, + name = nms, dof=dof.(mods), deviance=round.(deviance.(mods), digits=0), AIC=round.(aic.(mods),digits=0), @@ -271,7 +271,7 @@ Extend zcp-reduced LMM with CPs ```{julia} m_prm1 = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + (1 + CTR + size + cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -299,7 +299,7 @@ gof_summary = let mods = eval.(nms) lrt = MixedModels.likelihoodratiotest(m_prm1, m_zcp1, m_max) DataFrame(; - name = nms, + name = nms, dof=dof.(mods), deviance=round.(deviance.(mods), digits=0), AIC=round.(aic.(mods),digits=0), @@ -319,7 +319,7 @@ Take out interaction VCs. ```{julia} m_cpx = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + (1 + CTR + size + cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -330,7 +330,7 @@ Take out interaction VCs. ```{julia} m_zcp2 = let - form = @formula log(rt) ~ 1 + CTR * size * cardinal + + form = @formula log(rt) ~ 1 + CTR * size * cardinal + zerocorr(1 + CTR + size + cardinal | Subj) fit(MixedModel, form, dat; contrasts) end @@ -344,7 +344,7 @@ gof_summary = let mods = eval.(nms) lrt = MixedModels.likelihoodratiotest(m_zcp2, m_cpx, m_max) DataFrame(; - name = nms, + name = nms, dof=dof.(mods), deviance=round.(deviance.(mods), digits=0), AIC=round.(aic.(mods),digits=0), @@ -553,7 +553,7 @@ draw( data(tbl) * mapping( [:β02, :β03, :β04] .=> "Experimental effect size [ms]"; - color=dims(1) => + color=dims(1) => renamer(["spatial effect", "object effect", "attraction effect"]) => "Experimental effects", ) * diff --git a/kwdyz11.qmd b/kwdyz11.qmd index cde2e76..32db1a6 100644 --- a/kwdyz11.qmd +++ b/kwdyz11.qmd @@ -40,7 +40,7 @@ using Distributions using MixedModels using MixedModelsMakie using Random -using SMLP2023: dataset +using SMLP2024: dataset using StatsBase CairoMakie.activate!(; type="svg") @@ -351,7 +351,7 @@ draw( data(tbl) * mapping( [:σ1, :σ2, :σ3, :σ4] .=> "Standard deviations [ms]"; - color=dims(1) => + color=dims(1) => renamer(append!(["Grand mean"],["spatial", "object", "attraction"] .* " effect")) => "Variance components", ) * diff --git a/largescaledesigned.qmd b/largescaledesigned.qmd index 7f821d5..496b69b 100644 --- a/largescaledesigned.qmd +++ b/largescaledesigned.qmd @@ -18,7 +18,7 @@ using DataFrames using Effects using MixedModels using MixedModelsMakie -using SMLP2023: dataset +using SMLP2024: dataset using StandardizedPredictors using StatsBase diff --git a/mrk17.qmd b/mrk17.qmd index 26b3ad9..1b6f0c4 100644 --- a/mrk17.qmd +++ b/mrk17.qmd @@ -12,7 +12,7 @@ using CategoricalArrays using DataFrames using MixedModels using MixedModelsMakie -using SMLP2023: dataset +using SMLP2024: dataset using Statistics: mean, std ``` @@ -118,7 +118,7 @@ using CategoricalArrays using DataFrames using MixedModels using MixedModelsMakie -using SMLP2023: dataset +using SMLP2024: dataset using Statistics: mean, std ``` diff --git a/pkg.qmd b/pkg.qmd index 3552938..e4cfc8e 100644 --- a/pkg.qmd +++ b/pkg.qmd @@ -8,7 +8,7 @@ Julia packages can be configured (in a file called `Project.toml`) on a per-proj The packaged sources and compiled versions are stored in a central location, e.g. `~/.julia/packages` and `~/.julia/compiled` on Linux systems, but the configuration of packages to be used can be local to a project. The `Pkg` package is used to modify the local project's configuration. (An alternative is "package mode" in the read-eval-print-loop or REPL, which we will show at the summer school.) -Start julia in the directory of the cloned `SMLP2023` repository +Start julia in the directory of the cloned `SMLP2024` repository ```{julia} #| eval: false using Pkg # there's a package called 'Pkg' to manipulate package configs diff --git a/profiling.qmd b/profiling.qmd index 045e9b8..c2f069e 100644 --- a/profiling.qmd +++ b/profiling.qmd @@ -31,7 +31,7 @@ using CairoMakie using MixedModels using MixedModelsMakie using Random -using SMLP2023: dataset +using SMLP2024: dataset CairoMakie.activate!(; type="svg") import ProgressMeter diff --git a/sleepstudy.qmd b/sleepstudy.qmd index 07e8ef7..57c1c37 100644 --- a/sleepstudy.qmd +++ b/sleepstudy.qmd @@ -30,14 +30,14 @@ using MixedModelsMakie # diagnostic plots using ProgressMeter using Random # random number generators using RCall # call R from Julia -using SMLP2023 -using SMLP2023: dataset +using SMLP2024 +using SMLP2024: dataset ProgressMeter.ijulia_behavior(:clear) CairoMakie.activate!(; type="svg") ``` -The `sleepstudy` data are one of the datasets available with the `MixedModels` package. It is re-exported by the `SMLP2023` package's `dataset` function. +The `sleepstudy` data are one of the datasets available with the `MixedModels` package. It is re-exported by the `SMLP2024` package's `dataset` function. ```{julia} sleepstudy = dataset("sleepstudy") diff --git a/src/SMLP2023.jl b/src/SMLP2024.jl similarity index 95% rename from src/SMLP2023.jl rename to src/SMLP2024.jl index 024b1c0..f645c3d 100644 --- a/src/SMLP2023.jl +++ b/src/SMLP2024.jl @@ -1,4 +1,4 @@ -module SMLP2023 +module SMLP2024 using Arrow using CSV @@ -101,7 +101,7 @@ const OSF_IO_URIs = Dict{String,String}( "ELP_ldt_item" => "c6gxd", "ELP_ldt_subj" => "rqenu", "ELP_ldt_trial" => "3evhy", - "fggk21_Child" => "c2fmn", + "fggk21_Child" => "c2fmn", "fggk21_Score" => "7fqx3", "fggk21" => "vwecy", "kkl15" => "p8cea", @@ -132,12 +132,12 @@ end function progress() prog = ProgressThresh(1.0; desc="Download progress: ") return function (total::Int, now::Int) - if total > 0 + if total > 0 update!(prog, now/total) if now == total finish!(prog) - end - end + end + end end end @@ -146,12 +146,12 @@ dataset(name::Symbol) = dataset(string(name)) function dataset(name::AbstractString) name in MMDS && return MixedModels.dataset(name) name in keys(OSF_IO_URIs) || - throw(ArgumentError("$(name) is not a dataset ")) + throw(ArgumentError("$(name) is not a dataset ")) f = _file(name) if !isfile(f) osfkey = OSF_IO_URIs[name] @info "Downloading $(name) dataset" - Downloads.download(string("https://osf.io/", osfkey, "/download"), f; progress=progress()) + Downloads.download(string("https://osf.io/", osfkey, "/download"), f; progress=progress()) end return Arrow.Table(f) end