This file contains hidden or 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: "Bayesian effect size for ANOVA designs" | |
author: "Fabian Dablander, Maarten Marsman" | |
date: "May 22, 2016" | |
output: html_document | |
--- | |
## 1) Example: One-way design | |
Download the data from [https://osf.io/zcipy/](https://osf.io/zcipy/), save it under | |
"example1.sav" in the current directory. |
This file contains hidden or 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
function PCA(X) | |
## Y = PX | |
# required: | |
#- P such that | |
#- we get rid of 2nd order correlation, Cov(Y) = D [some diagonal matrix] | |
# method: | |
#- project onto an orthogonal space spanned by the | |
#- eigenvectors with variances equal to the eigenvalues |
This file contains hidden or 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
library('rvest') | |
library('stringr') | |
fachschaft = 'http://wiki.psyfako.org/index.php?title=Liste_der_Psychologie_Fachschaften' | |
emails = read_html(fachschaft) %>% | |
html_nodes('p, a, span') %>% html_text(.) %>% | |
str_replace('\\[at\\]', '@') %>% str_replace('\\(at\\)', '@') %>% | |
str_replace('\\[ät\\]', '@') %>% str_replace('\\[dot\\]', '.') %>% |
This file contains hidden or 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
shinyApp( | |
options = list(width = '25%', height = '25%'), | |
ui = shinyUI(fluidPage( | |
sidebarLayout( | |
sidebarPanel( | |
sliderInput('e', label = 'e', min = 0, max = 100, value = 10, step = 1), | |
sliderInput('N', label = 'N', min = 10, max = 500, value = 100, step = 1), | |
numericInput('seed', label = 'random seed', value = 1774), | |
numericInput('lambda', label = 'penalty (lambda)', value = 0), | |
textInput('true', label = 'true function f(x)', value = 'x^2'), |
This file contains hidden or 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
library('runjags') | |
lasso.bayes <- function(y, X, n.iter = 10000) { | |
ms <- ' | |
model { | |
sigma ~ dunif(0, 100) | |
tau <- pow(sigma, -2) | |
lambda ~ dunif(0, 10) |
This file contains hidden or 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
# c('practicality', 'difficulty', 'some color, dunno') | |
papers <- rbind( | |
# paper we discuss | |
c(5, 3, 1), # Lindley (1993) | |
c(8, 0, 1), # Kruschke (2010) | |
c(4, 3, 1), # Wagenmakers (2007) | |
c(5, 2, 1), # Dienes (2011) | |
c(3, 7, 1), # Vandekerckhove, Matzke, Wagenmakers (2015) | |
c(4, 8, 1), # Rouder & Morey (2012) |
This file contains hidden or 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
library('shiny') | |
# the code (with a little cleaning up) for the visualisations is from | |
# http://alexanderetz.com/2015/07/25/understanding-bayes-updating-priors-via-the-likelihood/ | |
# Alex Etz runs a really nice blog -- go check it out! | |
shinyApp( | |
ui = shinyUI(fluidPage( | |
sidebarLayout( | |
sidebarPanel( | |
div(style = 'display: inline-block;', numericInput('a', label = h4('a'), value = 1)), |
This file contains hidden or 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
#' False Discovery Rate (FDR) | |
#' see also http://www.sciencedirect.com/science/article/pii/S1053811901910377 | |
#' | |
#' Declared active Declared inactive | |
#' Active V_aa V_ai T_a | |
#' Inactive V_ia V_ii T_i | |
#' D_a D_i V | |
#' | |
#' instead of controlling the overall family wise error, we control | |
#' the proportion of false discoveries; that is, we want (V_aa) / (V_aa + V_ia) |
This file contains hidden or 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
library('shiny') | |
# read this: http://alexanderetz.com/2015/04/15/understanding-bayes-a-look-at-the-likelihood/ | |
shinyApp( | |
ui = shinyUI(fluidPage( | |
sidebarLayout( | |
sidebarPanel( | |
sliderInput("p1", label = "p1", | |
min = 0, max = 1, value = 0.7, step = 0.01), |
This file contains hidden or 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
/* | |
* empirically tests the complexity of a bogosort based algorithm which | |
* shuffles circles until they don't overlap (for stimulus presentation) | |
* is a function of the circle radius, the canvas width and height | |
* | |
* call it with (first arg is radius, then width and height of canvas) | |
* > node test.js 10 300 500 | |
* > node test.js 10 | |
* etc. | |
*/ |