Code Monkey home page Code Monkey logo

gas's People

Contributors

ardiad avatar leopoldocatania avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gas's Issues

Can extract residuals from univariate GAS model

I cannot extract the residuals

gas_spec <- UniGASSpec(Dist = "std", ScalingType = "Inv",
GASPar = list(location = TRUE, scale = TRUE, shape = FALSE))
gas_sp_fit <-UniGASFit(gas_spec,dji30ret[1:1000,"GE"])

residuals(gas_sp_fit)
Error: $ operator not defined for this S4 class
residuals(gas_sp_roll)
Error: $ operator not defined for this S4 class

Install Error: DistWrap.cpp:13:20: fatal error: negbin.h: No such file or directory

Here is the error message.

> devtools::install()
These packages have more recent versions available.
Which would you like to update?

1: All                                             
2: CRAN packages only                              
3: None                                            
4: xts          (0.11-2      -> 0.12-0     ) [CRAN]
5: zoo          (1.8-6       -> 1.8-7      ) [CRAN]
6: RcppArmad... (0.9.800.1.0 -> 0.9.860.2.0) [CRAN]

Enter one or more numbers, or an empty line to skip updates:
3checking for file 'D:\work\clone2install\GAS/DESCRIPTION' (548ms)
-  preparing 'GAS': (2.2s)
√  checking DESCRIPTION meta-information
-  cleaning src
-  installing the package to process help pages
-  saving partial Rd database (3m 19.8s)
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts (4.9s)
-  checking for empty or unneeded directories (392ms)
-  looking to see if a 'data/datalist' file should be added
-  building 'GAS_0.3.2.tar.gz'
   
Running "C:/PROGRA~1/R/R-36~1.0/bin/x64/Rcmd.exe" INSTALL \
  "C:\Users\LIJIAX~1\AppData\Local\Temp\RtmpuSvMUw/GAS_0.3.2.tar.gz" --install-tests 
* installing to library 'C:/Program Files/R/R-3.6.0/library'
* installing *source* package 'GAS' ...
** using staged installation
** libs
-
*** arch - i386
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG  -I"C:/Program Files/R/R-3.6.0/library/Rcpp/include" -I"C:/Program Files/R/R-3.6.0/library/RcppArmadillo/include"        -O2 -Wall  -mtune=generic -c Density.cpp -o Density.o
C:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-36~1.0/include" -DNDEBUG  -I"C:/Program Files/R/R-3.6.0/library/Rcpp/include" -I"C:/Program Files/R/R-3.6.0/library/RcppArmadillo/include"        -O2 -Wall  -mtune=generic -c DistWrap.cpp -o DistWrap.o
DistWrap.cpp:13:20: fatal error: negbin.h: No such file or directory
 #include "negbin.h"
                    ^
compilation terminated.
make: *** [C:/PROGRA~1/R/R-36~1.0/etc/i386/Makeconf:215: DistWrap.o] Error 1
ERROR: compilation failed for package 'GAS'
* removing 'C:/Program Files/R/R-3.6.0/library/GAS'

I fork this package and install it locally (Because I find the R-CRAN version is removed.)

Here is the session information for my system.

"si"
#> [1] "si"

