/* nag_tsa_multi_inp_model_forecast(g13bjc) Example Program * * Copyright 1991 Numerical Algorithms Group. * * Mark 2, 1991. */ #include #include #include #include #include static void ex1(void); static void ex2(void); #define NSERMX 6 #define NPMAX 10 #define LDPARX 8 #define NFVMAX 10 #define NEVMAX 40 #define LDXXY NEVMAX + NFVMAX #define TDMRX NSERMX #define TDPARX NSERMX #define TDXXY NSERMX int main(void) { /* Two examples are called, ex1() which uses the * default settings to solve the problem and * ex2() which solves the same problem with * some optional parameters set by the user. */ Vprintf("g13bjc Example Program Results\n"); Vscanf(" %*[^\n]"); /* Skip heading in data file */ ex1(); ex2(); return EXIT_SUCCESS; } static void ex1(void) { Integer i, j, n, nev, nfv, npara, nseries, inser; double fsd[NFVMAX], fva[NFVMAX], para[NFVMAX], parx[LDPARX][NSERMX], rmsxy[NSERMX], xxy[LDXXY][NSERMX]; Integer mrx[7][NSERMX]; Nag_ArimaOrder arimav; Nag_TransfOrder transfv; static NagError fail; Vprintf("\ng13bjc example 1: no option setting.\n\n"); /* Skip heading in data file */ Vscanf(" %*[^\n]"); Vscanf("%ld%ld%ld", &nev, &nfv, &nseries); if (nseries>0 && nseries<=NSERMX && nev>0 && nev<=NEVMAX && nfv>0 && nfv<=NFVMAX) { /* * Allocate memory to the arrays in structure transfv containing * the transfer function model orders of the input series. */ g13byc(nseries, &transfv, NAGERR_DEFAULT); /* * Read the orders vector of the ARIMA model for the output noise * component into structure arimav. */ Vscanf("%ld%ld%ld%ld%ld%ld%ld", &arimav.p, &arimav.d, &arimav.q, &arimav.bigp, &arimav.bigd, &arimav.bigq, &arimav.s); /* * Read the transfer function model orders of the input series into * structure transfv. */ inser = nseries - 1; for (j=0; j0 && nseries<=NSERMX && nev>0 && nev<=NEVMAX && nfv>0 && nfv<=NFVMAX) { /* * Set option variable to the desired value. */ options.cfixed = TRUE; /* * Allocate memory to the arrays in structure transfv containing * the transfer function model orders of the input series. */ g13byc(nseries, &transfv, NAGERR_DEFAULT); /* * Read the orders vector of the ARIMA model for the output noise * component into structure arimav. */ Vscanf("%ld%ld%ld%ld%ld%ld%ld", &arimav.p, &arimav.d, &arimav.q, &arimav.bigp, &arimav.bigd, &arimav.bigq, &arimav.s); /* * Read the transfer function model orders of the input series into * structure transfv. */ inser = nseries - 1; for (j=0; j