分散分析ライブラリ 使用例



[ 簡単な説明 ]

分散分析ライブラリの使用例です。

特に、入力データを l × m サイズ( l 個のブロックを m 個つなげる)の1次元配列で与えることに注意して下さい。

プログラム・ソース("test24.c")           top (先頭に戻る)
/*		test24.c		*/
#include <stdio.h>
#include "sslib.h"

int main(void)
{
	int l, m, n, nua, nub, nue, nut;
	static int nn[5] = { 10, 8, 9, 10, 10 };
	static double x[50] =
		{ 15.1, 14.8, 15.0, 14.7, 14.0, 13.8, 14.8, 15.5, 14.1, 14.4,
		  14.4, 14.3, 13.8, 15.9, 14.1, 14.6, 14.0, 14.4,  0.0,  0.0,
		  13.2, 13.8, 14.5, 13.6, 12.7, 13.4, 13.7, 14.4, 13.0,  0.0,
		  13.4, 14.6, 12.9, 13.7, 14.0, 13.1, 12.0, 14.1, 14.5, 13.3,
		  14.1, 13.9, 14.5, 13.8, 14.8, 16.0, 14.6, 14.4, 15.3, 15.1 };
	static double x2[12] =
	{ 39.2, 41.8, 38.6, 37.4, 40.4, 42.1, 40.5, 41.3, 43.6, 44.9, 42.2, 42.2 };
	double al, sa, sb, se, st, va, vb, ve, f, fa, fb, f0, f0a, f0b;

	l = 10;
	m = 5;
	al = 0.05;
	aov1(x, nn, l, m, al, &sa, &se, &st, &nua, &nue, &nut, &va, &ve, &f0, &f);
	printf("test results from aov1 !\n");
	printf("            S      nu     V      F0\n");
	printf("factor(a) %7.3f %3d %7.3f %7.3f\n", sa,nua, va, f0);
	printf("factor(e) %7.3f %3d %7.3f\n",se, nue, ve);
	printf("total     %7.3f %3d\n", st, nut);
	printf("   f(%4.2f) = %7.3f\n", al, f);

	l = n = 4;
	m = 3;
	al = 0.05;
	aov2(x2, l, m, n, al, &sa, &sb, &se, &st, &nua, &nub, &nue, &nut,
		&va, &vb, &ve, &f0a, &f0b, &fa, &fb);
	printf("\ntest results from aov2 !\n");
	printf("            S      nu     V      F0\n");
	printf("factor(a) %7.3f %3d %7.3f %7.3f\n", sa, nua, va, f0a);
	printf("factor(b) %7.3f %3d %7.3f %7.3f\n", sb, nub, vb, f0b);
	printf("factor(e) %7.3f %3d %7.3f\n", se, nue, ve);
	printf("total     %7.3f %3d\n", st, nut);
	printf(" fa(%4.2f) = %7.3f\n", al, fa);
	printf(" fb(%4.2f) = %7.3f\n", al, fb);
	return 1;
}

出力結果           top (先頭に戻る)
test results from aov1 !
            S      nu     V      F0
factor(a)  11.661   4   2.915   6.745
factor(e)  18.153  42   0.432
total      29.814  46
   f(0.05) =   2.594

test results from aov2 !
            S      nu     V      F0
factor(a)  31.672   2  15.836  23.587
factor(b)  13.257   3   4.419   6.582
factor(e)   4.028   6   0.671
total      48.957  11
 fa(0.05) =   5.143
 fb(0.05) =   4.757