/* nag_regsn_mult_linear(g02dac) Example Program * * Copyright 1998 Numerical Algorithms Group. * * Mark 5 revised, 1998. * Mark 6 revised, 2000. */ #include #include #include #include #include static void ex1(void); static void ex2(void); int main(void) { ex1(); ex2(); return EXIT_SUCCESS; } #define NMAX 20 #define MMAX 20 #define TDX MMAX #define TDQ MMAX+1 static void ex1(void) { double rss, tol; Integer i, ip, rank, j, m, n; double df; Boolean svd; char weight, meanc; Nag_IncludeMean mean; double b[MMAX], cov[(MMAX*MMAX+MMAX)/2], h[NMAX], p[MMAX*(MMAX+2)], q[NMAX][MMAX+1], res[NMAX], se[MMAX], com_ar[MMAX*MMAX+5*(MMAX-1)], wt[NMAX], x[NMAX][MMAX], y[NMAX]; double *wtptr; Integer sx[MMAX]; Vprintf("g02dac Example 1 Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld %ld %c %c", &n, &m, &weight, &meanc); if (meanc=='m') mean = Nag_MeanInclude; else mean = Nag_MeanZero; if (n<=NMAX && m0) ip += 1; /* Set tolerance */ tol = 0.00001e0; g02dac(mean, n, &x[0][0], (Integer)TDX, m, sx, ip, y, wtptr, &rss, &df, b, se, cov, res, h, &q[0][0], (Integer)(TDQ), &svd, &rank, p, tol, com_ar, NAGERR_DEFAULT); if (svd) Vprintf("Model not of full rank, rank = %4ld\n\n", rank); Vprintf("Residual sum of squares = %12.4e\n", rss); Vprintf("Degrees of freedom = %3.1f\n\n", df); Vprintf("Variable Parameter estimate Standard error\n\n"); for (j=0; j