loelschlaeger / fhmm Goto Github PK
View Code? Open in Web Editor NEWHidden Markov models for finance
Home Page: https://loelschlaeger.de/fHMM/
License: GNU General Public License v3.0
Hidden Markov models for finance
Home Page: https://loelschlaeger.de/fHMM/
License: GNU General Public License v3.0
Add brackets for functions in flowchart.
Try
controls = list(
id = "test",
sdds = c("normal","normal"),
states = c(3,2),
time_horizon = c(100,30),
at_true = TRUE,
overwrite = TRUE,
seed = 4
)
and see that this gives an odd x-scale in sdds.pdf
. Set them based on distribution limits.
Check the new functions set_controls
and prepare_data
for clear documentation and expected behavior.
First of all - I love the package! I struggled with some not-so-userfriendly packages in the past, but this is really something else!
To my question - is there existing funtion in the package to visualize/plot only the simulated data but with the same structure, visualizing the state scales underneath?
If not - is the simulated data bundled together with the data I fitted the model on in the data.rds file?
In the picture above, logReturns and dataRaw with 2714 elements. I only modelled a year, so this got to be all of the data, right? So I only need to fetch he last 365 elements and then I'm fine?
I do hope I was clear enough. If there are any confusion, just leave a quick comment and I will try to explain further.
Thanks in advance,
Carlos
Incorporate covariates into the state process(es) to determine which factors affect the probabilities of switching to bearish and bullish markets, respectively (just an idea, perhaps something for later versions of the package!).
Create (tikz?) graphic of package functions.
Use model results to forecast the market.
write funtion "check_controls" that checks control parameters and gives output about model formulation
Log-return averages on the coarse scale seems not to be the best idea. It's hard for the code to detect different states / state switches for this type of data.
Include parameter in controls
to select type of coarse scale data (e.g. sum of absolute values, mean, average of absolute values). Plot coarse-scale data in ts.pdf to see if this yields better data.
Use option hessian=FALSE
in nlm
and only hessian=TRUE
in final estimation run. Should give speed improvement.
Implement coef
method to extract estimated model coefficients.
E.g. check_estimation
or checkEstimation
or check.estimation
?
Add #' @export
as last Roxygen tag for user-level functions.
packageName::functionName()
instead of functionName()
to avoid conflicts.Give controls parameter "data" which is a list containing all parameters related to data processing/simulation. Update documentation.
Beim Durchlaufen dieses Codes:
simulated HMM -----------------------------------------------------------
seed = 1
controls = list(
states = 3,
sdds = "gamma",
horizon = 500,
fit = list("runs" = 100)
)
controls %<>% set_controls
data = prepare_data(controls, seed = seed)
data %>% summary
data %>% plot
model = fit_model(data, ncluster = 1, seed = seed) %>%
decode_states %>%
compute_residuals
summary(model)
model %<>% reorder_states(state_order = 1:3)
compare(model)
model %>% plot("ll")
model %>% plot("sdds")
wird der 3. Status leider nicht richtig erkannt. Ich habe dasselbe auch mit 1000 Runs einmal ausgeführt, geändert hat sich am Ergebnis allerdings nichts.
Try the fixed-dfs model
controls = list(
id = "test",
sdds = c("t(Inf)",NA),
states = c(2,0),
time_horizon = c(100,NA),
seed = 1
)
and see that two states cannot be identified. However, the dfs-flexible model
controls = list(
id = "test",
sdds = c("t",NA),
states = c(2,0),
time_horizon = c(100,NA),
seed = 1
)
works.
Hi,
I am trying to fit an hhmm on copper data, however, after
fit_hmm(controls, events)
the following error pops up:
Error in check_controls(controls): File './data/x.csv' not found.
Thank you in advance for the support.
Make sure that the reference style is consistent in ref.bib (to discuss).
controls
via ncores
.check_controls
, read out available number of cores, give warning if not (all-1) and error if too many (>=all) cores are used.ncores
batches. Last one has ceiling(runs/ncores)
runs, all others floor(runs/ncores)
runs. Implement progress bar for last batch. ncores
must not exceed runs
.Run github instance, error reported
A collection of ideas on how to further extend the code:
download_data
in 'data.R'.Write own code for progress + ETA output. Remove dependence to "progress" package.
simulate HMM and HHMM (depending on N=0 or N!=0)
For empirical data, implement that the fine-scale horizon can be monthly / quarterly. Leads to different fine-scale chunk sizes. In this case warning, if !controls[["data_cs_type"]] in c("mean","mean_abs")
Give controls parameter "nlm" which is a list containing all parameters that can be passed to nlm. Update documentation.
Transform graphics from base R to ggplot2.
Gives output %18-s 3 / 2
instead of number of states: 3 / 2
Try
controls = list(
id = "test",
sdds = c("normal","normal"),
states = c(3,2),
time_horizon = c(100,30),
at_true = TRUE,
overwrite = TRUE,
seed = 4
)
and see that the pseudo-residuals of the fine scale are not normal.
Extend code for other state-dependent distributions:
fix_dfs
in controls
)t(Inf)
Include control sdd
(character vector of length two).
Set JSS paper structure and metadata.
I'm doing an analysis of our predictions and I would like to access the output in a list/array so I could run MAPE, MSE and some other indicators. I can't seem to find it - where is it?
add small executable examples in main .Rd-files to illustrate the use of the exported function but also enable automatic testing
I'm raising the issue again - I can't find the simulated data in the provided model files. Just the graphical representation. I've looked through the output files and I can't find it.
See residuals and ts plot.
Document
in ReadMe. Make sim_par
to thetaList
object.
Implement function that creates LaTeX output of model formulation and results.
@return
to roxygen tags and explain the functions results in the documentation.@return
tag in
Include test for normality of pseudo-residuals, see package tseries, function jarque.bera.test.
download_data("dax", "^GDAXI", path=".")
download_data("hk", "HEN3.DE", path=".")
horizon: 2020-01-02 to 2021-03-01
Warnings:
Ensure that functions do not write by default in the user's home filespace (including the package directory and getwd()). This is not allowed by CRAN policies.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.