SoftIntegration Demos for Ch NAG Statistics Package
Demos
Ch
Toolkit Demos
Ch Mechanism
Ch Control System
Ch CGI
Ch ODBC
ChExcel
C++ Library Demos
Graphical Library
Package Demos
Ch NAG Statistics

In a Ch shell or Ch IDE, run the following C program:

> g02brc.ch

You will get the output:


g02brc Example Program Results

Correlation coefficients:
 
 1.00000  0.85714  0.12849
 0.71429  1.00000  0.33040
 0.10287  0.41148  1.00000

Contents for program g02brc.ch are listed below.

/* nag_ken_spe_corr_coeff(g02brc) Example Program * * Copyright 1992 Numerical Algorithms Group. * * Mark 3, 1993. */ #include <nag.h> #include <stdio.h> #include <nag_stdlib.h> #include <nagg02.h> #define NMAX 20 #define MMAX 30 Integer m=3, n=7; double x[NMAX][MMAX] = { {1.0, 2.0, 4.0}, {7.0, 7.0, 3.0}, {2.0, 3.0, 4.0}, {4.0, 4.0, 5.0}, {5.0, 6.0, 7.0}, {3.0, 1.0, 3.0}, {6.0, 5.0, 5.0} }; Integer svar[MMAX] = {1, 1, 1}, sobs[NMAX] = {1, 1, 1, 1, 1, 1, 1}; Integer i, j, tdx, tdc; double corr[MMAX][MMAX]; tdx = MMAX; tdc = MMAX; printf("g02brc Example Program Results\n"); /* Calculate the Kendall and Spearman coefficients */ g02brc(n, m, &x[0][0], tdx, &svar[0], &sobs[0], &corr[0][0], tdc, NAGERR_DEFAULT); printf("\nCorrelation coefficients:\n\n"); for (i=0; i<m; i++) { for (j=0; j<m; j++) { printf("%8.5f ", corr[i][j]); } printf("\n"); }