/* nag_glm_gamma(g02gdc) Example Program. * * Copyright 1996 Numerical Algorithms Group. * * Mark 4, 1996. * */ #include #include #include #include #include static void set_enum(char linkc, Nag_Link *link, char meanc, Nag_IncludeMean *mean); #define NMAX 10 #define MMAX 2 #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, scale; 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("g02gdc Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf(" %c %c %c %ld %ld %ld %lf", &linkc, &meanc, &weightc, &n, &m, &print_iter, &scale); /* 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; g02gdc(link, mean, n, &x[0][0], (Integer)TDX, m, sx, ip, y, wtptr, offsetptr, &scale, 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