Source the sussex.fix() function using
source("http://tinyurl.com/sussexfix")and then run it using
sussex.fix()| install.packages("bayesplay") | |
| install.packages("tidyverse") | |
| install.packages("patchwork") | |
| require(bayesplay) | |
| require(tidyverse) | |
| require(patchwork) | |
| # version 1 | |
| l <- bayesplay::likelihood("normal", 0, 1) | |
| p1 <- bayesplay::prior("normal", 10, 1) |
| const d3 = Object.assign({}, | |
| require("d3-selection"), | |
| require("d3-scale"), | |
| require("d3-array"), | |
| require("d3-shape"), | |
| require("d3-transition"), | |
| require("d3-ease"), | |
| require("d3-timer"), | |
| require("d3-format")); |
Source the sussex.fix() function using
source("http://tinyurl.com/sussexfix")and then run it using
sussex.fix()| setup<-function(){ | |
| user_renviron = path.expand(file.path("~", ".Renviron")) | |
| if(!file.exists(user_renviron)){ # check to see if the file already exists | |
| file.create(user_renviron) | |
| conn = file(user_renviron) | |
| writeLines("R_LIBS_USER=\"N:/Documents/R/win-library/3.6\"\nR_USER=\"N:/Documents\"\nHOME=\"N:/Documents\"", | |
| con = conn) | |
| close(conn)} | |
| } |
| BayesFactor::ttest.tstat(t = sqrt(N) * mean(x - 1) / sd(x), n1 = 10, simple = T) | |
| #rnorm(10, mean = 1, sd = .5) -> x | |
| N=10 | |
| BayesFactor::ttestBF(x = x, mu = 1) | |
| my.es=mean(x) / sd(x) | |
| nullvalue = 0 | |
| ############################ |
| # This example takes the p value for a aov structure, but it can be modified for work with anything | |
| unname(ifelse(aov[[1]][row.index,][[p.index]] > 0.001, | |
| paste("*p* =",str_trunc(sprintf("%.3f",unname(aov[[1]][row.index,p.index])),4,"left",ellipsis = "")), | |
| paste("*p* < 0.001"))) |
| ## Takes the standarded data matrix as it's input | |
| ## model available from: | |
| ## http://doingbayesiandataanalysis.blogspot.co.uk/2017/06/bayesian-estimation-of-correlations-and.html | |
| model { | |
| for ( i in 1:Ntotal ) { | |
| zy[i,1:Nvar] ~ dmnorm( zMu[1:Nvar] , zInvCovMat[1:Nvar,1:Nvar] ) | |
| } | |
| for ( varIdx in 1:Nvar ) { zMu[varIdx] ~ dnorm( 0 , 1/2^2 ) } | |
| zInvCovMat ~ dwish( zRmat[1:Nvar,1:Nvar] , zRscal ) |