[Scilab-users] GROCER VAR-HMM Example Output Different from Chapter 23

Brian Bouterse bmbouter at gmail.com
Fri May 23 14:13:02 CEST 2014


Thanks for the reply Eric. It is great to get hints and suggestions from
the author directly!

I used the commands that you outlined, and they were able to reproduce the
expected output verbatim, which is great. Thanks for clearing that up for
me. I've gotten further towards my goal.

I've now got three questions:

1)  I get an unexpected result when I run ms_var() on my own data. I run
these commands:

load('arhmm_example.dat')
nb_states=2
switch_var=2 // variances are switching
var_opt=3 // unrestricted var-cov matrix
r=ms_var('cte',3,'ardata',nb_states,switch_var,var_opt,'prt=initial;final','opt_convg=0')

I receive this output:

WARNING: in overlay, series number 2 has been ignored because of a bad
frequency
 !--error 10000
series ends before the end date of the bounds
at line      39 of function ts2vec0 called by :
at line     101 of function explone called by :
at line     253 of function ms_var called by :
r=ms_var('cte',3,'ardata',nb_states,switch_var,var_opt,'prt=initial;final','opt_convg=0')

The arhmm_example.dat file is available here[0], and it was made by
running.the following command on the original csv[1] file arhmm_example.csv.

impexc2bd('arhmm_example.csv', ';', 'arhmm_example.dat')

I believe I either don't have the dates configured correctly, or it
requires a specific number of data points to match the frequency value,
which also may be wrong. Do you have some insight into this error message?
I've been reading the docs on the ts structure, and I will continue to try
to solve this roadblock.


2) My goal in doing all this is to analyze Autoregressive Hidden Markov
Models. As I understand it, the VAR-HMM that ms_var provides is a
multivariate case of an Autoregressive Hidden Markov Model. The terms
Markov Switching Model, and Hidden Markov Model refer to the same thing.
Using a single variable with ms_var() as I show above in the example, will
simulate an AR-HMM(3). I would like to check if these statements agree with
your understanding.


3) How could I contribute to the grocer code. At the very least I could
improve the docs some.


[0]:  https://s3.amazonaws.com/dfsklfdsklfds/fdsjkfsdjkfds/arhmm_example.dat
[1]:  https://s3.amazonaws.com/dfsklfdsklfds/fdsjkfsdjkfds/arhmm_example.csv

Thanks,
Brian


On Tue, May 20, 2014 at 3:55 PM, Eric Dubois <grocer.toolbox at gmail.com>wrote:

> Hello Brian
>
> Sorry for this late answer, but I have been quite busy these days.
>
> I did not notice the problem with this version of the MS programs. Indeed
> I have changed the optimization device of all GROCER programs and I have
> not adapted the defaults for the MS programs.
>
> If you run:
> --> global GROCERDIR;
> --> load(GROCERDIR+'\data\us_revu.dat')
> --> bounds('1967m4','2004m2')
>
> --> nb_states=2
> --> switch_var=2 // variances are switching
> --> var_opt=3 // unrestricted var-cov matrix
>
> -->
> r=ms_var('cte',3,'100*(log(us_revu)-lagts(2,log(us_revu)))',nb_states,switch_var,var_opt,'prt=initial;final','opt_convg=0')
> (see chapter 6 of the manual for explanations)
>
> Then the results of the ms_var demo is restaured.
>
> I will change the default in Grocer next version .
>
> Regards.
>
> Éric.
>
>
> 2014-05-19 12:56 GMT+02:00 Brian Bouterse <bmbouter at gmail.com>:
>
>> Hi Scilab community!
>>
>> I'm new to Scilab, and the AR-HMM and VAR-HMM solving capabilities of
>> GROCER are what interest me.
>>
>> I have a question relating to Chapter 23 from the GROCER manual[0].  This
>> is the univariate MS-AR(3) solved using the function ms_reg_d() on the
>> us_revu.dat data included with GROCER.  I have made no adjustment from the
>> example statements in Chapter 23.
>>
>> The example output is shown on pages 4 and 5 of the Chapter 23 module.
>>  Compare that against the output I receive.
>>
>> http://fpaste.org/102978/14004958/
>>
>> Here are my questions:
>>
>> 1.  The numerical output is completely different.  I expected it to be
>> the same since the data is provided by GROCER, and I've done the example
>> exactly as shown in Chapter 23.  Is there some explanation to why the
>> solved solution I receive is different than the example output in the
>> chapter?
>>
>> 2.  I see output like %i*8.4469016 which seems like an error because %i
>> looks like a variable that yet needs to be replaced, and then multiplied to
>> get to its final value.  Is this some kind of bug or error?
>>
>> Thanks for any help the community can provide.  We'll be using this for a
>> seminar on HMM, AR-HMM, and VAR-HMM at North Carolina State University.
>>  I'm also a developer, so I really appreciate all the effort that has been
>> put into scilab and GROCER.
>>
>> Thanks,
>> Brian
>>
>>
>> [0]:  http://dubois.ensae.net/Grocer_manual_v1.6.zip
>>
>>
>> --
>> Brian Bouterse
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
>>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>


-- 
Brian Bouterse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20140523/3c1b560c/attachment.htm>


More information about the users mailing list