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
# in the R script: | |
init_fun <- function(){list(R = array(rep(rgamma(n = data$t, | |
shape = (rt_prior$mean / rt_prior$sd)^2, | |
scale = (rt_prior$sd^2) / rt_prior$mean), | |
data$k),dim = c(data$k, data$t)), | |
phi = array(rexp(data$k, 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
plot_two_histograms <- function(vector1, vector2, | |
breaks = 100, | |
upper_limit = NA, | |
...){ | |
if(!is.na(upper_limit)){ | |
vector1 <- vector1[vector1 < upper_limit] | |
vector2 <- vector2[vector2 < upper_limit] | |
} | |
## set breakpoints and define minimum |
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
## illustrate prior | |
prior <- rnorm(100000, 0.5, 0.5) | |
## extract posterior from Stan | |
posterior <- extract(my_stanfitobject)$my_parameter | |
## alternatively, create some second vector | |
vector2 <- rnorm(100000, 2, 0.8) | |
plot_two_histograms(prior, vector2, breaks = 100, |
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
#include <stdio.h> | |
int main(void){ | |
printf("Hello World"); | |
return 0; | |
} |
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
#include <stdio.h> | |
int main(void){ | |
int counter = 0; | |
int t = 1; | |
while (t){ | |
counter++; | |
printf("counter: %d\n", counter); | |
if (counter == 5){ | |
t = 0; |