diff --git a/sizingDemandResponseTrialsNZ.Rmd b/sizingDemandResponseTrialsNZ.Rmd index 79b7f8d900fbfd49c528c0cafdfeded06b7aeb9e..89ffdf8a68322313f195f7bcbdd66bbbaf4fa0cc 100644 --- a/sizingDemandResponseTrialsNZ.Rmd +++ b/sizingDemandResponseTrialsNZ.Rmd @@ -7,7 +7,12 @@ title: '`r paste0(params$title)`' subtitle: '`r paste0(params$subtitle)`' 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 @@ -17,10 +22,6 @@ 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 @@ -121,7 +122,7 @@ Code history is generally tracked via the paper [repo](https://github.com/datakn ## Data: -This paper uses circuit level extracts for 'Heat Pumps', 'Lighting' and 'Hot Water' for the NZ GREEN Grid Household Electricity Demand Data (`r myParams$GGDataDOI` [@anderson_new_2018]). These have been extracted using the code found in +This paper uses circuit level extracts for 'Heat Pumps', 'Lighting' and 'Hot Water' for the NZ GREEN Grid Household Electricity Demand Data (`r myParams$GGDataDOI` [@anderson_new_2018]). These have been extracted using the code found in https://github.com/CfSOtago/GREENGridData/blob/master/examples/code/extractCleanGridSpy1minCircuit.R ## Acknowledgements diff --git a/sizingDemandResponseTrialsNZ.html b/sizingDemandResponseTrialsNZ.html index 7cd8193cd95be91cf6a4ff81481c2caed166e9d9..b260d2ad16dfff52d2c4159ed11fb03da45b067d 100644 --- a/sizingDemandResponseTrialsNZ.html +++ b/sizingDemandResponseTrialsNZ.html @@ -240,7 +240,7 @@ div.tocify { <h1 class="title toc-ignore">Statistical Power, Statistical Significance, Study Design and Decision Making: A Worked Example</h1> <h3 class="subtitle"><em>Sizing Demand Response Trials in New Zealand</em></h3> <h4 class="author"><em>Ben Anderson and Tom Rushby (Contact: <a href="mailto:b.anderson@soton.ac.uk">b.anderson@soton.ac.uk</a>, <code>@dataknut</code>)</em></h4> -<h4 class="date"><em>Last run at: 2018-09-27 15:26:47</em></h4> +<h4 class="date"><em>Last run at: 2018-09-27 15:34:32</em></h4> </div> @@ -292,7 +292,7 @@ div.tocify { </div> <div id="data" class="section level2"> <h2><span class="header-section-number">1.5</span> Data:</h2> -<p>This paper uses circuit level extracts for ‘Heat Pumps’, ‘Lighting’ and ‘Hot Water’ for the NZ GREEN Grid Household Electricity Demand Data (<a href="https://dx.doi.org/10.5255/UKDA-SN-853334" class="uri">https://dx.doi.org/10.5255/UKDA-SN-853334</a> <span class="citation">(Anderson et al. 2018)</span>). These have been extracted using the code found in</p> +<p>This paper uses circuit level extracts for ‘Heat Pumps’, ‘Lighting’ and ‘Hot Water’ for the NZ GREEN Grid Household Electricity Demand Data (<a href="https://dx.doi.org/10.5255/UKDA-SN-853334" class="uri">https://dx.doi.org/10.5255/UKDA-SN-853334</a> <span class="citation">(Anderson et al. 2018)</span>). These have been extracted using the code found in <a href="https://github.com/CfSOtago/GREENGridData/blob/master/examples/code/extractCleanGridSpy1minCircuit.R" class="uri">https://github.com/CfSOtago/GREENGridData/blob/master/examples/code/extractCleanGridSpy1minCircuit.R</a></p> </div> <div id="acknowledgements" class="section level2"> <h2><span class="header-section-number">1.6</span> Acknowledgements</h2> @@ -506,13 +506,13 @@ n households Control </td> <td style="text-align:right;"> -175.34594 +160.06236 </td> <td style="text-align:right;"> -334.21512 +320.32863 </td> <td style="text-align:right;"> -1055 +1070 </td> </tr> <tr> @@ -520,13 +520,13 @@ Control Intervention 1 </td> <td style="text-align:right;"> -38.13993 +38.38931 </td> <td style="text-align:right;"> -84.02911 +84.81464 </td> <td style="text-align:right;"> -940 +899 </td> </tr> <tr> @@ -534,13 +534,13 @@ Intervention 1 Intervention 2 </td> <td style="text-align:right;"> -58.67461 +62.96979 </td> <td style="text-align:right;"> -109.15877 +116.10543 </td> <td style="text-align:right;"> -1013 +1056 </td> </tr> <tr> @@ -548,13 +548,13 @@ Intervention 2 Intervention 3 </td> <td style="text-align:right;"> -64.75981 +66.80930 </td> <td style="text-align:right;"> -140.54042 +145.74274 </td> <td style="text-align:right;"> -1192 +1175 </td> </tr> </tbody> @@ -570,17 +570,17 @@ Figure 5.1: Mean W demand per group for large sample (Error bars = 95% confidenc ## Welch Two Sample t-test ## ## data: largeTestDT[group == "Intervention 2"]$meanW and largeTestDT[group == "Control"]$meanW -## t = -10.757, df = 1284.7, p-value < 2.2e-16 +## t = -9.3142, df = 1348.3, p-value < 2.2e-16 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: -## -137.9495 -95.3932 +## -117.54191 -76.64322 ## sample estimates: ## mean of x mean of y -## 58.67461 175.34594</code></pre> +## 62.96979 160.06236</code></pre> <p>In this case:</p> <ul> -<li>effect size = 116.6713324W or 66.54% representing a still <em>reasonable bang for buck</em> for whatever caused the difference;</li> -<li>95% confidence interval for the test = -137.95 to -95.39 representing <em>much less</em> uncertainty/variation;</li> +<li>effect size = 97.0925661W or 60.66% representing a still <em>reasonable bang for buck</em> for whatever caused the difference;</li> +<li>95% confidence interval for the test = -117.54 to -76.64 representing <em>much less</em> uncertainty/variation;</li> <li>p value of 0 representing a <em>very low</em> risk of a false positive result as it passes all conventional thresholds.</li> </ul> <p>So now we are able to be much more confident in our decision to implement Intervention 2 since the average effect is reasonably large, the expected variation in the effect size is reasonably narrow and the risk of a Type I (false positive) error is extremely small.</p> @@ -619,7 +619,7 @@ Figure 5.1: Mean W demand per group for large sample (Error bars = 95% confidenc </div> <div id="runtime" class="section level1"> <h1><span class="header-section-number">8</span> Runtime</h1> -<p>Analysis completed in 78.36 seconds ( 1.31 minutes) using <a href="https://cran.r-project.org/package=knitr">knitr</a> in <a href="http://www.rstudio.com">RStudio</a> with R version 3.5.1 (2018-07-02) running on x86_64-apple-darwin15.6.0.</p> +<p>Analysis completed in 71.73 seconds ( 1.2 minutes) using <a href="https://cran.r-project.org/package=knitr">knitr</a> in <a href="http://www.rstudio.com">RStudio</a> with R version 3.5.1 (2018-07-02) running on x86_64-apple-darwin15.6.0.</p> </div> <div id="r-environment" class="section level1"> <h1><span class="header-section-number">9</span> R environment</h1> diff --git a/sizingDemandResponseTrialsNZ.md b/sizingDemandResponseTrialsNZ.md index eec11aa06e0aee95e0d6088e2c95d56232e49c7a..a4e47b206d3dd7055950493f87acdf1428ae474a 100644 --- a/sizingDemandResponseTrialsNZ.md +++ b/sizingDemandResponseTrialsNZ.md @@ -6,7 +6,8 @@ params: title: 'Statistical Power, Statistical Significance, Study Design and Decision Making: A Worked Example' subtitle: 'Sizing Demand Response Trials in New Zealand' author: 'Ben Anderson and Tom Rushby (Contact: b.anderson@soton.ac.uk, `@dataknut`)' -date: 'Last run at: 2018-09-27 15:26:47' +date: 'Last run at: 2018-09-27 15:34:32' +always_allow_html: yes output: bookdown::html_document2: code_folding: hide @@ -81,7 +82,7 @@ Code history is generally tracked via the paper [repo](https://github.com/datakn ## Data: -This paper uses circuit level extracts for 'Heat Pumps', 'Lighting' and 'Hot Water' for the NZ GREEN Grid Household Electricity Demand Data (https://dx.doi.org/10.5255/UKDA-SN-853334 [@anderson_new_2018]). These have been extracted using the code found in +This paper uses circuit level extracts for 'Heat Pumps', 'Lighting' and 'Hot Water' for the NZ GREEN Grid Household Electricity Demand Data (https://dx.doi.org/10.5255/UKDA-SN-853334 [@anderson_new_2018]). These have been extracted using the code found in https://github.com/CfSOtago/GREENGridData/blob/master/examples/code/extractCleanGridSpy1minCircuit.R ## Acknowledgements @@ -284,27 +285,27 @@ Suppose instead that we had designed and implemented our sample recruitment acco <tbody> <tr> <td style="text-align:left;"> Control </td> - <td style="text-align:right;"> 175.34594 </td> - <td style="text-align:right;"> 334.21512 </td> - <td style="text-align:right;"> 1055 </td> + <td style="text-align:right;"> 160.06236 </td> + <td style="text-align:right;"> 320.32863 </td> + <td style="text-align:right;"> 1070 </td> </tr> <tr> <td style="text-align:left;"> Intervention 1 </td> - <td style="text-align:right;"> 38.13993 </td> - <td style="text-align:right;"> 84.02911 </td> - <td style="text-align:right;"> 940 </td> + <td style="text-align:right;"> 38.38931 </td> + <td style="text-align:right;"> 84.81464 </td> + <td style="text-align:right;"> 899 </td> </tr> <tr> <td style="text-align:left;"> Intervention 2 </td> - <td style="text-align:right;"> 58.67461 </td> - <td style="text-align:right;"> 109.15877 </td> - <td style="text-align:right;"> 1013 </td> + <td style="text-align:right;"> 62.96979 </td> + <td style="text-align:right;"> 116.10543 </td> + <td style="text-align:right;"> 1056 </td> </tr> <tr> <td style="text-align:left;"> Intervention 3 </td> - <td style="text-align:right;"> 64.75981 </td> - <td style="text-align:right;"> 140.54042 </td> - <td style="text-align:right;"> 1192 </td> + <td style="text-align:right;"> 66.80930 </td> + <td style="text-align:right;"> 145.74274 </td> + <td style="text-align:right;"> 1175 </td> </tr> </tbody> </table> @@ -322,19 +323,19 @@ In comparison to \ref(fig:ggMeanDiffs) we can now see (\ref(fig:largeNmeanDiffs) ## Welch Two Sample t-test ## ## data: largeTestDT[group == "Intervention 2"]$meanW and largeTestDT[group == "Control"]$meanW -## t = -10.757, df = 1284.7, p-value < 2.2e-16 +## t = -9.3142, df = 1348.3, p-value < 2.2e-16 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: -## -137.9495 -95.3932 +## -117.54191 -76.64322 ## sample estimates: ## mean of x mean of y -## 58.67461 175.34594 +## 62.96979 160.06236 ``` In this case: - * effect size = 116.6713324W or 66.54% representing a still _reasonable bang for buck_ for whatever caused the difference; - * 95% confidence interval for the test = -137.95 to -95.39 representing _much less_ uncertainty/variation; + * effect size = 97.0925661W or 60.66% representing a still _reasonable bang for buck_ for whatever caused the difference; + * 95% confidence interval for the test = -117.54 to -76.64 representing _much less_ uncertainty/variation; * p value of 0 representing a _very low_ risk of a false positive result as it passes all conventional thresholds. So now we are able to be much more confident in our decision to implement Intervention 2 since the average effect is reasonably large, the expected variation in the effect size is reasonably narrow and the risk of a Type I (false positive) error is extremely small. @@ -374,7 +375,7 @@ We would like to thank collaborators and partners on a number of applied researc -Analysis completed in 78.36 seconds ( 1.31 minutes) using [knitr](https://cran.r-project.org/package=knitr) in [RStudio](http://www.rstudio.com) with R version 3.5.1 (2018-07-02) running on x86_64-apple-darwin15.6.0. +Analysis completed in 71.73 seconds ( 1.2 minutes) using [knitr](https://cran.r-project.org/package=knitr) in [RStudio](http://www.rstudio.com) with R version 3.5.1 (2018-07-02) running on x86_64-apple-darwin15.6.0. # R environment diff --git a/sizingDemandResponseTrialsNZ_files/figure-docx/largeNmeanDiffs-1.png b/sizingDemandResponseTrialsNZ_files/figure-docx/largeNmeanDiffs-1.png index b619e4eaa8476db1ace09425ab00dab10d51ce33..fe937d858fbb62ea06f042d3aaeb42981891ee5b 100644 Binary files a/sizingDemandResponseTrialsNZ_files/figure-docx/largeNmeanDiffs-1.png and b/sizingDemandResponseTrialsNZ_files/figure-docx/largeNmeanDiffs-1.png differ diff --git a/sizingDemandResponseTrialsNZ_files/figure-html/largeNmeanDiffs-1.png b/sizingDemandResponseTrialsNZ_files/figure-html/largeNmeanDiffs-1.png index 9d83e9a8231b17c34590995a11bc36686af41e2c..ca959c953f9ef84cb6664b8ccfa7e4f890fe8643 100644 Binary files a/sizingDemandResponseTrialsNZ_files/figure-html/largeNmeanDiffs-1.png and b/sizingDemandResponseTrialsNZ_files/figure-html/largeNmeanDiffs-1.png differ