/* nag_stat_prob_durbin_watson (g01epc) Example Program.
*
* Copyright 2024 Numerical Algorithms Group.
*
* Mark 30.1, 2024.
*/
#include <nag.h>
#include <stdio.h>
int main(void) {
/* Scalars */
double d, pdl, pdu;
Integer exit_status, ip, n;
NagError fail;
INIT_FAIL(fail);
exit_status = 0;
printf("nag_stat_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_stat_prob_durbin_watson (g01epc).
* Computes bounds for the significance of a Durbin-Watson
* statistic
*/
nag_stat_prob_durbin_watson(n, ip, d, &pdl, &pdu, &fail);
if (fail.code != NE_NOERROR) {
printf("Error from nag_stat_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;
}