Administrator approval is now required for registering new accounts. If you are registering a new account, and are external to the University, please ask the repository owner to contact ServiceLine to request your account be approved. Repository owners must include the newly registered email address, and specific repository in the request for approval.

Commit c6b3ef6b authored by Ben Anderson's avatar Ben Anderson
Browse files

restructured in move to git.soton

parent deb163d2
No preview for this file type
......@@ -10,4 +10,4 @@ Description: Code to support a paper on statistical power analysis.
License: What license it uses
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.0
RoxygenNote: 6.1.1
# Generated by roxygen2: do not edit by hand
export(estimateMeanEffectSizes)
export(estimateProportionEffectSizes)
export(estimateProportionSampleSizes)
import(data.table)
import(pwr)
import(reshape2)
# run this to knit the .Rmd to an html file
library(markdown)
library(bookdown)
library(dkUtils)
library(weGotThePower)
repoLoc <- dkUtils::findParentDirectory("weGotThePower")
# this will fail if you do not have access to the UoO GREENGrid Data archive (via HCS)
# it will also sometimes fail on the small sample section due to random processes. Just re-run it.
rmdFile <- paste0(repoLoc, "/code/weGotThePower.Rmd")
rmarkdown::render(input = rmdFile,
output_format = "html_document2",
output_file = paste0(repoLoc, "/output/weGotThePower.html")
)
\ No newline at end of file
......@@ -468,12 +468,11 @@ linkedTestDT <- linkedTestDT[season == "Winter" & !is.na(nPeople)]
# create small sample - be warned, this is a random process so you will get different results each time you run it
smallTestDT <- sample_frac(linkedTestDT, 2, replace = TRUE)
smallTestDT <- data.table::as.data.table(sample_frac(linkedTestDT, 2, replace = TRUE))
t <- smallTestDT[, .("mean W" = mean(meanW),
"sd W" = sd(meanW),
"n households" = .N),
keyby = .(nPeople)]
"n households" = .N), keyby = .(nPeople)]
knitr::kable(t, caption = "Number of households and summary statistics per group (winter heat pump use)")
```
......@@ -574,7 +573,7 @@ Now:
```{r creatLargeN}
# fix.
# we just randomly re-sample the GREEN Grid data
largeTestDT <- sample_frac(linkedTestDT, 40, replace = TRUE)
largeTestDT <- data.table::as.data.table(sample_frac(linkedTestDT, 40, replace = TRUE))
t <- largeTestDT[, .("mean W" = mean(meanW),
"sd W" = sd(meanW),
......
# We Got The Power: Analysis for a short paper on statistical power & statistical significance
And the various confusions that arise...
* Latest draft:
* [.Rmd](https://github.com/dataknut/weGotThePower/blob/master/paper/weGotThePower.Rmd) code (mostly stats & notes, little text)
* [.html](weGotThePower.html) output (as above)
theme: jekyll-theme-slate
\ No newline at end of file
......@@ -22,7 +22,7 @@ estimateMeanEffectSizes(mean, sd, samples, power)
Returns a data.table of effect sizes for a given sample size. Calculates these for p = 0.01, 0.05, 0.1 & 0.2. Pick out the ones you want.
}
\seealso{
Other Power functions: \code{\link{estimateProportionEffectSizes}}
Other Power functions: \code{\link{estimateProportionSampleSizes}}
}
\author{
Ben Anderson, \email{b.anderson@soton.ac.uk}
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/power.R
\name{estimateProportionEffectSizes}
\alias{estimateProportionEffectSizes}
\name{estimateProportionSampleSizes}
\alias{estimateProportionSampleSizes}
\title{Estimate detectable proportion differences for given sample sizes using statistical power analysis}
\usage{
estimateProportionEffectSizes(samples, power)
estimateProportionSampleSizes(p1, p2, samples, power)
}
\arguments{
\item{p1}{the estimated proportion in sample 1}
\item{samples}{a list of sample sizes to iterate over}
\item{power}{power value to use}
\item{mean}{the estimated mean value to use}
\item{sd}{the estimated stadnard deviation to use}
\item{sd}{the estimated proportion in sample 2}
}
\description{
\code{estimateProportionEffectSizes} calculates required sample sizes for a given set of p values and samples.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# run this to knit the .Rmd to an html file in the docs/ directory for github pages
library(markdown)
library(bookdown)
library(dkUtils)
myParams$repoLoc <- dkUtils::findParentDirectory("weGotThePower")
rmdFile <- paste0(myParams$repoLoc, "/paper/weGotThePower.Rmd")
rmarkdown::render(input = rmdFile,
output_format = "html_document2",
output_file = paste0(myParams$repoLoc, "/docs/weGotThePower.html")
)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment