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 { | |
vector kalman_lp(vector y, | |
real P0, | |
real Q, | |
real H) { | |
int n = size(y); | |
vector[n] x_return; | |
real x = y[1]; | |
real P = P0; |
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 { | |
real ornstein_uhlenbeck_lpdf(vector x, real tau, real a, data real delta, | |
real alpha0, real mu0, real sigma2_0) { | |
int n = num_elements(x); | |
real loglik = 0; | |
real m = mu0 - alpha0 / (2 * a); | |
real lambda0 = -alpha0 ^ 2 / (4 * a); | |
real sigma2 = sigma2_0; | |
for (i in 1 : n - 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
library(pracma) # for hyperbolic functions | |
library(Rcpp) | |
library(rethinking) # log_sum_exp | |
cppFunction('NumericVector clip( NumericVector x, double a, double b){ | |
return clamp( a, x, b ) ; | |
}') | |
log_cosh <- function(x) { | |
return( x + log1p(expm1(-2 * 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
<div class="demo-wrapper"> | |
<!-- classnames for the pages should include: 1) type of page 2) page name--> | |
<div class="s-page random-restored-page"> | |
<div class="page-content"> | |
<h2 class="page-title">Some minimized App</h2> | |
</div> | |
<div class="close-button s-close-button">x</div> | |
</div> | |
<div class="s-page custom-page"> | |
<div class="page-content"> |
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
zodiac <- function(year) { | |
element <- structure(rep(c("Metal", "Water", "Wood", "Fire", "Earth"), each = 2), | |
.Names = 0:9 | |
) | |
sign <- structure(c( | |
"Monkey", "Rooster", "Dog", "Pig", "Rat", | |
"Ox", "Tiger", "Rabbit", "Dragon", | |
"Snake", "Horse", "Goat" | |
), |
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
#!/bin/bash | |
# first clone the stan docs repo | |
# git clone https://github.com/stan-dev/docs.git | |
# then cd into it and run this script | |
grep_version=$(grep -V) | |
grep_=${1:-grep} | |
bsd='BSD' | |
if [[ $(grep -V) == *"$bsd"* ]] && [[ $# -eq 0 ]] |