[Scilab-users] Grocer / Markov Switching Model

Eric Dubois grocer.toolbox at gmail.com
Fri Jan 11 09:17:22 CET 2013


To load data, you have many solutions. For time series I recommend to store
your data in a .txt file, transform the dates in a suitable format (that is
1993q1, 1993q2, etc.), set the name of the corresponding column to "dates"
and use impexc2bd (see impexc2bd). And have a look at chapter 5 of the
manual (as well as chapters 1, 2 and 3  which can also be helpful before
starting any econometric estimation).

For the second question, using one of the functions ms_var, ms_reg or
ms_mean indicates that you are estimating a Markov-switching model: there
rare not other steps inovolved!

Lastly, I do not understand what you mean by "conditioning the var-cov
matrix"; if by this, you mean that the var-cov matrix is different
according to the state of the economy, then give as 3rd argument of
function ms_mean of 5th argument of function ms_reg the number of states
you assumes the economy can experience (this is what is done in the example
provided in ms_reg_d() with the instruction :"switch_var=2 // variances are
switching").

Éric.


PS : turnpoints is a subroutine used by the brybos program, therefore not
relevant for Markov-switching estimation

2013/1/10 ericdoblas <ericdoblasargentina at yahoo.com.ar>

> Dear Éric,
>
> The following information is  in you example, but I have a lot of doubts,
> for exmple:
>
>
> ----- How to load the data?
> ----- How indicate it is MSM?
>
>
> I hope you can help me!!
>
> Thank you very much!
>
> Eric Doblas
>
>
> function [bcp,bct] = turnpoints(y,k)
>
> // PURPOSE: rough selection of peaks and troughs indexes
> //---------------------------------------------------------------------
> // INPUT:
> // . y = vector of data
> // . k = x(t-i)>x(t) & x(t+i)>x(t), i=1:k defines a trough at t
> //       x(t-i)<x(t) & x(t+i)<x(t), i=1:k defines a peak at t
> //---------------------------------------------------------------------
> // OUTPUTS :
> // . bcp = vector of peak indexes
> // . bct = vector of trough indexes
> //---------------------------------------------------------------------
> // Translated to Scilab by E. Michaux (2005)
> // from Julien Matheron
> // Banque de France, centre de recherche, sept. 2002
>
> [T,n] = size(y);
> if T<n then
>    y = y';
>    [T,n] = size(y);
> end;
> v = zeros(T,n);
>
> // ------------------------------------------
> // I. Defines the k-dependent logical
> // argument of the following "if-loops"
> // ------------------------------------------
>
> s_up = "(y(i)>y(i-1))";
> s_do = "(y(i)<y(i-1))";
>
> for step = 2:k;
>    s_up = joinstr(s_up,msprintf("&(y(i)>y(i-%d))",step),'+');
>    s_do = joinstr(s_do,msprintf("&(y(i)<y(i-%d))",step),'+');
> end;
>
> for step=1:k
>    s_up = joinstr(s_up,msprintf("&(y(i)>y(i+%d))",step),'+');
>    s_do = joinstr(s_do,msprintf("&(y(i)<y(i+%d))",step),'+');
> end;
>
>
> // ------------------------------------------
> // II. Defines peaks
> // ------------------------------------------
>
> for i = k+1:T-k ;
>    if evstr(s_up) then
>       v(i) = 1;
>    end;
> end
> bcp = find(v>0)'; // selects indexes such that a peak occurs
>
> // ------------------------------------------
> // III. Defines troughs
> // ------------------------------------------
>
> v = zeros(T,n); // reinitializes v
>
> for i = k+1:T-k
>    if evstr(s_do) then
>       v(i) = 1 ;
>    end;
> end;
> bct = find(v>0)'; // selects indexes such that a trough occurs
> endfunction
>
>
>
>
> --
> View this message in context:
> http://mailinglists.scilab.org/Grocer-Markov-Switching-Model-tp4025635p4025649.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive
> at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20130111/7a0ab171/attachment.htm>


More information about the users mailing list