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