VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Begin VB.Form Form1 Caption = "Form1" ClientHeight = 1755 ClientLeft = 60 ClientTop = 345 ClientWidth = 5865 LinkTopic = "Form1" ScaleHeight = 1755 ScaleWidth = 5865 StartUpPosition = 3 'Windows の既定値 Begin VB.TextBox Text2 Height = 495 Left = 240 TabIndex = 2 Text = "2.対でない同数データのt−検定" Top = 600 Width = 2655 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 4800 Top = 1200 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.CommandButton Command1 Caption = "Input 0;Students (*.js) , Others ; Teacher (*.txt) file output" Height = 975 Left = 4320 TabIndex = 1 Top = 120 Width = 1455 End Begin VB.TextBox Text1 Height = 375 Left = 3360 TabIndex = 0 Top = 480 Width = 735 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Private Sub command1_click() '標本数の同じ2群データのt検定 0入力は学生,それ以外は教師用ファイル作成' Dim bango As Integer bango = Val(Text1.Text) CommonDialog1.ShowSave Open CommonDialog1.FileName For Output As #1 Dim iSeito(1 To 11, 1 To 2) As Integer Dim t(12 To 20, 1 To 2) As Single Dim k, cF1, cF2, hEikin1, hEikin2, hEihowa1, hEihowa2, hEkinheho, hYojun, tValue As Single Dim yr, d, iSa1, iSa2, iSa21, iSa22, i, j, n, m, p, q As Integer q = 0 t(12, 1) = 2.179 t(12, 2) = 3.055 t(14, 1) = 2.145 t(14, 2) = 2.977 t(16, 1) = 2.12 t(16, 2) = 2.921 t(18, 1) = 2.101 t(18, 2) = 2.878 t(20, 1) = 2.086 t(20, 2) = 2.845 Form1.AutoRedraw = True yr = Val(Mid$(Date$, 3, 4)) Print yr Randomize (yr + 11) If bango = 0 Then GoTo NOBANGO Else For m = 1 To 9 Print #1, ""; m; " "; Next m For m = 10 To 99 Print #1, ""; m; " "; Next m Print #1, "
" End If NOBANGO: For m = 1 To 100 '学生数' For p = 1 To 3 '繰り返し数' '以下n番号のサイクル変更' d = m Mod 3 If p = 1 And d = 1 Then n = 11 If p = 1 And d = 2 Then n = 9 If p = 1 And d = 0 Then n = 7 If p = 2 And d = 1 Then n = 7 If p = 2 And d = 2 Then n = 11 If p = 2 And d = 0 Then n = 9 If p = 3 And d = 1 Then n = 9 If p = 3 And d = 2 Then n = 7 If p = 3 And d = 0 Then n = 11 SEITO: iSa1 = 0 iSa2 = 0 iSa21 = 0 iSa22 = 0 For j = 1 To 2 For i = 1 To n k = 0 If j = 1 And n = 11 Then k = 8 If j = 1 And n = 9 Then k = 5 If j = 1 And n = 7 Then k = 2 iSeito(i, j) = Rnd * 10 + k 'データ作成' Next i Next j For i = 1 To n iSa1 = iSa1 + iSeito(i, 1) iSa21 = iSa21 + iSeito(i, 1) ^ 2 Next i For i = 1 To n iSa2 = iSa2 + iSeito(i, 2) iSa22 = iSa22 + iSeito(i, 2) ^ 2 Next i If iSa1 <= iSa2 Then GoTo SEITO cF1 = iSa1 ^ 2 / n cF2 = iSa2 ^ 2 / n If Val(Len(cF1)) < 10 Then GoTo SEITO If Val(Len(cF2)) < 10 Then GoTo SEITO hEikin1 = iSa1 / n hEikin2 = iSa2 / n hEihowa1 = iSa21 - cF1 hEihowa2 = iSa22 - cF2 hEkinheho = (hEihowa1 + hEihowa2) / (2 * (n - 1)) hYojun = (2 * hEkinheho / n) ^ (1 / 2) tValue = (hEikin1 - hEikin2) / hYojun ' Form1.Print m, p, n, Val(Len(cF1)), cF1, Val(Len(cF2)), cF2, tValue ' 'n=11は**' If n = 11 And Abs(tValue) < t(n + n - 2, 2) Then GoTo SEITO 'n=7はns' If n = 7 And Abs(tValue) > t(n + n - 2, 1) Then GoTo SEITO 'n=9は*' If n = 9 And (Abs(tValue) > t(n + n - 2, 2) Or Abs(tValue) < t(n + n - 2, 1)) Then GoTo SEITO If bango = 0 Then GoTo FILEFORSTUDENT End If If m < 10 And p = 1 Then Print #1, "" If m > 9 And p = 1 Then Print #1, "" Print #1, m; Print #1, "-"; Print #1, p For i = 1 To n Print #1, i; Next i Print #1, For j = 1 To 2 For i = 1 To n Print #1, iSeito(i, j); Next i Print #1, Next j Print #1, "計1,2,平均値1,2,(SS-CF=)平方和1,2,平均平方,標準偏差,t値" Print #1, iSa1; Print #1, iSa2; Print #1, Format(hEikin1, "###.####"); Print #1, " "; Print #1, Format(hEikin2, "###.####"); Print #1, " "; Print #1, iSa21; Print #1, iSa22; Print #1, " "; Print #1, Format(cF1, "###.######"); Print #1, " "; Print #1, Format(cF2, "###.######"); Print #1, " "; Print #1, Format(hEihowa1, "###.####"); Print #1, " "; Print #1, Format(hEihowa2, "###.####"); Print #1, " "; Print #1, Format(hEkinheho, "####.####"); Print #1, " "; Print #1, Format(hYojun, "####.####"); Print #1, " "; Print #1, Format(tValue, "##.####"); Print #1, " df="; Print #1, Format(n + n - 2, "##."); Print #1, " "; Print #1, Format(t(n + n - 2, 1), "###.####"); Print #1, " "; Print #1, Format(t(n + n - 2, 2), "###.####") GoTo TOBASU FILEFORSTUDENT: If p > 1 Then GoTo TOBU3 Print #1, "jsDB["; Print #1, q; Print #1, "]='"; TOBU3: Print #1, m; Print #1, "-"; Print #1, p, "
"; For j = 1 To 2 For i = 1 To n Print #1, iSeito(i, j); Next i Print #1, "
"; 'Print #1,' Next j If p = 3 Then Print #1, "No answer
'" GoTo TOBASU End If If p = 2 Then GoTo TDAKE End If Print #1, "平均値1,2,CF1,2, 平方和1,2,平均平方,標準偏差
"; Print #1, Format(hEikin1, "###.####"); Print #1, " "; Print #1, Format(hEikin2, "###.####"); Print #1, " "; Print #1, Format(cF1, "###.######"); Print #1, " "; Print #1, Format(cF2, "###.######"); Print #1, " "; Print #1, Format(hEihowa1, "###.####"); Print #1, " "; Print #1, Format(hEihowa2, "###.####"); Print #1, " "; Print #1, Format(hEkinheho, "####.####"); Print #1, " "; Print #1, Format(hYojun, "####.####"); Print #1, "
"; TDAKE: Print #1, "t値 "; Print #1, Format(tValue, "##.####"); Print #1, "
"; TOBASU: Next p q = q + 1 Next m Close #1 Form1.Print "OK" End Sub