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
data { | |
int<lower=0> n; | |
vector[n] y; | |
vector[n] x2; | |
vector[n] x3; | |
real<lower= -1, upper= 1> rho; | |
real g; // slope for u | |
vector[2] prior; | |
} | |
transformed data { |
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
change <- function(x, days = 10, method = 'last', intvl = .9) { | |
# distribution of change over days | |
stopifnot(days < length(x)) | |
stopifnot(method %in% c('last', 'max', 'min')) | |
N <- length(x) | |
vec <- c() | |
for (i in 1:(N - days)) { | |
extract <- x[i:(i + days)] | |
lastchange <- extract[days] / extract[1] - 1 |