// File created by PcNaive on 19-04-2004 at 12:39:31
///////////////////////////////////////////////////////////
#include <packages/PcNaive/PcNaiveExt.ox>

///////////////////////////////////////////////////////////
// CPcNaive derived class CAR1Exp
class CAR1Exp : CPcNaive
{
	CAR1Exp();						// constructor
	~CAR1Exp();						// destructor
	Generate(const iRep, const cT,	// generate replication
		const mxT);
	TransformY(const mY);
	TransformZ(const mZ);
};
CAR1Exp::CAR1Exp()
{
	ranseed("LE");

	CPcNaive(<50:[10]100>+1, 20, 0, 2000, 1, -1, 1, 
		<0.05>, 
		<0.9>);

	m_dgp = new CPcNaiveDgp(1, 0);	// create the DGP

	m_dgp.SetYParameter(
		<0>,
		<0.9>,
		0,
		<0>);
	m_dgp.SetZParameter(
		0,
		0,
		0);
	m_dgp.SetDistribution(U_DGP, NORMAL,
		<0>,
		<1>);
	m_dgp.SetDistribution(Z_DGP, MVNORMAL,
		0,
		0);

	SetRecursive(1);

	m_sys = new CMyModel();		// create the system/model
	CPcNaive::CreateData(1, 0);		// create the system database

									// formulate the model
	m_sys.Select(Y_VAR, { "Ya", 0, 0} );
	m_sys.Select(Y_VAR, { "Ya", 1, 1} );

	m_sys.SetEval(50, 100, 0);
	m_sys.AddEvalCoef(COEF_BETA, 0, 0);
	m_sys.AddEvalTest(TEST_TVAL, 0, 0);
	AddPlot(PLOT_HCOEF);
	AddPlot(PLOT_HTEST);
	AddPlot(PLOT_RCOEF);
	AddPlot(PLOT_RPVAL);
	SetPlotStep(2000);

	Update();
	println("PcNaive run: ", oxfilename(0));
	Report(1, 1, 0);
}
CAR1Exp::~CAR1Exp()
{
	~CPcNaive();					// call base destructor
}

CAR1Exp::Generate(const iRep, const cT, const mxT)
{
	CPcNaive::Generate(iRep, cT, mxT);// update data

	m_sys.Estimate();				// estimate the model
									// get and store the statistics:
	m_mTest = m_sys.GetEvalTest();	// 2nd row: p-values
	m_mCoef = m_sys.GetEvalCoef();	// column vector
return TRUE;
}
CAR1Exp::TransformY(const mY)
{
// mY is the T x n matrix with Y variables,
// There are 2n custom vars, "CY0" "CY1", ...;  e.g.:
// Renew( mY[][0] - mY[][1], "CY0");  // CY0 is Ya-Yb

}
CAR1Exp::TransformZ(const mZ)
{
// mZ is the T x q matrix with Z variables,
// There are 2q custom vars, "CZ0" "CZ1", ...;  e.g.:
// Renew( mZ[][0] - mZ[][1], "CZ0");  // CZ0 is Za-Zb

}
///////////////////////////////////////////////////////////

main()
{
	decl exp = new CAR1Exp();
	exp.Simulate();
	delete exp;
}
