/* nag_prob_durbin_watson (g01epc) Example Program.
*
* Copyright 2017 Numerical Algorithms Group.
*
* Mark 26.1, 2017.
*/
#include <stdio.h>
#include <nag.h>
#include <nag_stdlib.h>
#include <nagg01.h>
int main(void)
{
/* Scalars */
double d, pdl, pdu;
Integer exit_status, ip, n;
NagError fail;
INIT_FAIL(fail);
exit_status = 0;
printf("nag_prob_durbin_watson (g01epc) Example Program Results\n");
/* Skip heading in data file */
scanf("%*[^\n] ");
scanf("%" NAG_IFMT "%" NAG_IFMT "%lf%*[^\n] ", &n, &ip, &d);
/* nag_prob_durbin_watson (g01epc).
* Computes bounds for the significance of a Durbin-Watson
* statistic
*/
nag_prob_durbin_watson(n, ip, d, &pdl, &pdu, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_prob_durbin_watson (g01epc).\n%s\n", fail.message);
exit_status = 1;
goto END;
}
printf("\n");
printf(" Durbin-Watson statistic %10.4f\n\n", d);
printf(" Probability for the lower bound = %10.4f\n", pdl);
printf(" Probability for the upper bound = %10.4f\n", pdu);
END:
return exit_status;
}