frbny-timeseriesanalysis / nowcasting Goto Github PK
View Code? Open in Web Editor NEWNowcasting
License: BSD 3-Clause "New" or "Revised" License
Nowcasting
License: BSD 3-Clause "New" or "Revised" License
nevermind.
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?
Lines 528 to 543 in f783ce3
For V_0_new
, the variable holds V_0
and gets updated throughout the code:
V_0_new = V_0;
: Line 321V_0_new(t_start:t_end, t_start:t_end) =...
: Line 365V_0_new(i_subset, i_subset) = diag(diag(Vsmooth(i_subset, i_subset, 1)));
: Line 397V_0_new(i_idio_jQ, i_idio_jQ) = Vsmooth(i_idio_jQ, i_idio_jQ,1);
: Line 499However, 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 403Any thoughts would be much appreciated!
Thanks!
@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!
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
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
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.
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
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.
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,
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?
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.
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
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.