	#ifndef gpos_2
    #define gpos_2
	#import "histo"
	#import <maximize>
	
	class garchPOS
	{
	decl

	m_mData,
	m_mAllData,
	m_sDataLabel,

	
	m_i_AR_lags,
	m_i_e0_mode, 				//initial conditions (disturbances) - 0-fixed, 1-estimated
	m_i_h0_mode, 				//initial h - 0-fixed, 1-estimated
	m_i_GARCH_mode,				//0 - no conditional heteroskedasticity
	m_i_GJR_mode,				// 1- GJR GARCH	  
	m_i_ni_par,					//2 - ni1,ni2 estimated, 1- one ni estimated, 0 - ni known - fixed;
	m_i_ni_mode,				//if m_i_ni_par = 1:  0 - ni1=ni2, 1: ni1 known, ni2 estimated, 2: ni1 estimated, ni2known.
	m_i_alpha_mode,				//1- alpha estimated, 0 - alpha fixed = 0 (actual alpha in AST =0,5)
	m_i_eta_par,				// 0 - no additional GARCH parameters, 1- one additional GARCH parameter etc
	m_i_inMean_mode,			//
	m_m_PrPar,
	m_m_PrParD,
	m_i_PredHor,
	m_qmat,
	m_m_Real_Obs,
	m_s_FLabel,
	m_b_Pred,					// 1 - calculate forecasts, 0 - don't
	m_b_PredES,
	m_i_DrawDOF,
	
	m_d_apha_known,
	m_d_ni_known,
	m_d_ni_max,					//upper  bound of niu (in order to faciliate computation of the gamma function)
	m_d_e0_known,
	m_d_h0_known,
	m_d_ni_min,
	m_d_PhiLTrunc,
	m_d_PhiRTrunc,
	m_d_Y0,
	m_i_pred_mult,
	m_i_pr_buff,
	m_iBasicCycle,
	m_iNumCycles,
	
	m_i_NF,						//input: number of cyclical factors =sizer(m_i_AmplitudeConfig)	 0 - no cyclical factors

	m_v_SSum,
	m_m_Seas_Config,
	m_av_Common_Amplitudes,		//input:  which cyclical factor goes where
	m_m_Freq_Config,			//input: two rows, first row - no of frequencies, second row - number of cyclical factors with the same set of frequencies
	m_m_Cycle_Config,			//which cycle goes where (rows: 0-Mean, 1-variance,2-left tail,3-right tail,4-alpha (AST))
	m_m_Amplitude_Config,		//
	m_m_AC,
	m_am_Draw_Cvm,
	m_am_Draw_Cvm2,
	m_iNRsc,
	m_d_lim_corr_ht,			//usu 0.99999 actual garch stability restriction
	m_b_instab_ind,
	m_m_scale_amp,
	m_m_Mat_sel,
	m_m_DrawZt,
	m_i_ZNum,

	
	m_i_kernel_mode,			// 0 - posterior; 1- likelihood only; 2 - prior only;
	m_i_Est_Mode,				//technical, operating mode of posterior_kernel function
	m_m_iPar,					//interpretable parameters (functions of), dimension not depending on T
	m_i_iParBasic_Num,
	m_i_iParExtra_Num,
	m_v_Probs,
	m_v_AddPars,
	m_v_ParConf,				//technical - actual vs general set of parameters
	m_v_ParStart,
	m_d_Logl,
	m_d_LogPr,
	
	m_as_iTPar_Labels,			//labels for  m_m_iTPar
	m_as_iPar_Labels,			//labels for  m_m_iPar
	m_as_addPar_Labels,			//labels for additional (funtions of ) parameters
	m_as_probLabels,			//labels for probability estimates
	m_as_iGen_Par_Labels,		//actual input, 
	
	m_i_Group_Mode,				//modes for grouping parameters (for drawing)
	m_m_sPar_Groups,			//grouping of statistical parameters
	m_m_iPar_Groups,			//grouping of interpretable parameters (for histograms)
	m_i_Init_Iters,				//initial iterations of maximization procedure
	m_v_Exceptions,				//indicates exceptions like explosive ht or too high niu to accurately compute Gamma(ni)
	
	m_d_delta_PriorPrec,
	m_d_delta_PriorDF,
	m_d_alpha0_PriorA,
	m_d_alpha0_PriorB,
	m_d_lambda_PriorPrec,
	m_d_lambda_PriorDF,
	m_d_ni_PriorA,
	m_d_ni_PriorB,
	m_d_alpha00_PriorPrec,
	m_d_alpha00_PriorDF,
	m_d_e0_PriorPrec,
	m_d_e0_PriorDF,
	m_d_h0_PriorA,
	m_d_h0_PriorB,
	m_d_gamma_PriorPrec,
	m_d_gamma_PriorDF,

	m_v_cd_quantiles,
	m_mXr,
	
//	m_i_NoFreqSets,				// =sizer(m_v_FreqConfig)
	m_ik1,
	m_iD,
	m_iT;
	


	
	garchPOS(const s_file_label,i_var_number);
	posterior_kernel(const vP, const adFunc, const avScore, const amHessian);
	set_spec();
	estimate();
	transformation_from_pcorr(const part_corr);
	draw_sast(const T, const a, const ni1, const ni2);
	//draw_sast2(const T, const a, const ni1, const ni2, const ast, const d, const m);

	};

	 #endif 