/* nag_glm_poisson(g02gcc) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * * Mark 6 revised, 2000. */ #include #include #include #include #include static void set_enum(char linkc, Nag_Link *link, char meanc, Nag_IncludeMean *mean); #define NMAX 15 #define MMAX 9 #define TDX MMAX #define TDV MMAX+6 int main(void) { char linkc, meanc, weightc; Nag_Link link; Nag_IncludeMean mean; Integer i, j, m, n, ip; double ex_power; Integer sx[MMAX]; double b[MMAX], v[NMAX][TDV], wt[NMAX], x[NMAX][MMAX], y[NMAX]; double *wtptr, *offsetptr=(double *)0; Integer max_iter; Integer print_iter; double eps; double tol; double df; double dev; Integer rank; double se[MMAX], cov[MMAX*(MMAX+1)/2]; static NagError fail; Vprintf("g02gcc Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf(" %c %c %c %ld %ld %ld", &linkc, &meanc, &weightc, &n, &m, &print_iter); /* Check and set control parameters */ set_enum(linkc, &link, meanc, &mean); if (n<=NMAX && m0) ip += 1; if (mean == Nag_MeanInclude) ip += 1; if (link == Nag_Expo) Vscanf("%lf", &ex_power); else ex_power = 0.0; /* Set other control parameters */ max_iter = 10; tol = 5e-5; eps = 1e-6; g02gcc(link, mean, n, &x[0][0], (Integer)TDX, m,sx, ip, y, wtptr, offsetptr, ex_power, &dev, &df, b, &rank, se, cov, &v[0][0], (Integer)TDV, tol, max_iter, print_iter, "", eps, &fail); if (fail.code == NE_NOERROR || fail.code == NE_LSQ_ITER_NOT_CONV || fail.code == NE_RANK_CHANGED || fail.code == NE_ZERO_DOF_ERROR) { Vprintf("\nDeviance = %12.4e\n", dev); Vprintf("Degrees of freedom = %3.1f\n\n", df); Vprintf(" Estimate Standard error\n\n"); for (i=0; i