Created on 2020-04-26 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                                              
#>  version  R version 3.6.0 (2019-04-26)                       
#>  os       Windows 7 x64 SP 1                                 
#>  system   x86_64, mingw32                                    
#>  ui       RTerm                                              
#>  language (EN)                                               
#>  collate  Chinese (Simplified)_People's Republic of China.936
#>  ctype    Chinese (Simplified)_People's Republic of China.936
#>  tz       Asia/Taipei                                        
#>  date     2020-04-26                                         
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version    date       lib source                        
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.2)                
#>  backports     1.1.5      2019-10-02 [1] CRAN (R 3.6.1)                
#>  callr         3.2.0      2019-03-15 [1] CRAN (R 3.6.0)                
#>  cli           2.0.1      2020-01-08 [1] CRAN (R 3.6.2)                
#>  crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.0)                
#>  desc          1.2.0      2018-05-01 [1] CRAN (R 3.6.0)                
#>  devtools      2.1.0      2019-07-06 [1] CRAN (R 3.6.1)                
#>  digest        0.6.19     2019-05-20 [1] CRAN (R 3.6.0)                
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                
#>  fansi         0.4.0      2018-10-05 [1] CRAN (R 3.6.0)                
#>  fs            1.3.1      2019-05-06 [1] CRAN (R 3.6.0)                
#>  glue          1.3.1      2019-03-12 [1] CRAN (R 3.6.0)                
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.1)                
#>  knitr         1.27       2020-01-16 [1] CRAN (R 3.6.2)                
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.1)                
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.1)                
#>  pkgbuild      1.0.3      2019-03-20 [1] CRAN (R 3.6.1)                
#>  pkgload       1.0.2      2018-10-29 [1] CRAN (R 3.6.1)                
#>  prettyunits   1.0.2      2015-07-13 [1] CRAN (R 3.6.0)                
#>  processx      3.3.1      2019-05-08 [1] CRAN (R 3.6.0)                
#>  ps            1.3.0      2018-12-21 [1] CRAN (R 3.6.0)                
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.2)                
#>  Rcpp          1.0.4.6    2020-04-09 [1] CRAN (R 3.6.3)                
#>  remotes       2.1.0      2019-06-24 [1] CRAN (R 3.6.1)                
#>  rlang         0.4.4      2020-01-28 [1] CRAN (R 3.6.0)                
#>  rmarkdown     2.1        2020-01-20 [1] CRAN (R 3.6.2)                
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                
#>  stringi       1.4.3      2019-03-12 [1] CRAN (R 3.6.0)                
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                
#>  testthat      2.3.2      2020-03-02 [1] CRAN (R 3.6.3)                
#>  usethis       1.5.1.9000 2020-02-04 [1] Github (r-lib/usethis@e7c1f17)
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                
#>  xfun          0.8        2019-06-25 [1] CRAN (R 3.6.1)                
#>  yaml          2.2.0      2018-07-25 [1] CRAN (R 3.6.0)                
#> 
#> [1] C:/Program Files/R/R-3.6.0/library

How does one forecast next point in time series using GAS package in R as well as retrieving fited values?

I am using the GAS (Generalised Auto regressive score) package in R in order to forecast a chosen time series. I have read package documentation as well as your published paper and I struggle with understanding how they forecast the next time step.

Here is some code:

`gas_model <- UniGASSpec(Dist = "std", ScalingType = "Identity",
GASPar = list(location = TRUE, scale = TRUE, shape = FALSE))

gas_fit <- UniGASFit(gas_model, time_series)

gas_forecast <- UniGASFor(gas_fit, H = 1, ReturnDraws = T)

prediction_point <- mean(gas_forecast@Draws)`

So how does this work exactly? The gas_forecast function forecasts parameters of a predictive distribution of the next time step? Then we draw samples from that distribution and take mean to estimate expected value of predicted distribution? Is this the next forecasted value in the time series, i.e. prediction of time point t+1 (given H = 1)? Have does one simply forecast next point in time series using this package? The natural follow up question is: How does one retrieve fitted values?

Errors on UGASRoll methods; ES performance; classification problems

Hi,

First, thanks for such a great package. There are 3 things I would like to ask:

Classification problem:

If I get it right, the GAS can be used for both regression and classification problems. I would like to know which distributions would be the most suitable for:

  1. binary classification problem (say 0 and 1).
  2. multiclass classification problem (say -1, 0, 1)?

My plan is to label financial time series as {0,1} or {-1,0,1} and try to apply GAS for VAR/ES prediction. I am even sure this is possible.

ES performance

Estimating the expected shortfall is very slow for some distributions (for example ast). Is there a possibility to estimate ES in parallel to boost performance?

Errors

There are some errors for UGASRoll methods:

  1. residuals method for std distribution returns an error:
Error in NextMethod(.Generic) : 
  dims [product 500] do not match the length of object [6022]
In addition: Warning message:
In `-.default`(vY, mMoments[, 1L]) :
  longer object length is not a multiple of shorter object length
  1. coef method for std distribution returns an error:
Error: $ operator not defined for this S4 class

Addition of Generalised Lambda Distribution (GLD)

Hello Catania,

I would suggest to you to add the Generalised Lambda Distribution (GLD) and its various forms to the number of distributions implemented in the GAS package.

I hope to see this in the near future.

Thank you.

Update reference and citation files

@LeopoldoCatania we should fix the package and update the way people cite the package; check my 3 points added to the github page. I follow David Hsieh practice. We should now push so that people cite our contribution

