/* nag_regress_confid_interval (g02cbc) Example Program. * * Copyright 1992 Numerical Algorithms Group. * * Mark 3, 1992. * Mark 8 revised, 2004. */ #include #include #include #include int main(void) { Integer exit_status=0, i, n; NagError fail; Nag_SumSquare mean; char m, w; double clm, clp, *h=0, *res=0, rms, *wt=0, *x=0, *y=0, *yhat=0, *yl=0, *yml=0; double *ymu=0, *yu=0; INIT_FAIL(fail); Vprintf("nag_regress_confid_interval (g02cbc) Example Program Results\n"); /* Skip heading in data file */ Vscanf("%*[^\n]"); Vscanf("%ld\n",&n); Vscanf("%lf%lf\n",&clm,&clp); Vscanf(" %c %c\n",&m,&w); if (n>=(m == 'M' || m == 'm' ? 2 : 1) ) { if ( !( x = NAG_ALLOC(n, double)) || !( y = NAG_ALLOC(n, double)) || !( wt = NAG_ALLOC(n, double)) || !( yhat = NAG_ALLOC(n, double)) || !( yml = NAG_ALLOC(n, double)) || !( ymu = NAG_ALLOC(n, double)) || !( yl = NAG_ALLOC(n, double)) || !( yu = NAG_ALLOC(n, double)) || !( h = NAG_ALLOC(n, double)) || !( res = NAG_ALLOC(n, double)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } } else { Vprintf("Invalid n.\n"); exit_status = 1; return exit_status; } if (m == 'm' || m == 'M') mean = Nag_AboutMean; else if (m == 'z'|| m == 'Z') mean = Nag_AboutZero; if (w == 'w' || w == 'W') for (i=0; i