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
data { | |
int I; // number of data | |
int R; // number of Rcen | |
int F; // number of Freq | |
array[I] int Rcen; // value of Rcen | |
array[I] int Freq; // value of Freq | |
array[I] int N; | |
array[I] int PV; | |
} |
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
#include <ostream> | |
static int iteration_index = 1; | |
inline void add_iter(std::ostream* pstream__) { | |
iteration_index += 1; | |
} | |
inline int get_iter(std::ostream* pstream__) { | |
return iteration_index; |
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(cmdstanr) | |
waic <- function(log_likelihood) { | |
training_error <- - mean(log(colMeans(exp(log_likelihood)))) | |
functional_variance_div_N <- mean(colMeans(log_likelihood^2) - colMeans(log_likelihood)^2) | |
waic <- training_error + functional_variance_div_N | |
return(waic) | |
} | |
model1_Si <- cmdstan_model('model1-addG-Simpson.stan') |
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
functions { | |
// calculating the convolutions | |
vector convolution(vector x, vector y_rev) { | |
int T = num_elements(x); | |
vector[T-1] res; | |
for (t in 2:T) { | |
res[t-1] = dot_product(x[1:(t-1)], y_rev[(T-t+2):T]); | |
} | |
return res; | |
} |
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
Age10 | N | Y | |
---|---|---|---|
1 | 1 | 0 | |
2 | 5 | 2 | |
3 | 28 | 25 | |
4 | 34 | 27 | |
5 | 27 | 19 | |
6 | 59 | 28 | |
7 | 177 | 76 | |
8 | 234 | 95 | |
9 | 52 | 27 |
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
Time | Date | Y | |
---|---|---|---|
0 | 2012-03-01 | 28140 | |
1 | 2012-03-08 | 28850 | |
2 | 2012-03-15 | 34230 | |
3 | 2012-03-22 | 29260 | |
4 | 2012-03-29 | 29200 | |
5 | 2012-04-05 | 33940 | |
7 | 2012-04-19 | 24800 | |
8 | 2012-04-26 | 26060 | |
9 | 2012-05-03 | 26490 |
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
var fileref=document.createElement('script') | |
fileref.setAttribute("type","text/javascript") | |
fileref.setAttribute("src", "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML") | |
document.getElementsByTagName("head")[0].appendChild(fileref) |
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(ggjoy) | |
library(dplyr) | |
library(purrr) | |
# yutani data ------------------------------------------------------------ | |
set.seed(10) | |
l <- rerun(26, rnorm(1000, mean = runif(1), sd = sqrt(runif(1)))) | |
names(l) <- LETTERS | |
l[[2]] <- c(rnorm(500, mean = -1, sd = 0.3), rnorm(500, mean = 1, sd = 0.3)) | |
d <- as.data.frame(l) %>% tidyr::gather(id, value) |
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
data { | |
int Q; | |
int N; | |
vector[Q] D; | |
int Solved[Q, N]; | |
vector[N] D_max; | |
real D_range; | |
} | |
parameters { |
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
data { | |
int I; | |
int J; | |
matrix[I,J] Y; | |
real<lower=0> U; | |
} | |
parameters { | |
matrix<lower=-5, upper=5>[I,J] mu; | |
real<lower=0> s_mu; |
NewerOlder