Giter VIP home page Giter VIP logo

nowcasting's People

Contributors

daianemarcolino avatar greedblink avatar guilbran avatar stjdevalk 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  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  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

nowcasting's Issues

Wrong result while replicating NYFED model

Hi!

First of all, thank you for this great package, it is a pleasure to see a lot of tools (especially vintages based on the delay) made in such a simple form.

I've been working with an NYFED-like model for several years for Ukraine, but I've done it in MATLAB (where the original model is coded). Then I was asked to replicate it in R, my primary language.

I've found several possible issues, one of which is that results from MATLAB and R codes don't correspond to each other. Databases are exactly the same. There was an issue with transformations (they're different in raw codes), but I've fixed it and have made the same transformations for both cases (yoy for all variables, I know that economically its nonsense, but I want to simplify the statistical part as strong as possible).

But still, the result isn't the same. The intriguing part is that not only a nowcast doesn't correspond, the missed/filtered observations (for example GDP) are different.

Thank you for your attention and help!

Column order matters?

Not sure if this is a bug or my own ignorance, but I've noticed that the ordering of columns in the data seem to matter. Example:

library(nowcasting)
data(NYFED)

base <- NYFED$base
blocks <- NYFED$blocks$blocks
trans <- NYFED$legend$Transformation
frequency <- NYFED$legend$Frequency

#randomly generated reordering
shuffle <- c(7, 11, 24, 21, 10, 15, 2,1, 22, 25, 19, 5, 18, 17, 4, 12, 16, 6, 14, 23, 8, 9, 3, 13, 20)

base_shuffle <- base[,shuffle]
frequency_shuffle <- frequency[shuffle]
blocks_shuffle <- blocks[shuffle,]
trans_shuffle <- trans[shuffle]

x <- Bpanel(base = base, trans = trans, NA.replace = F, na.prop = 1)
x_shuffle <- Bpanel(base = base_shuffle, trans = trans_shuffle, NA.replace = F, na.prop = 1)

nowEM <- nowcast(formula = GDPC1 ~ ., data = x, r = 1, p = 1, 
                 method = "EM", blocks = blocks, frequency = frequency)
nowEM_shuffle <- nowcast(formula = GDPC1 ~ ., data = x_shuffle, r = 1, p = 1, 
                 method = "EM", blocks = blocks_shuffle, frequency = frequency_shuffle)

You can verify that nowEM$yfcst and nowEM_shuffle$yfcst are different. Why is this? Do you have any recommendations for a "correct" column order?

Fatores dinâmicos

Reparei que os fatores dinâmicos apresentados não são os mesmo utilizados na regressão de y, por que isso ocorre?

remNANs_spline() should not fail when rows have less than 80% of NANs

The following code fails when rowSums(indNAN) is always <= N*0.8 because then nanLead is empty and therefore X[-nanLE,] contains no rows and t1 and t2 will be infinite and the function stats::spline() will fail.

Instead the code should work in all cases including when there is no rows full of NaNs.
I don't understand why there is this 80% threshold.

}else if(options$method == 2){ # replace missing values after removing leading and closing zeros
   
   rem1 <- (rowSums(indNaN)>N*0.8)
   nanLead <- which(rem1)
   # nanEnd <- which(rem1[length(rem1):1])
   # nanLE <- c(nanEnd,nanLead)
   nanLE<-nanLead
   X<-X[-nanLE,]
   indNaN=is.na(X)
   for (i in 1:N){  
     x = X[,i]
     isnanx = is.na(x)
     t1 = min(which(!isnanx))
     t2 = max(which(!isnanx))
     
     x1<-stats::spline(x[t1:t2],xout = 1:(t2-t1+1))

Dúvida

Logo no início da função "nowcast" aparece esse código:

  if(is.null(q) & is.null(r) & is.null(p)){
    warnings('Parameters q, r and p must be specified.')
  }

Do que eu entendi o texto do warning não condiz com o código escrito. Se para entrar no if statement vc exige que os parâmetros q e r e p sejam não nulos, significa que se um deles não for nulo o statement será pulado. Daí o texto que eu entendo que deveria acompanhar seria "Parameters q, r or p must be specified.'"

Depois dá uma olhada nisso. Valeu!

Source code reference

I was testing the nowcast function, only to find that there is a function called EM_DFM_SS_block_idioQARMA_restrMQ in Nowcast.R

Res <- EM_DFM_SS_block_idioQARMA_restrMQ(x,Par)

Could you tell me how can I read the source code of this function? I may need to change some parameters. Thanks

Kalman filtering and EM in Rcpp

Hi,

It's great to finally see someone making a decent nowcasting package for R. A few years ago I made this (there's a more up-to-date version on gitlab) but never took the time to package it into something nice.

One thing I recall is that R was pretty slow in running EM, especially with long and large datasets, which led me to rewrite the Kalman filter and EM-algorithm in RcppArmadillo instead. I guess there should be significant amount of overlap and some of the C++ code might still re-usable in your case.

You went much further in the implementation though. 👍

Nowcasting with the EM algorithm without imposing block restrictions on the factors.

Hello,

I want to start by infinitely thanking the contributors/builders of this package! It has greatly smoothed the process of my application. However, I stumbled across a problem and I really hope that someone can help me with it!

I want to nowcast my dataset using the EM algorithm and only 1 factor without using the block structure sub-variable restrictions.
I really hope that someone can guide me through how to tweak the nowcast function into the matter, or if it is possible for me to achieve this through this package.

Thank you!
Best,
Carlos.

using quarterly data to forecast quarterly variable

sorry in advance, But I honestly don't know where can I ask for help regarding this question.
I just want to ask for advice regarding using explanatory variables that are of frequency=4 to forecast gdp with frequency of 4, is that possible using 2s and 2s_agg method
thank you in advance any help will be much appreciated

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.