From f029510984f27b81cb107dad01f10eabf764be4d Mon Sep 17 00:00:00 2001 From: nwickel Date: Fri, 9 Jan 2026 17:16:31 +0100 Subject: [PATCH] Update title in README; rebuild --- 01_intro/powersim-intro.pdf | Bin 750187 -> 750187 bytes 03_anova/powersim-anova.md | 4 ++-- 04_ancova/exercises-ancova2.md | 18 ++++++++---------- 04_ancova/intro-ancova.pdf | Bin 198693 -> 198693 bytes 05_mixed1/intro-lmm.pdf | Bin 252642 -> 252642 bytes 05_mixed1/powersim-lmm.md | 4 ++-- 06_mixed2/exercises-datsimlmm.md | 10 +++++----- 06_mixed2/intro-datsimlmm.pdf | Bin 175851 -> 175851 bytes README.md | 3 +-- 9 files changed, 18 insertions(+), 21 deletions(-) diff --git a/01_intro/powersim-intro.pdf b/01_intro/powersim-intro.pdf index 9531ec00cbf272c9f68e7d1352a1e3386219a5c8..bb2ddc4c7d9c41e755d08f950a917e1e075d97c1 100644 GIT binary patch delta 128 zcmaF;MECU*-G&y%7N!>F7M2#)7Pc1l7LFFq7OpMaS5sNd4UG*=rr%2CmV+?2|4rpS y&gSf9X<_bS;A&}MU~J&#Y+>$dWNd0+X6Wqd=xpw4Y~p68U_(gBcJ^HE6jlHhl_TQ- delta 128 zcmaF;MECU*-G&y%7N!>F7M2#)7Pc1l7LFFq7OpMaS5sNdOiWD8rr%2CmV+?2|4rpS y&gSfB>SpO;?rP#>X=>=|;%MMzZei+XWNGZ^;^<^)WMFEiU_(gBcJ^HE6jlH#UL-95 diff --git a/03_anova/powersim-anova.md b/03_anova/powersim-anova.md index 5e5761d..e518c24 100644 --- a/03_anova/powersim-anova.md +++ b/03_anova/powersim-anova.md @@ -35,7 +35,7 @@ dat <- data.frame( A = factor(rep(1:2, each = n/2), labels = c("low", "high")), B = factor(rep(rep(1:2, each = n/4), 2), labels = c("low", "high")) ) -X <- model.matrix(~ A*B, dat) +X <- model.matrix(~ A * B, dat) unique(X) ``` @@ -73,7 +73,7 @@ boxplot(t(out)) ``` r pval <- replicate(2000, { y <- means + rnorm(n, sd = 10) - m <- aov(y ~ A*B, dat) + m <- aov(y ~ A * B, dat) summary(m)[[1]]$"Pr(>F)"[3] # test of interaction }) mean(pval < 0.05) diff --git a/04_ancova/exercises-ancova2.md b/04_ancova/exercises-ancova2.md index 8a26156..7ba5699 100644 --- a/04_ancova/exercises-ancova2.md +++ b/04_ancova/exercises-ancova2.md @@ -4,9 +4,7 @@ measurements ## MASS anorexia data -1. Analyze the original data: - - In R, see ?MASS::anorexia - - Data preparation +Data preparation ``` r data(anorexia, package = "MASS") @@ -20,11 +18,13 @@ lattice::xyplot(Postwt ~ Prewt, dat, groups = Treat, type = c("g", "r", "p"), auto.key = TRUE) ``` -- Estimate the average treatment effect (ATE) for FT relative to CBT. -- What is the 95% CI for the ATE? -- What are the pre- and post-weight means for the two groups? -- What are the baseline-adjusted means for the two groups? - +1. Analyze the original data: + - In R, see ?MASS::anorexia + - Estimate the average treatment effect (ATE) for FT relative to + CBT. + - What is the 95% CI for the ATE? + - What are the pre- and post-weight means for the two groups? + - What are the baseline-adjusted means for the two groups? 2. Run a power simulation for a replication study: - Draw plausible pre-weights. - Specify the minimum relevant effect. @@ -41,5 +41,3 @@ lattice::xyplot(Postwt ~ Prewt, dat, groups = Treat, - the R code, output, and plots (if any) Render the R or Rmd file to HTML. - -### Reference diff --git a/04_ancova/intro-ancova.pdf b/04_ancova/intro-ancova.pdf index c9da59d5d5021e651820dfcc5d2da124af70d085..c8581d8a045bf4848ea3d7f14a4faf90f2c9c80f 100644 GIT binary patch delta 109 zcmZ2FfoJIio`x327N#l8U99GY#zqEH`IGLH4m^v9c8@Za8n>m}B fx;h%0n;Td-o4FdexSE*SDcBHFvi%e*b2JkGTFx8n delta 109 zcmZ2FfoJIio`x327N#l8U94s%rUph+`pqnopxf(;=h+oP{Dw=)9()tDe- diff --git a/05_mixed1/powersim-lmm.md b/05_mixed1/powersim-lmm.md index a0fc3b9..c6b596b 100644 --- a/05_mixed1/powersim-lmm.md +++ b/05_mixed1/powersim-lmm.md @@ -3,8 +3,8 @@ Power for mixed-effects models Last modified: 2026-01-09 ``` r -library(lattice) -library(lme4) +library("lattice") +library("lme4") ``` # Reanalysis diff --git a/06_mixed2/exercises-datsimlmm.md b/06_mixed2/exercises-datsimlmm.md index aa653f4..d8e26d0 100644 --- a/06_mixed2/exercises-datsimlmm.md +++ b/06_mixed2/exercises-datsimlmm.md @@ -8,8 +8,8 @@ Exercises: Data simulation for crossed random-effects models “manually” ``` r -library(lattice) -library(lme4) +library("lattice") +library("lme4") #--------------- (1) Create data frame ---------------------------------------- datsim <- expand.grid(subject = factor(c("s1" , "s2" , "s3" )), @@ -40,9 +40,9 @@ e <- rnorm(18, mean = 0, sd = se) sig <- matrix(c(sy0^2, ry * sy0 * sy1, ry * sy0 * sy1, sy1^2), 2, 2) y01 <- MASS::mvrnorm(3, mu = c(0, 0), Sigma = sig) y0 <- rep(y01[,1], each = 6) -y1 <- rep(c(0, y01[1,2], - 0, y01[2,2], - 0, y01[3,2]), each = 3) +y1 <- rep(c(0, y01[1, 2], + 0, y01[2, 2], + 0, y01[3, 2]), each = 3) datsim$rt <- b0 + b1 + w + y0 + y1 + e diff --git a/06_mixed2/intro-datsimlmm.pdf b/06_mixed2/intro-datsimlmm.pdf index c7aef9ce770b0eb618f1ddeed89ea1904d315b8b..ba3dd91dc5b692e796042f2a19cef49990bcee50 100644 GIT binary patch delta 109 zcmaETm+SRiu7(!IElkzRS