// g01ep Example Program Text // C# version, NAG Copyright 2008 using System; using NagLibrary; using System.Globalization; using System.IO; namespace NagDotNetExamples { public class G01EPE { static string datafile = "ExampleData/g01epe.d"; static void Main(String[] args) { if (args.Length == 1) { datafile = args[0]; } StartExample(); } public static void StartExample() { try { DataReader sr = new DataReader(datafile); double d, pdl, pdu; int ip, n; int ifail; Console.WriteLine("g01ep Example Program Results"); // Skip heading in data file sr.Reset(); sr.Reset(); n = int.Parse(sr.Next()); ip = int.Parse(sr.Next()); d = double.Parse(sr.Next(), CultureInfo.InvariantCulture); // if (n > ip) { // G01.g01ep(n, ip, d, out pdl, out pdu, out ifail); // Console.WriteLine(""); if (ifail == 0) { Console.WriteLine(" {0}{1,10:f4}", " Durbin-Watson statistic ", d); Console.WriteLine(""); Console.WriteLine(" {0}{1,10:f4}", " Probability for the lower bound = ", pdl); Console.WriteLine(" {0}{1,10:f4}", " Probability for the upper bound = ", pdu); } else { Console.WriteLine("** g01ep failed with ifail = {0,5}", ifail); } } else { Console.WriteLine(" {0}", " n <= ip."); } // } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine( "Exception Raised"); } } } }