This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Power and precision" | |
author: "Richard D. Morey" | |
date: "11/06/2020" | |
output: | |
html_document: | |
dev: png | |
self_contained: no | |
editor_options: | |
chunk_output_type: console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title : "The title" | |
shorttitle : "Title" | |
author: | |
- name : "First Author" | |
affiliation : "1" | |
corresponding : yes # Define only one corresponding author | |
address : "Postal address" | |
email : "my@email.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desired_precision = .6 | |
N1 = 5 | |
N2 = 6 | |
# Function to compute CDFs of "precisions" (CI widths) | |
SS_func = function(W, n, alpha = .05){ | |
n * (n - 1) * W^2 / (4 * qt(1-alpha/2, n - 1)^2) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prior setup | |
prior_concentration = 10 | |
# null | |
p0 = c(0.3, 0.3, 0.4) | |
# fake data, null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To.country | Jury | Televoting | |
---|---|---|---|
Netherlands | 231 | 261 | |
Italy | 212 | 253 | |
Russia | 125 | 244 | |
Switzerland | 148 | 212 | |
Norway | 47 | 291 | |
Sweden | 239 | 93 | |
Azerbaijan | 197 | 100 | |
North Macedonia | 237 | 58 | |
Australia | 154 | 131 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is to demonstrate the output. | |
# It is not needed. | |
testRmd = "https://gist.githubusercontent.com/richarddmorey/c4dd7d1fba2aa055a6f71286baedac25/raw/c256dd9f1ca0b22dfbce12443e1cb98ed5bb9d86/demo.Rmd" | |
tf = tempfile(fileext = ".Rmd") | |
tf_out = tempfile(fileext = ".html") | |
cat(RCurl::getURL(testRmd), file = tf) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## First install the devtools package if necessary | |
devtools::install_github("richarddmorey/EssexSummerSchoolBayes", subdir = "shiny_demo/flexjags/flexjags") | |
flexjags::run_flexjags() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M = 1000 | |
N = round(sort(rpois(M, 10)^1.5, decreasing = TRUE)) + 20 | |
pows = c(.5,.8,.95) | |
setup = expand.grid(N=N, pow = pows) | |
es = mapply(FUN = function(n, power, alpha) power.t.test(n = n, sig.level = alpha, power = power)$delta, | |
n = setup$N, power = setup$pow, MoreArgs = list(alpha = .05)) | |
dim(es) = c(setup$es,length(N), length(pows)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
output: | |
html_document: | |
dev: svg | |
fig_width: 5 | |
fig_height: 4 | |
--- | |
<!-- The output of this file can be found at | |
http://rpubs.com/richarddmorey/fonts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Paper is here: http://www.ejwagenmakers.com/2011/WetzelsEtAl2011_855.pdf | |
## Load the three data files | |
one_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_onesample.txt") | |
two_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_twosample.txt") | |
paired_sample = read.delim("https://gist.githubusercontent.com/richarddmorey/e44df8750d69b5c0cd8db9513e75fba4/raw/a476c41e23d944bcf1ac6d84860218900bec0fe1/data_pairedsample.txt") | |
# Define N1 and N2 for one sample tests | |
# for convenience | |
colnames(one_sample)[1] = "N1" |