@dataknut
)This work is made available under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License.
This means you are free to:
Under the following terms:
Notices:
For the avoidance of doubt and explanation of terms please refer to the full license notice and legal code.
If you wish to use any of the material from this paper please cite as:
This work is (c) 2018 the authors.
This report uses circuit level extracts for ‘Heat Pumps’ from the NZ GREEN Grid Household Electricity Demand Data (https://dx.doi.org/10.5255/UKDA-SN-853334 (Anderson et al. 2018)). These have been extracted using the code found in https://github.com/CfSOtago/GREENGridData/blob/master/examples/code/extractCleanGridSpy1minCircuit.R
This work was supported by:
This report contains the analysis for a paper of the same name. The text is stored elsewhere for ease of editing.
## Warning: replacing previous import 'data.table::melt' by 'reshape2::melt'
## when loading 'weGotThePower'
## Warning: replacing previous import 'data.table::dcast' by 'reshape2::dcast'
## when loading 'weGotThePower'
Figure 4.1 shows the initial p = 0.05 plot.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
Figure 4.1: Power analysis results (p = 0.05, power = 0.8)
## Saving 7 x 5 in image
Effect size at n = 1000: 11.12.
Figure 4.2 shows the plot for all results.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
Figure 4.2: Power analysis results (power = 0.8)
## Saving 7 x 5 in image
Full table of results:
## Using 'effectSize' as value column. Use 'value.var' to override
sampleN | p = 0.01 | p = 0.05 | p = 0.1 | p = 0.2 |
---|---|---|---|---|
50 | 64.25 | 50.08 | 42.64 | 33.73 |
100 | 45.11 | 35.28 | 30.09 | 23.83 |
150 | 36.75 | 28.78 | 24.55 | 19.45 |
200 | 31.79 | 24.91 | 21.25 | 16.84 |
250 | 28.41 | 22.27 | 19.01 | 15.06 |
300 | 25.93 | 20.32 | 17.35 | 13.75 |
350 | 23.99 | 18.81 | 16.06 | 12.73 |
400 | 22.44 | 17.60 | 15.02 | 11.90 |
450 | 21.15 | 16.59 | 14.16 | 11.22 |
500 | 20.06 | 15.74 | 13.43 | 10.65 |
550 | 19.13 | 15.00 | 12.81 | 10.15 |
600 | 18.31 | 14.36 | 12.26 | 9.72 |
650 | 17.59 | 13.80 | 11.78 | 9.34 |
700 | 16.95 | 13.30 | 11.35 | 9.00 |
750 | 16.37 | 12.85 | 10.97 | 8.69 |
800 | 15.85 | 12.44 | 10.62 | 8.42 |
850 | 15.38 | 12.07 | 10.30 | 8.17 |
900 | 14.95 | 11.73 | 10.01 | 7.94 |
950 | 14.55 | 11.41 | 9.74 | 7.72 |
1000 | 14.18 | 11.12 | 9.50 | 7.53 |
Does not require a sample.
Figure 4.3 shows the initial p = 0.05 plot. This shows the difference that would be required
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
Figure 4.3: Power analysis results for proportions (p = 0.05, power = 0.8)
## Saving 7 x 5 in image
Figure 4.4 shows the plot for all results.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
Figure 4.4: Power analysis results (power = 0.8)
## Saving 7 x 5 in image
Full table of results:
## Using 'effectSize' as value column. Use 'value.var' to override
sampleN | p = 0.01 | p = 0.05 | p = 0.1 | p = 0.2 |
---|---|---|---|---|
50 | 68.35 | 56.03 | 49.73 | 42.44 |
100 | 48.33 | 39.62 | 35.16 | 30.01 |
150 | 39.46 | 32.35 | 28.71 | 24.51 |
200 | 34.17 | 28.01 | 24.86 | 21.22 |
250 | 30.57 | 25.06 | 22.24 | 18.98 |
300 | 27.90 | 22.88 | 20.30 | 17.33 |
350 | 25.83 | 21.18 | 18.80 | 16.04 |
400 | 24.16 | 19.81 | 17.58 | 15.01 |
450 | 22.78 | 18.68 | 16.58 | 14.15 |
500 | 21.61 | 17.72 | 15.72 | 13.42 |
550 | 20.61 | 16.89 | 15.00 | 12.80 |
600 | 19.73 | 16.17 | 14.36 | 12.25 |
650 | 18.96 | 15.54 | 13.79 | 11.77 |
700 | 18.27 | 14.97 | 13.29 | 11.34 |
750 | 17.65 | 14.47 | 12.84 | 10.96 |
800 | 17.09 | 14.01 | 12.43 | 10.61 |
850 | 16.57 | 13.59 | 12.06 | 10.29 |
900 | 16.11 | 13.21 | 11.72 | 10.00 |
950 | 15.68 | 12.86 | 11.41 | 9.73 |
1000 | 15.28 | 12.53 | 11.12 | 9.49 |
group | mean W | sd W | n households |
---|---|---|---|
Control | 162.66915 | 325.51171 | 28 |
Intervention 1 | 35.13947 | 83.90258 | 22 |
Intervention 2 | 58.80597 | 113.53102 | 26 |
Intervention 3 | 68.37439 | 147.37279 | 29 |
T test group 1
Control mean | Group 1 mean | Mean difference | statistic | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|
162.6691 | 35.13947 | -127.5297 | -1.990661 | 0.0552626 | -258.11 | 3.050644 |
The results show that the mean power demand for the control group was 162.67W and for Intervention 1 was 35.14W. This is a (very) large difference in the mean of 127.53. The results of the t test are:
T test Group 2
Control mean | Group 2 mean | Mean difference | statistic | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|
162.6691 | 58.80597 | -103.8632 | -1.587604 | 0.1216582 | -236.8285 | 29.10212 |
Now:
To detect Intervention Group 2’s effect size of 63.85% would have required control and trial group sizes of 47 respectively.
group | mean W | sd W | n households |
---|---|---|---|
Control | 169.07673 | 329.12241 | 1102 |
Intervention 1 | 35.31770 | 82.82746 | 839 |
Intervention 2 | 58.68567 | 110.51213 | 1092 |
Intervention 3 | 64.41669 | 140.25577 | 1167 |
Figure 5.1: Mean W demand per group for large sample (Error bars = 95% confidence intervals for the sample mean)
re-run T tests Group 1
Control mean | Group 1 mean | Mean difference | statistic | p.value | conf.low | conf.high |
---|---|---|---|---|---|---|
169.0767 | 58.68567 | -110.3911 | -10.55037 | 0 | -130.9171 | -89.86505 |
In this case:
Analysis completed in 39.49 seconds ( 0.66 minutes) using knitr in RStudio with R version 3.5.1 (2018-07-02) running on x86_64-apple-darwin15.6.0.
R packages used:
Session info:
## R version 3.5.1 (2018-07-02)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.6
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
##
## locale:
## [1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] knitr_1.20 dkUtils_0.0.0.9000 broom_0.5.0
## [4] lubridate_1.7.4 readr_1.1.1 ggplot2_3.1.0
## [7] dplyr_0.7.7 data.table_1.11.8 myUtils_0.0.0.9000
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0.12.19 highr_0.7 pillar_1.3.0
## [4] compiler_3.5.1 plyr_1.8.4 bindr_0.1.1
## [7] tools_3.5.1 digest_0.6.18 lattice_0.20-35
## [10] nlme_3.1-137 evaluate_0.12 tibble_1.4.2
## [13] gtable_0.2.0 pkgconfig_2.0.2 rlang_0.3.0.1
## [16] cli_1.0.1 yaml_2.2.0 xfun_0.4
## [19] bindrcpp_0.2.2 pwr_1.2-2 withr_2.1.2
## [22] stringr_1.3.1 hms_0.4.2 rprojroot_1.3-2
## [25] grid_3.5.1 tidyselect_0.2.5 glue_1.3.0
## [28] R6_2.3.0 fansi_0.4.0 rmarkdown_1.10
## [31] bookdown_0.7 reshape2_1.4.3 weGotThePower_0.1
## [34] tidyr_0.8.1 purrr_0.2.5 magrittr_1.5
## [37] backports_1.1.2 scales_1.0.0 htmltools_0.3.6
## [40] assertthat_0.2.0 colorspace_1.3-2 labeling_0.3
## [43] utf8_1.1.4 stringi_1.2.4 lazyeval_0.2.1
## [46] munsell_0.5.0 crayon_1.3.4
Anderson, Ben, David Eyers, Rebecca Ford, Diana Giraldo Ocampo, Rana Peniamina, Janet Stephenson, Kiti Suomalainen, Lara Wilcocks, and Michael Jack. 2018. “New Zealand GREEN Grid Household Electricity Demand Study 2014-2018,” September. doi:10.5255/UKDA-SN-853334.
Csárdi, Gábor, and Rich FitzJohn. 2016. Progress: Terminal Progress Bars. https://CRAN.R-project.org/package=progress.
Dowle, M, A Srinivasan, T Short, S Lianoglou with contributions from R Saporta, and E Antonyan. 2015. Data.table: Extension of Data.frame. https://CRAN.R-project.org/package=data.table.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. http://www.jstatsoft.org/v40/i03/.
R Core Team. 2016. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Wickham, Hadley. 2009. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. http://ggplot2.org.
Wickham, Hadley, and Romain Francois. 2016. Dplyr: A Grammar of Data Manipulation. https://CRAN.R-project.org/package=dplyr.
Wickham, Hadley, Jim Hester, and Romain Francois. 2016. Readr: Read Tabular Data. https://CRAN.R-project.org/package=readr.
Xie, Yihui. 2016. Knitr: A General-Purpose Package for Dynamic Report Generation in R. https://CRAN.R-project.org/package=knitr.