915
edits
Changes
Updated to match github version
[[ Category: General ]]
[[ Category: Data ]]
[[ Category: Statistics ]]
= General Statistical Methods =
There are several important concepts that we will adhere to in our group. These involve design considerations, execution considerations and analysis concerns. The standard for our field is null hypothesis significance testing, which means that we are generally comparing our data to a null hypothesis, generating an '''effect size''' and a '''p-value'''. As a general rule, we report both of these both within our Rmd scripts, and in our publications. We generally use an <math>\alpha</math> of <math>p<0.05</math> to determine significance, which means that (if true) we are rejecting the null hypothesis.
== Experimental Design ==
* The desired power (normally 0.8). This indicates that 80% of the time you will detect the effect if there is one. This is also known as 1 minus the false negative rate or 1 minus the Type II error rate.
We use the R package '''pwr''' to do a power analysis (Champely, 20172020). Here is an example:
=== Pairwise Comparasons ===
leveneTest(Result ~ Treatment, data=test.data) %>% tidy %>% kable</pre>
{|
!align="right"| statistic
!align="right"| p.value
!align="right"| df
!align="right"| df.residual
|-
|align="right"| 0.368
|align="right"| 0.558
|-align="right"|1
|align="right"| 10
|}
t.test(Result~Treatment,data=test.data, var.equal=T) %>% tidy %>% kable</pre>
{|
!align="right" width="8%"| estimate!align="right" width="9%"| estimate1!align="right" width="9%"| estimate2!align="right" width="9%"| statistic!align="right" width="7%"| p.value!align="right" width="9%"| parameter!align="right" width="8%"| conf.low!align="right" width="9%"| conf.high! width="16%"| method! width="11%"| alternative
|-
|align="right"| -1.1
|align="right"| 8.79
|align="right"| 9.89
t.test(Result~Treatment,data=test.data, var.equal=F) %>% tidy %>% kable</pre>
{|
!align="right" width="8%"| estimate!align="right" width="9%"| estimate1!align="right" width="9%"| estimate2!align="right" width="9%"| statistic!align="right" width="7%"| p.value!align="right" width="9%"| parameter!align="right" width="8%"| conf.low!align="right" width="9%"| conf.high! width="20%"| method! width="10%"| alternative
|-
|align="right"| -1.1
|align="right"| 12
|align="right"| 0.394
| Wilcoxon rank sum exact test
| two.sided
|}
<pre class="r">sessionInfo()</pre>
<pre>## R version 34.4.2 1 (20172024-0906-2814)## Platform: x86_64-apple-darwin15.6.0 (64-bit)darwin20## Running under: macOS High Sierra 10Monterey 12.137.16
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/34.4-x86_64/Resources/lib/libRblas.0.dylib## LAPACK: /Library/Frameworks/R.framework/Versions/34.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: America/Detroit
## tzcode source: internal
##
## attached base packages:
##
## other attached packages:
## [1] car_2car_3.1-6 broom_02 carData_3.40-5 broom_1.3 bindrcpp_00.2 6 ## [4] pwr_1.23-1 0 knitcitations_1.0.9 dplyr_012 dplyr_1.71.4 ## [7] tidyr_0tidyr_1.73.2 1 knitr_1.17 48
##
## loaded via a namespace (and not attached):
## [1] Rcpp_0jsonlite_1.128.14 nloptr_1.08 compiler_4.4 compiler_3.41 tidyselect_1.2 ## .1 [4] plyr_1Rcpp_1.80.4 highr_0.6 bindr_0.1 13 ## [75] tools_3xml2_1.43.2 6 lme4_1stringr_1.5.1-14 digest_0 jquerylib_0.61.12 4 yaml_2.3.10 ## [109] jsonlite_1fastmap_1.5 lubridate_12.70 R6_2.1 evaluate_0.105.1 ## [13] tibble_1 plyr_1.38.4 nlme_39 generics_0.1-131 lattice_0.20-35 3 ## [1613] mgcv_1backports_1.8-22 pkgconfig_25.0 tibble_3.1 rlang_02.1 RefManageR_1.4 .0 lubridate_1.9.3 ## [1917] Matrix_1bslib_0.2-12 psych_18.70 pillar_1.8 bibtex_09.4.2 0 ## [22] yaml_2rlang_1.1.15 parallel_3.4 utf8_1.2 SparseM_1.77 4 ## [2521] RefManageR_0stringi_1.148.20 stringr_14 cachem_1.21.0 httr_1xfun_0.3.1 ## [28] xml2_1.1.1 46 MatrixModels_0sass_0.4-1 nnet_7.3-12 9 ## [3125] rprojroot_1bibtex_0.2 5.1 grid_3timechange_0.43.0 cli_3.2 6.3 glue_1withr_3.20.0 ## [3429] R6_2magrittr_2.20.2 foreign_03 digest_0.8-69 6.36 rmarkdown_1lifecycle_1.8 0.4 vctrs_0.6.5 ## [3733] minqa_1evaluate_0.224.4 reshape2_10 glue_1.47.2 purrr_0.20 abind_1.4 ## [40] magrittr_1.-5 splines_3fansi_1.40.2 6 MASS_7.3-47 ## [4337] backports_1rmarkdown_2.1.1 27 htmltools_0purrr_1.30.6 pbkrtest_02 httr_1.4-.7 tools_4.4.1 ## [4641] assertthat_0pkgconfig_2.20.0 3 mnormt_1htmltools_0.5-5 quantreg_5.34 ## [49] stringi_18.1.6</pre>
= References =
<a name=bib-pwr></a>[[#cite-pwr|[1]]] S. Champely. ''pwr: Basic Functions for Power Analysis''. R package version 1.23-10. 20172020. URL: https://CRAN.R-project.org/package=pwr.