Skip to content

Instantly share code, notes, and snippets.

⚔️

S-Katagiri Gedevan-Aleksizde

⚔️
Block or report user

Report or block Gedevan-Aleksizde

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View VARMA11.stan
/* VARMA (1,1) */
data {
int<lower=1> T ; // num observations
int<lower=1> N ; // num series
vector[N] y[T] ; // observed outputs
int<lower=0> T_forecast ; // forecasting span
}
parameters {
View VARMApq.stan
/* VARMA (p,q) */
data {
int<lower=1> T ; // num observations
int<lower=1> N ; // num series
int<lower=0> p ; // AR(p)
int<lower=0> q ; // MA(q)
vector[N] y[T] ; // observed outputs
int<lower=0> T_forecast ; // forecasting span
}
View Rstan_VARMA11.R
library(tidyr) # ver. 0.3.1.
library(dplyr) # ver. 0.4.3
library(rstan) # ver. 2.9.0
library(forecast) # ver. 6.2
# 並列化させる設定
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
setwd("~/Documents/blog/20160212_StanVARMA/") # 任意のフォルダに書き換える
View Rstan_VARMApq.R
library(tidyr) # ver. 0.3.1.
library(dplyr) # ver. 0.4.3
library(rstan) # ver. 2.9.0
library(forecast) # ver. 6.2
# 並列化させる設定
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
N <- 2 # num series
View Rstan_VARMA11_2.R
library(tidyr) # ver. 0.3.1.
library(dplyr) # ver. 0.4.3
library(rstan) # ver. 2.9.0
library(forecast) # ver. 6.2
rstan_options(auto_write = TRUE)
options(mc.cores = parallel::detectCores())
# VARMA(1,1) N=2
N <- 2 # num series
Time <- 400 # span
View Gaussian_VARMA.stan
/* VARMA (p,q) */
data {
int<lower=1> T ; // num observations
int<lower=1> N ; // num series
int<lower=0> p ; // AR(p)
int<lower=0> q ; // MA(q)
vector[N] y[T] ; // observed outputs
int<lower=0> T_forecast ; // forecasting span
}
View varma_pop.R
library(tidyr) # ver. 0.3.1.
library(dplyr) # ver. 0.4.3
library(rstan) # ver. 2.9.0
library(forecast) # ver. 6.2
library(zoo) # ver. 1.7-11
library(gdata) # ver. 2.13.3
library(loo) # ver. 0.1.6
View RFM_Bayes.stan
/* -----------------------------------------------------------------------------
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
View RFM_stan_exec.R
library(dplyr)
library(tidyr)
library(ggplot2)
library(rstan)
library(loo)
# working directory
work.dir <- "HOGEHOGE/20160406_RFM"
df <- read.csv(paste(work.dir, "rfm.csv",sep="/"), stringsAsFactors = F)
View rfm_handle.py
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# coding: utf-8
# In[1]:
get_ipython().magic('matplotlib inline'
import pystan # ver. 2.9.0.0
import numpy as np # ver.1.11.0
import pandas as pd # ver. 0.18.0 # xlrd, mumxpr module needed
You can’t perform that action at this time.