Coder Social home page Coder Social logo

nowcasting's People

Contributors

eric-qian 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

nowcasting's Issues

No update for the Initial State Covariance Matrix V_0

I believe that in line 243 of the dfm.m file the EMstep function should return V_0_new and not V_0. Due to this typo, the initial state covariance matrix is not updated in the algorithm. It does not seem to affect estimations by a lot, but we are leaving loglikelihood on the table.

Simplified branch with flexible inputs

@brandynbok, @eric-qian --- I have a modified version of this code that is simplified for teaching purposes and is somewhat more flexible in terms of inputs. If it's of any interest I'd be happy to implement it as a separate branch. Otherwise, if it's OK, I'd like to host it on my own repo. Thanks!

Daily and Weekly data incorporation

Dear @brandynbok and @eric-qian ,

Thank you for this code. You have done an amazing work.

I am currently trying to incorporate daily and weekly data into the current model. The research paper by Modugno is a bit difficult to understand.

In the code :
You give a tent type structure from quarterly to monthly
r_mat = [2, -1, 0, 0, 0; 3, 0, -1, 0, 0; 2, 0, 0, -1, 0; 1, 0, 0, 0, -1]

Could you explain where this come from and how I can change this for my daily/ weekly model.

Wrong expression to initial values of restricted parameters

Dear @eric-qian and @eric-qian

Thank you for the code!

In line 715 of dfm.m, the expression for the initial values of the observation matrix is using inv(ff_j'*ff_j) instead of ff_j'*ff_j as described in Maximum likelihood estimation of factor models on data sets with arbitrary pattern of missing data

It seems a minor issue as it affects only the initial values, but the current expression do not create the parameters following the given restriction matrices

Thank you

Question regarding calculation of vec_C in EMstep

Dear @brandynbok and @eric-qian ,

First of all, thank you for the code, which is very well written and documented!

I have a question of calculation of vec_C in the function EMstep:

In line 464 in dfm.m there is a - between the first part of the equation ( y(idx_iM, t) * Zsmooth(bl_idxM(i, :), t+1)') and the second part starting with the selection matrix W_t ( Wt(:, i_idio_i) ).

The code refers to Equation 13 in BGR2010, but there is +between the 2 parts of the equation. The same holds for BM2010, p15, 1st equation.

Could you elaborate or is this a mistake?

Thank you and best regards,
Stefan

References:
BM2010: Marta Banbura & Michele Modugno (2010), Maximum likelihood estimation of factor models on data sets with arbitrary pattern of missing data, ECB Working Paper No 1189.

BGR2010: Marta Banbura, Domenico Giannone and Lucrezia Reichlin (2010), Nowcasting, in Oxford Handbook on Economic Forecasting, Michael P. Clements and David F. Hendry, editors,

can't find runKF()

Line 241 of dfm.m reads % Note: Kalman filter (runKF()) is in the 'functions' folder, but I don't see runKF in the functions folder.

Will the newer version be available?

I found that a more advanced method had been applied to usa quaterly gdp nowcasting, and my reseach is based on this work. So the code will be available?

decreasement of likelihoodfunction

Dear @brandynbok and @eric-qian ,

First of all, thank you for the code, which is very well written and documented!
I have a question about the likelihood in the interation of EM step . When I set the initial value of the parameter to a random number,the value of likelihood decrease with the interation of EM .
ooking forward to hearing more from you on this matter.
Thank you for your answer.

Regards
Weiwei Cao

Question regarding R_new and V_0_new in EMstep

Hi @brandynbok and @eric-qian ,

I am currently studying the matlab code in detail and trying to understand the mechanics of the model. Apologies in advance if I miss something obvious as I am not familiar with Matlab (my background is in Python and R).

I am concerned about the variables R_new and V_0_new in the function EMstep.

For R_new, the variable holds a diagonal matrix of 1e-4. However, I cannot understand why there is a need to have additional calculations when R_new will always be a diagonal matrix of 1e-4. Is there ever a need for the additional calculations for R_new if it will always be a diagonal matrix of 1e-4, or am I missing something?

Nowcasting/functions/dfm.m

Lines 528 to 543 in f783ce3

R_new = zeros(n,n);
for t=1:T
Wt = diag(~nanY(:,t)); % Selection matrix
R_new = R_new + (y(:,t) - ... % BGR equation 15
Wt * C_new * Zsmooth(:, t+1)) * (y(:,t) - Wt*C_new*Zsmooth(:,t+1))'...
+ Wt*C_new*Vsmooth(:,:,t+1)*C_new'*Wt + (eye(n)-Wt)*R*(eye(n)-Wt);
end
R_new = R_new/T;
RR = diag(R_new); %RR(RR<1e-2) = 1e-2;
RR(i_idio_M) = 1e-04;
RR(nM+1:end) = 1e-04;
R_new = diag(RR);
end

For V_0_new, the variable holds V_0 and gets updated throughout the code:

  • V_0_new = V_0;: Line 321
  • V_0_new(t_start:t_end, t_start:t_end) =...: Line 365
  • V_0_new(i_subset, i_subset) = diag(diag(Vsmooth(i_subset, i_subset, 1)));: Line 397
  • V_0_new(i_idio_jQ, i_idio_jQ) = Vsmooth(i_idio_jQ, i_idio_jQ,1);: Line 499

However, the function EMstep does not return the updated V_0_new. The reason I am concerned about V_0 is because Z_0 gets updated:

  • Z_0 = Zsmooth(:,1); %zeros(size(Zsmooth,1),1); %: Line 403

Any thoughts would be much appreciated!
Thanks!

The update of loading matrix C

Dear @brandynbok and @eric-qian ,

First of all, thank you for the code, which is very well written and documented!

I have a question of updating of the matrix C in the function EMstep:

after finished the iteration of EM step ,the matrix C just change a little and the coefficient of quartly variable do not change .I want to know that's why and how to deal with this problem .

Thank you and best regards,
Weiwei Cao

The common component

Dear @brandynbok and @eric-qian ,

Thank you for the code. It is very well written and documented!
I have a question regarding last the two plots in the example_dfm.m.
The second plot that plots the common factor uses the standardized smoothed value of all the variables on the y-axis but for the common component uses only the INDPRO variable. What is the reason for that?

Also, in the last plot. The project of common component onto PAYEMS and GDPC1. Shouldn't the common component be a lot smoother than the original data.

Looking forward to hearing more from you on this matter.
Thank you for your answer.

Regards
Ahmed Junaid Khalid

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.