VERSION 5.00 Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX" Begin VB.Form Form1 Caption = "Form1" ClientHeight = 1785 ClientLeft = 60 ClientTop = 345 ClientWidth = 6450 LinkTopic = "Form1" ScaleHeight = 1785 ScaleWidth = 6450 StartUpPosition = 3 'Windows の既定値 Begin VB.TextBox Text2 Height = 375 Left = 360 TabIndex = 2 Text = "3.異なる個体数間のt−検定" Top = 720 Width = 2775 End Begin MSComDlg.CommonDialog CommonDialog1 Left = 6000 Top = 1320 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.CommandButton Command1 Caption = "INPUT 0; Student (*.js), Others: Sensei (*.txt) file output" Height = 975 Left = 4800 TabIndex = 1 Top = 240 Width = 1575 End Begin VB.TextBox Text1 Height = 375 Left = 3720 TabIndex = 0 Top = 360 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 13, 1 To 2) As Integer Dim t(16 To 22, 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, n1, n2, m, p, q As Integer q = 0 t(16, 1) = 2.12 t(16, 2) = 2.921 t(17, 1) = 2.11 t(17, 2) = 2.898 t(18, 1) = 2.101 t(18, 2) = 2.921 t(19, 1) = 2.093 t(19, 2) = 2.861 t(22, 1) = 2.074 t(22, 2) = 2.819 Form1.AutoRedraw = True yr = Val(Mid$(Date$, 3, 4)) Print yr Randomize (yr + 13) 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 '繰り返し数' '以下n1番号のサイクル変更' d = m Mod 3 If p = 1 And d = 1 Then n1 = 11 If p = 1 And d = 2 Then n1 = 9 If p = 1 And d = 0 Then n1 = 7 If p = 2 And d = 1 Then n1 = 7 If p = 2 And d = 2 Then n1 = 11 If p = 2 And d = 0 Then n1 = 9 If p = 3 And d = 1 Then n1 = 9 If p = 3 And d = 2 Then n1 = 7 If p = 3 And d = 0 Then n1 = 11 If n1 = 11 Then n2 = 13 If n1 = 9 Then n2 = 11 If n1 = 7 Then n2 = 11 SEITO: iSa1 = 0 iSa2 = 0 iSa21 = 0 iSa22 = 0 For j = 1 To 2 If j = 1 Then n = n1 Else n = n2 For i = 1 To n k = 0 If j = 1 And n1 = 11 Then k = 8 If j = 1 And n1 = 9 Then k = 3 If j = 1 And n1 = 7 Then k = 2 iSeito(i, j) = Rnd * 10 + k 'データ作成' Next i Next j For i = 1 To n1 iSa1 = iSa1 + iSeito(i, 1) iSa21 = iSa21 + iSeito(i, 1) ^ 2 Next i For i = 1 To n2 iSa2 = iSa2 + iSeito(i, 2) iSa22 = iSa22 + iSeito(i, 2) ^ 2 Next i cF1 = iSa1 ^ 2 / n1 cF2 = iSa2 ^ 2 / n2 hEikin1 = iSa1 / n1 hEikin2 = iSa2 / n2 hEihowa1 = iSa21 - cF1 hEihowa2 = iSa22 - cF2 hEkinheho = (hEihowa1 + hEihowa2) / (n1 + n2 - 2) hYojun = ((n1 + n2) * hEkinheho / (n1 * n2)) ^ (1 / 2) tValue = (hEikin1 - hEikin2) / hYojun If tValue < 0 Then GoTo SEITO ' Form1.Print m, p, n1, cF1, cF2, tValue ' If Val(Len(cF1)) < 10 Then GoTo SEITO If Val(Len(cF2)) < 10 Then GoTo SEITO 'n1=11は**' If n1 = 11 And Abs(tValue) < t(n1 + n2 - 2, 2) Then GoTo SEITO 'n1=7はns' If n1 = 7 And Abs(tValue) > t(n1 + n2 - 2, 1) Then GoTo SEITO 'n1=9は*' If n1 = 9 And (Abs(tValue) > t(n1 + n2 - 2, 2) Or Abs(tValue) < t(n1 + n2 - 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 If j = 1 Then n = n1 Else n = n2 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(n1 + n2 - 2, "##."); Print #1, " "; Print #1, Format(t(n1 + n2 - 2, 1), "###.####"); Print #1, " "; Print #1, Format(t(n1 + n2 - 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 If j = 1 Then n = n1 Else n = n2 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