Print

Print


Ok. Everything is clear.
You cannot use SetStsmModel() for multivariate models. In order to do
multivariate modelling, you have to assign the system matrices "by hand": it
is actually very easy.

Matteo Pelagatti
Assistant Professor
Dept. of Statistics
University of Milan-Bicocca
Tel. +39 02 64485834


-----Messaggio originale-----
Da: Floris van Ruth [mailto:[log in to unmask]] 
Inviato: giovedì 8 febbraio 2007 22.58
A: [log in to unmask]; Matteo Pelagatti
Oggetto: Re: R: Multivariate UC models in OX

I'm working with the algorithms from ssfpack provided by professor Koopman,
but i've been unable to adapt them for multivariate use. Here is where I
stranded:


	//initialise Stsm model
	s_mSsf =       < CMP_LEVEL		, 2, 0        , 0 ;
			   CMP_SLOPE		, 2, 0        , 0 ;	  
			   CMP_SEAS_DUMMY	, 2, 12		  , 0;
			   CMP_CYC_1		, 2, M_2PI/40 , 0.9 ;
			   CMP_IRREG		, 2, 0        , 0 ;

			   CMP_LEVEL		, 2, 0        , 0 ;
			   CMP_SLOPE		, 2, 0        , 0 ;	  
			   CMP_SEAS_DUMMY	, 2, 12		  , 0;
			   CMP_CYC_1		, 2, M_2PI/40 , 0.9 ;
			   CMP_IRREG		, 2, 0        , 0>;


initPar()
{
	decl vPar, dlik;	 
	vPar = zeros(14,1);
	vPar[:4] = log(0.3);
	vPar[5] = freq1;	// period of cycle  
	vPar[6] = 0.9;	// rho  initial value 
	vPar[7:11] = log(0.3);
	vPar[12] = freq1;	// period of cycle 
	vPar[13] = 0.9;	// rho  initial value 
		

SetStsmModel(const vPar)
{
	s_mSsf[0][0] = 2;
	s_mSsf[1][0] = 2;
	s_mSsf[2][0] = 2;
	s_mSsf[3][0] = 2;
	s_mSsf[4][0] = 2;
   	s_mSsf[5][0] = 2;
	s_mSsf[6][0] = 2;
	s_mSsf[7][0] = 2;
	s_mSsf[8][0] = 2;
	s_mSsf[9][0] = 2;	
	s_mSsf[0][1] = exp(vPar[0]);				//
sigma_eta,
	s_mSsf[1][1]= exp(vPar[1]);
//  slope sigma
	s_mSsf[2][1]=exp(vPar[2]);
	s_mSsf[3][1] = exp(vPar[3]);				//
sigma_psi
	s_mSsf[4][1] = exp(vPar[4]);				 //
sigma_eps
	s_mSsf[3][2]   = M_2PI/(2+exp(vPar[5]));	      	// frequency
of the cycle
component
	s_mSsf[3][3]   = vPar[6]; 	// consistency parameter of the
cycle component
	s_mSsf[5][1] = exp(vPar[7]);
	s_mSsf[6][1]= exp(vPar[8]);
	s_mSsf[7][1]=exp(vPar[9]);
	s_mSsf[8][1] = exp(vPar[10]);
	s_mSsf[9][1] = exp(vPar[11]);
	s_mSsf[8][2]   = M_2PI/(2+exp(vPar[12]));
	s_mSsf[8][3]   = vPar[13]; 	
	


I doubt this is the way to go. Would appreciate all help. An alternative
might be to construct the matrices myself, but I would prefer to work via
the ssfpack algorithms.

thanks, Floris van Ruth