diff --git a/placeholder.jpg b/placeholder.jpg deleted file mode 100644 index d5c08e0478838ec5c0a5b48b9b1ee561bd33a9e7..0000000000000000000000000000000000000000 Binary files a/placeholder.jpg and /dev/null differ diff --git a/sizingDemandResponseTrialsNZ.Rmd b/sizingDemandResponseTrialsNZ.Rmd index 8d2a607efcee9351f83150f8e3d3b4b83b39609d..e1023591eb57587528fc7b1716a7c8491db94297 100644 --- a/sizingDemandResponseTrialsNZ.Rmd +++ b/sizingDemandResponseTrialsNZ.Rmd @@ -9,10 +9,6 @@ author: '`r paste0(params$author)` (Contact: b.anderson@soton.ac.uk, `@dataknut` date: 'Last run at: `r Sys.time()`' always_allow_html: yes output: - bookdown::word_document2: - fig_caption: yes - toc: yes - toc_depth: 2 bookdown::html_document2: code_folding: hide fig_caption: yes @@ -22,6 +18,10 @@ output: toc: yes toc_depth: 2 toc_float: yes + bookdown::word_document2: + fig_caption: yes + toc: yes + toc_depth: 2 bookdown::pdf_document2: fig_caption: yes keep_tex: yes @@ -50,6 +50,7 @@ rmdLibs <- c("data.table", # data munching "lubridate", # for today "SAVEr", # power stats functions "GREENGridData", + "broom", # tidy test results "knitr" # for kable ) # load them @@ -212,7 +213,7 @@ p <- p + p -ggplot2::ggsave("figs/fig1_statPowerEsts80.png", p) +ggplot2::ggsave("figs/fig1_statPowerEsts80p0.05.png", p) ``` @@ -247,9 +248,6 @@ p <- p + label = paste0("Effect size = ", round(y005, 2) ,"% with \n p = 0.05, power = 0.8 and n = 1000"), hjust = 0) # https://stackoverflow.com/questions/26684023/how-to-left-align-text-in-annotate-from-ggplot2 -p - -ggplot2::ggsave("figs/fig1_statPowerEsts80.png", p) # add vline at 0.01 effect size for p = 0.05, n = 1000 p001Ref <- powerRes80DT[pValue == "p = 0.01" & effectSize < ceiling(p005Ref$effectSize) & @@ -274,6 +272,8 @@ x02 <- mean(p02Ref$sampleN) p <- p + geom_segment(x = x02, y = y005, xend = x02, yend = 0, alpha = vLineAlpha, colour = cbPalette[4]) p + +ggplot2::ggsave("figs/fig2_statPowerEsts80All.png", p) ``` Full table of results: @@ -343,7 +343,14 @@ T test group 1 # we are going to compare winter with summer to get a large effect. This is not what we would really do as it is a repeat measures dataset but this is irrelevant for our current purposes. tTest <- t.test(testDT[group == "Intervention 1"]$meanW, testDT[group == "Control"]$meanW) -tTest + +tTestTidy <- broom::tidy(tTest) +tTestTidy$`Control mean` <- tTestTidy$estimate2 +tTestTidy$`Group 1 mean` <- tTestTidy$estimate1 +tTestTidy$`Mean difference` <- tTestTidy$estimate + +knitr::kable(tTestTidy[c("Control mean", "Group 1 mean", "Mean difference", + "statistic", "p.value", "conf.low", "conf.high")], caption = "T test results (Group 1 vs Control)") controlW <- tTest$estimate[[2]] intW <- tTest$estimate[[1]] @@ -365,7 +372,15 @@ T test Group 2 # now compare winter & spring for a smaller effect tTest <- t.test(testDT[group == "Intervention 2"]$meanW, testDT[group == "Control"]$meanW) -tTest + +tTestTidy <- broom::tidy(tTest) +tTestTidy$`Control mean` <- tTestTidy$estimate2 +tTestTidy$`Group 2 mean` <- tTestTidy$estimate1 +tTestTidy$`Mean difference` <- tTestTidy$estimate + +knitr::kable(tTestTidy[c("Control mean", "Group 2 mean", "Mean difference", + "statistic", "p.value", "conf.low", "conf.high")], caption = "T test results (Group 2 vs Control)") + controlW <- tTest$estimate[[2]] intW <- tTest$estimate[[1]] cil <- tTest$conf.int[[1]] @@ -429,7 +444,15 @@ re-run T tests Group 1 # now compare winter & spring for a smaller effect tTest <- t.test(largeTestDT[group == "Intervention 2"]$meanW, largeTestDT[group == "Control"]$meanW) -tTest + +tTestTidy <- broom::tidy(tTest) +tTestTidy$`Control mean` <- tTestTidy$estimate2 +tTestTidy$`Group 1 mean` <- tTestTidy$estimate1 +tTestTidy$`Mean difference` <- tTestTidy$estimate + +knitr::kable(tTestTidy[c("Control mean", "Group 1 mean", "Mean difference", + "statistic", "p.value", "conf.low", "conf.high")], caption = "T test results (Group 1 vs Control)") + controlW <- tTest$estimate[[2]] intW <- tTest$estimate[[1]] cil <- tTest$conf.int[[1]] diff --git a/sizingDemandResponseTrialsNZ.docx b/sizingDemandResponseTrialsNZ.docx deleted file mode 100644 index e0314cf509ee2dfcec001f5b9c5f6da54cb61e2f..0000000000000000000000000000000000000000 Binary files a/sizingDemandResponseTrialsNZ.docx and /dev/null differ