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
" Pictures latest | |
filetype *.bmp,*.jpg,*.jpeg,*.png,*.xpm open -a Preview %f & | |
fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm | |
\ kitten icat --silent --transfer-mode=file --place=%pwx%ph@%pxx%py %c >/dev/tty </dev/tty %N | |
\ %pc | |
\ kitten icat --clear --silent >/dev/tty </dev/tty %N | |
" for mac < 15.1.1 | |
" fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm | |
" \ kitty +kitten icat --transfer-mode=file --place=%pwx%ph@%pxx%py %c %N |
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
filetype *.pdf open -a Preview %f & | |
fileviewer *.pdf | |
\ tput cup %py %px > /dev/tty && sips -s format jpeg %c --out /tmp/tempfile.jpg > /dev/null&& kitty +kitten icat --transfer-mode=file --place=%pwx%ph@%pxx%py /tmp/tempfile.jpg %N | |
\ %pc | |
\ kitty +kitten icat --transfer-mode=file --place=%pwx%ph@%pxx%py --clear %N |
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
" Video | |
filetype *.gif,*.avi,*.mp4,*.wmv,*.dat,*.3gp,*.ogv,*.mkv,*.mpg,*.mpeg,*.vob, | |
\*.fl[icv],*.m2v,*.mov,*.webm,*.ts,*.mts,*.m4v,*.r[am],*.qt,*.divx, | |
\*.as[fx] | |
\ {Open in IINA} | |
\ open -a IINA.app, | |
\ {Open in QuickTime Player} | |
\ open -a QuickTime\ Player.app, | |
\ {Open in MPlayerX} | |
\ open -a MPlayerX.app, |
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 N; // number of observations | |
array[N] corr_matrix[2] y; // A n-element arrary of observed correlation matrix [N, 2, 2] | |
} | |
parameters { | |
real<lower=0> eta; | |
} | |
model { | |
for (i in 1 : N) { | |
y[i, : , : ] ~ lkj_corr(eta); // y[i,] and y[i, ,] should also be fine |
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
my_lkjcorr_fun = " | |
functions { | |
// generate lkj correlation matrix (R) | |
matrix my_lkj_corr_rng(int K, real eta) { | |
return lkj_corr_rng(K, eta); | |
} | |
// generate cholesky factor L_corr of a correlation matrix R | |
matrix my_lkj_corr_chol_rng(int K, real eta){ | |
return lkj_corr_cholesky_rng(K, eta); |
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
# randomly generate a correlation matrix (R) | |
my_lkj_corr_rng(K = 2, eta = 1.4) | |
# [,1] [,2] | |
#[1,] 1.0000000 -0.8743114 | |
#[2,] -0.8743114 1.0000000 | |
# randomly generate a Cholesky factor (L) | |
(L_chol = my_lkj_corr_chol_rng(K = 2, eta = 1.4)) | |
# [,1] [,2] | |
#[1,] 1.00000000 0.000000 |
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
# y: a list of 100 matrices | |
y = map(1:100, ~ my_lkj_corr_rng(K = 2, eta = 1.4)) | |
# data_lkj_corr: a list of list | |
data_lkj_corr = list(N = 100, y = y) |
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
fit_lkj_corr = sampling(stan_lkj_corr, data=data_lkj_corr, | |
chains = 4, iter = 2000, cores = 4) | |
print(fit_lkj_corr) | |
# mean se_mean sd 2.5% 25% 50% 75% 97.5% n_eff Rhat | |
#eta 1.48 0.01 0.18 1.15 1.36 1.47 1.60 1.87 1263 1 | |
#lp__ -65.07 0.02 0.73 -67.08 -65.21 -64.78 -64.61 -64.56 1664 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
data { | |
int J; // number of predictors or features | |
int K; // outcome classes | |
int N; | |
array[N] int y; | |
matrix[N, J] X; | |
} | |
parameters { | |
matrix[J, K-1] beta; // number of predictor * number of classes-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
N <- 1000 | |
J <- 3 # number of predictors (intercept, slp1, slp2) | |
X <- cbind(1, rnorm(N, 0, 1), rnorm(N, 0, 1)) # N * J | |
K <- 3 # num of classes | |
beta <- rbind(c(1, -0.5, 0), | |
c(-2, 4, 0), | |
c(3, -1.5, 0)) | |
# J * K (features * classes) with the last class as the reference | |
# [cls1_intercept, cls2_intercept, cls3_intercept] | |
# [cls1_x1, cls2_x1, cls3_x1 ] |