Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
weGotThePower
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ben Anderson
weGotThePower
Commits
4b7257a6
Commit
4b7257a6
authored
6 years ago
by
Ben Anderson
Browse files
Options
Downloads
Patches
Plain Diff
removed stuff, fixed t test model outputs using broom to tidy
parent
40cd1e7b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
placeholder.jpg
+0
-0
0 additions, 0 deletions
placeholder.jpg
sizingDemandResponseTrialsNZ.Rmd
+34
-11
34 additions, 11 deletions
sizingDemandResponseTrialsNZ.Rmd
sizingDemandResponseTrialsNZ.docx
+0
-0
0 additions, 0 deletions
sizingDemandResponseTrialsNZ.docx
with
34 additions
and
11 deletions
placeholder.jpg
deleted
100644 → 0
+
0
−
0
View file @
40cd1e7b
19.8 KiB
This diff is collapsed.
Click to expand it.
sizingDemandResponseTrialsNZ.Rmd
+
34
−
11
View file @
4b7257a6
...
...
@@ -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_statPowerEsts80
p0.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]]
...
...
This diff is collapsed.
Click to expand it.
sizingDemandResponseTrialsNZ.docx
deleted
100644 → 0
+
0
−
0
View file @
40cd1e7b
File deleted
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment