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
# 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('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
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('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
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
--- | |
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
# for https://www.facebook.com/efpsa.jeps/posts/1278843852167100 | |
library('ggplot2') | |
library('gridExtra') | |
set.seed(1774) | |
# generate data | |
A = c(rnorm(20, 20, 4), rnorm(20, 40, 4)) # mixture distribution | |
B = rt(30, 1) + 30 # from a heavy-tailed distribution (Cauchy) | |
C = c(25, 35, 33) # just three data points |
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
bfx <- function(x, tstat, n, mu, gamma, k, v = n - 2) { | |
num <- integrate(function(delta) { | |
dt(tstat, df = v, ncp = sqrt(n)*delta)/gamma * dnorm((delta - mu)/gamma) | |
}, -Inf, Inf)$value | |
dt(tstat, df = v, ncp = sqrt(n)*x) / num | |
} | |
lo <- uniroot(function(x) bfx(x, .5, 10, 0, .3) - 1, interval = c(-1, 0))$root |
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
# devtools::install_github("dkahle/dirichlet") | |
library('TeX') | |
library('ggplot2') | |
library('gridExtra') | |
library('dirichlet') | |
plot_dirichlet <- function(alphas = c(.5, .5, .5), add_points = FALSE) { | |
f <- function(v) ddirichlet(v, alphas) | |
mesh <- simplex_mesh(.0025) %>% as.data.frame %>% tbl_df |