/* nag_tsa_multi_inp_model_estim(g13bec) 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 2 #define NPMAX 10 #define NXXYMX 50 #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("g13bec Example Program Results\n"); Vscanf(" %*[^\n]"); /* Skip heading in data file */ ex1(); ex2(); return EXIT_SUCCESS; } static void ex1(void) { double df, objf, rss; Integer i, j, npara, nseries, nxxy, inser; double para[NPMAX], sd[NPMAX], xxy[NXXYMX][NSERMX]; Nag_ArimaOrder arimav; Nag_TransfOrder transfv; static NagError fail; Vprintf("\ng13bec example 1: no option setting.\n\n"); /* Skip heading in data file */ Vscanf(" %*[^\n]"); Vscanf("%ld%ld", &nxxy, &nseries); if (nxxy>0 && nxxy<=NXXYMX && nseries>0 && nseries<=NSERMX) { /* * 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 && nxxy<=NXXYMX && nseries>0 && nseries<=NSERMX) { /* * Set some specific option variables to the desired values. */ options.criteria = Nag_Marginal; options.print_level = Nag_Soln_Iter_Full; /* * 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