getMoments returns wrong number of rows

Hi,

in the current CRAN version of this package (0.2.9), I observed the problem that the number of conditional moments does not match the length of the return series for a simulated GAS process. Same problem with getFilteredParameters, quantile, and ES.

Steps to reproduce this problem:

r <- rnorm(1000)
spec <- GAS::UniGASSpec()
fit <- GAS::UniGASFit(spec, r)
sim <- GAS::UniGASSim(fit = fit, T.sim = 1000)
r_sim <- getObs(sim)
moments_sim <- getMoments(sim)
stopifnot(length(r_sim) == nrow(moments_sim))

testthat

We should add a couple of tests in testthat folder

Generalized Error Distribution

Dear developers,

Thank you for the work done with the GAS package. I have two questions about it. I see that you included a large number of distributions but left out the Generalized Error Distribution (GED); which is available in other nearby packages such as rugarch. 1) Did you not include this distribution because it is not compatible with the GAS model? Or for no specific reason?
2) Is a GAS-GED or GAS-skGED model theoretically possible? If its possible and is theoretically correct a GAS model with GED distribution I would be interested in programming this distribution to integrate it into the package, if you agree.

Best,
Alejandro

Installation

library("GAS")
Error in library("GAS") : there is no package called ‘GAS’
GAS::BacktestVaR(data = EUROots, VaR = BenchEUROVaR_0.01, alpha = 0.01)
Error in loadNamespace(name) : there is no package called ‘GAS’

facing this issue even after the compilation of the package during installation.

GAS 0.3.0 removed from CRAN on 2020-02-24

This package is no longer available, but it contains incredibly useful functions (such as Engle—Manganelli’s DQ test). One has to resort to install_version from devtools.
Is there any chance to see it online again after the problems with the package mentioned by CRAN are addressed?

package ‘truncnorm’ is not available (for R version 3.3.3)

Can't load the library under R version 3.3.3 as the package truncnorm is required which only supports R 3.4 and above.

`library(GAS)

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘truncnorm’
Error: package or namespace load failed for ‘GAS’

install.packages("truncnorm")

Warning in install.packages :
package ‘truncnorm’ is not available (for R version 3.3.3)`

As per docs below it was built using 3.3.3, can you have a look please

Package: GAS
Type: Package
Title: Generalized Autoregressive Score Models
Version: 0.2.6
Author: Leopoldo Catania [aut,cre], Kris Boudt [ctb], David Ardia [ctb]
Maintainer: Leopoldo Catania [email protected]
Description: Simulate, estimate and forecast using univariate and multivariate GAS models
as described in Ardia et al. (2016) https://ssrn.com/abstract=2825380.
License: GPL-3
BugReports: https://github.com/LeopoldoCatania/GAS/issues
URL: https://github.com/LeopoldoCatania/GAS
LazyData: TRUE
Imports: Rcpp (>= 0.12.2), Rsolnp, MASS, xts, numDeriv, zoo
LinkingTo: Rcpp, RcppArmadillo
Depends: R (>= 3.2.0), methods
Suggests: testthat
NeedsCompilation: yes
Packaged: 2017-12-19 12:12:24 UTC; leopo
Repository: CRAN
Date/Publication: 2017-12-20 13:42:07 UTC
Built: R 3.3.3; x86_64-w64-mingw32; 2018-04-22 15:40:02 UTC; windows
Archs: i386, x64

BacktestVaR not valid for different quantiles

Dear Leopoldo Catania
I hope you are well.
I am using your package GAS to backtest VaR and ES estimates and I am running into the error below:
"Error in [.default(n, 2, 2) : subscript out of bounds".
This error occurs at the line where I run the BacktestVaR function. Please find attached the code (comments inside) and data used.

After several attempts and experimentation I realised the error stems from the quantile I choose for the VaR estimation (for instance 0.05 works while 0.01 does not work). In my work I am estimating VaR and ES for quantiles = [0.005, 0.001, 0.01, 0.05, 0.95, 0.99, 0.99] and I would like that the backtest works for all these quantiles.

Could this be a bug in the package/function?
Is there a way for you to help fix this error?

I would be glad to hear back from you.
Thank you.

Files are given below:
pola.txt

VaRES_cc_fmkl-gld_Ask.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.