Skip to content

Instantly share code, notes, and snippets.

View Gedevan-Aleksizde's full-sized avatar
⚔️

S-Katagiri Gedevan-Aleksizde

⚔️
View GitHub Profile
/* -----------------------------------------------------------------------------
Estimate latent variable hierarchical Bayes RFM model
stan ver. 2.9
CREATED BY: 09/APR/2015, ill-identified
------------------------------------------------------------------------------- */
data {
int<lower=1> N ; // num of customers
@Gedevan-Aleksizde
Gedevan-Aleksizde / cross-platform-font-test.R
Last active September 10, 2021 13:34
font embedding test in R graphics
require(tidyverse)
fonts_win = tibble::tribble(
~family, ~name, ~group, ~os,
"Yu Mincho", "游明朝", "明朝", "windows 10",
"游明朝", "游明朝", "明朝", "windows 10", # WSL
"BIZ UDMincho", "BIZ UD明朝", "明朝", "windows 10",
"BIZ UD明朝", "BIZ UD明朝", "明朝", "windows 10",
"BIZ UDPMincho", "BIZ UDP明朝", "明朝", "windows 10",
"BIZ UDP明朝", "BIZ UDP明朝", "明朝", "windows 10",
# Auto generated file - do not change manually
# setWorkingDirToProjectDir
setWorkingDirToProjectDirLabel = プロジェクトのディレクトリを作業ディレクトリにする
setWorkingDirToProjectDirButtonLabel =
setWorkingDirToProjectDirMenuLabel = プロジェクトのディレクトリへ(_P)
setWorkingDirToProjectDirDesc = プロジェクトのルートディレクトリを作業ディレクトリにする
# setWorkingDirToActiveDoc
setWorkingDirToActiveDocLabel = Set Working Directory to Current Document's Directory
setWorkingDirToActiveDocButtonLabel =
#! /usr/bin/env bash
sudo apt install -yqq ./rstudio.deb
MKRUNUSERDIR_PATH="/usr/sbin/wsl-user-mk-runuserdir"
set -e
cat > ${MKRUNUSERDIR_PATH} << \EOF
### User runtime dir
# Executed as part of 00-wsl-user-env.sh
RUNUSER_DIR="/run/user"
@Gedevan-Aleksizde
Gedevan-Aleksizde / pop.pdf
Last active October 22, 2020 15:38
有限母集団のやつ
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Gedevan-Aleksizde
Gedevan-Aleksizde / Kalman.R
Last active December 9, 2019 01:28
Linear Kalman filter and animation
# multivariate normal Kalman filter
require(dplyr)
require(tidyr)
require(ggplot2)
require(animation)
# ARIMA(1,1) + 線形トレンド の乱数生成
N <- 50
phi1 <- .5
theta1 <- .2
require(KFAS) # 1.2.9
require(dplyr)
require(tidyr)
require(ggplot2)
require(data.table)
require(zoo)
##### read dataset #####
# https://catalog.data.gov/dataset/allegheny-county-crash-data
# data description
pacman::p_load_gh("uribo/fgdr", "franapoli/pbarETA")
pacman::p_load(sf, raster, tabularaster, tidyverse, broom, ggthemes, plotly, Metrics)
plot_surface <- function(mat) plot_ly(x=mat[, 1], y=colnames(mat), z=mat[, -1]) %>% add_surface()
options(pillar.sigfig = 10)
list_xml <- list.files("data", pattern="FG-GML-5133-36.+DEM5.+.xml", full.names=T)
pb <- txtProgressBar(min=2, max=length(list_xml), style=3, char="█", width=getOption("width") - 30)
source <- list()
for(i in 1:length(list_xml)){
require(rstan)
require(bayesplot)
require(ggplot2)
require(ggthemes)
require(patchwork)
require(tidyverse)
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
#### rstan でモデルをコンパイルしサンプリング ####