BT variation of MSM model is implemented in Go.
De-meaned returns are modelled as
Refer to Calvet and Fisher (2001)1
The original model parametrises the transition probabilities of Markov chains
This allows
The model is implemented as unconstrained optimisation with suitable parameter transformation. There are a total of
msm -k 4 -n 200 -w 240 -i input.csv -o results.csv
Command line flags:
-i string
Name of csv file containing return data
-k int
MSM model dimension, +ve integer, caution: k > 10 can take minutes to run
-n int
Number of simulations for computing mean and std dev of vol estimate, minimum 100 (default 200)
-o string
Name of output file (default "results.csv")
-w int
Time window for vol prediction in number of bars, minimum 30 (default 30)
The output file is a csv containing model parameters, negative log likelihood, model dimension, mean of predicted vol and std dev of predicted vol. Std error of mean can be inferred as std dev / sqrt(n).