数理统计程序集

源代码在线查看: 分布假设检验f2.frm

软件大小: 2183 K
上传用户: jjjjjkkkkjkjkjk
关键词: 数理统计 程序
下载地址: 免注册下载 普通下载 VIP

相关代码

				VERSION 5.00
				Begin VB.Form frmCalculate 
				   Appearance      =   0  'Flat
				   BackColor       =   &H80000005&
				   Caption         =   "分布假设检验"
				   ClientHeight    =   3960
				   ClientLeft      =   60
				   ClientTop       =   450
				   ClientWidth     =   5610
				   LinkTopic       =   "Form1"
				   ScaleHeight     =   3960
				   ScaleWidth      =   5610
				   StartUpPosition =   3  '窗口缺省
				   Begin VB.OptionButton Option3 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "泊松分布"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   14.25
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   240
				      TabIndex        =   15
				      Top             =   1800
				      Width           =   1695
				   End
				   Begin VB.TextBox txtN1 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      Height          =   270
				      Left            =   3600
				      TabIndex        =   14
				      ToolTipText     =   "二项式分布(n,p)中的n"
				      Top             =   1320
				      Width           =   975
				   End
				   Begin VB.TextBox txtP1 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      Height          =   270
				      Left            =   3600
				      TabIndex        =   12
				      ToolTipText     =   "二项式分布(n,p)中的p"
				      Top             =   720
				      Width           =   975
				   End
				   Begin VB.OptionButton Option2 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "二项式分布"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   14.25
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   240
				      TabIndex        =   10
				      Top             =   1320
				      Width           =   1815
				   End
				   Begin VB.OptionButton Option1 
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "正态分布"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   14.25
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   240
				      TabIndex        =   9
				      Top             =   840
				      Value           =   -1  'True
				      Width           =   1575
				   End
				   Begin VB.CommandButton cmdExit 
				      Caption         =   "退  出"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   10.5
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      Height          =   375
				      Left            =   1080
				      TabIndex        =   1
				      Top             =   0
				      Width           =   1095
				   End
				   Begin VB.CommandButton cmdCheck 
				      Caption         =   "检  验"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   10.5
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      Height          =   375
				      Left            =   0
				      TabIndex        =   0
				      Top             =   0
				      Width           =   1095
				   End
				   Begin VB.Label Label3 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "随机试验次数"
				      ForeColor       =   &H80000008&
				      Height          =   255
				      Left            =   2760
				      TabIndex        =   13
				      Top             =   1080
				      Width           =   2535
				   End
				   Begin VB.Label Label2 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "一次试验事件所出现的概率"
				      ForeColor       =   &H80000008&
				      Height          =   255
				      Left            =   2520
				      TabIndex        =   11
				      Top             =   480
				      Width           =   3015
				   End
				   Begin VB.Label Label1 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "分布类型"
				      BeginProperty Font 
				         Name            =   "隶书"
				         Size            =   21.75
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   120
				      TabIndex        =   8
				      Top             =   360
				      Width           =   2415
				   End
				   Begin VB.Label lblD 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   120
				      TabIndex        =   7
				      Top             =   3480
				      Width           =   5415
				   End
				   Begin VB.Label Label8 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "检验结论"
				      BeginProperty Font 
				         Name            =   "隶书"
				         Size            =   26.25
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   615
				      Left            =   120
				      TabIndex        =   6
				      Top             =   2880
				      Width           =   5415
				   End
				   Begin VB.Label lbl005 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      BorderStyle     =   1  'Fixed Single
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   3840
				      TabIndex        =   5
				      Top             =   2400
				      Width           =   1455
				   End
				   Begin VB.Label Label6 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "显著性水平为0.05的卡方临界值:"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   120
				      TabIndex        =   4
				      Top             =   2400
				      Width           =   3735
				   End
				   Begin VB.Label lblX2 
				      Alignment       =   2  'Center
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      BorderStyle     =   1  'Fixed Single
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   3840
				      TabIndex        =   3
				      Top             =   2040
				      Width           =   1455
				   End
				   Begin VB.Label Label5 
				      Alignment       =   1  'Right Justify
				      Appearance      =   0  'Flat
				      BackColor       =   &H80000005&
				      Caption         =   "卡方检验值:"
				      BeginProperty Font 
				         Name            =   "宋体"
				         Size            =   12
				         Charset         =   134
				         Weight          =   400
				         Underline       =   0   'False
				         Italic          =   0   'False
				         Strikethrough   =   0   'False
				      EndProperty
				      ForeColor       =   &H80000008&
				      Height          =   375
				      Left            =   2400
				      TabIndex        =   2
				      Top             =   2040
				      Width           =   1455
				   End
				End
				Attribute VB_Name = "frmCalculate"
				Attribute VB_GlobalNameSpace = False
				Attribute VB_Creatable = False
				Attribute VB_PredeclaredId = True
				Attribute VB_Exposed = False
				'分布假设检验
				Option Explicit
				Private Sub Form_Load()
				    Label5.Visible = False: Label6.Visible = False
				    Label2.Visible = False: Label8.Visible = False
				    Label3.Visible = False: txtN1.Visible = False
				    lblX2.Visible = False: txtP1.Visible = False
				    lbl005.Visible = False: lblD.Visible = False
				End Sub
				
				'计算
				Private Sub cmdCheck_Click()
				    Dim x2 As Double, X2_005 As Double, X2_001 As Double
				    Dim sngX2 As Single, sng005 As Single, sng001 As Single
				    Dim m As Integer, L As Integer
				    Label5.Visible = True: Label6.Visible = True
				    Label8.Visible = True: lblX2.Visible = True
				    lbl005.Visible = True: lblD.Visible = True
				    m = UBound(x, 1)
				    If Option1.Value Then
				'正态分布检验
				        Norm_X2 x0, x1, x, y, x2, L
				        PCX2 m - L - 3, 0.05, X2_005    '计算显著性为0.05的卡方临界值
				        sngX2 = x2: sng005 = X2_005
				        lblX2.Caption = sngX2
				        lbl005.Caption = Str(sng005)
				        If x2 >= X2_005 Then lblD = "不服从正态分布"
				        If x2 < X2_005 Then lblD = "服从正态分布"
				    End If
				    If Option2.Value Then
				'二项式分布检验
				        Bino_X2 x, y, y1, Val(txtP1), Val(txtN1), x2, L
				        PCX2 m - L - 2, 0.05, X2_005
				        sngX2 = x2: sng005 = X2_005
				        lblX2.Caption = sngX2
				        lbl005.Caption = Str(sng005)
				        If x2 >= X2_005 Then lblD = "不服从二项式分布"
				        If x2 < X2_005 Then lblD = "服从二项式分布分布"
				    End If
				    If Option3.Value Then
				'泊松分布检验
				        Poi_X2 x, y, y1, x2, L
				        PCX2 m - L - 2, 0.05, X2_005
				        sngX2 = x2: sng005 = X2_005
				        lblX2.Caption = sngX2
				        lbl005.Caption = Str(sng005)
				        If x2 >= X2_005 Then lblD = "不服从泊松分布"
				        If x2 < X2_005 Then lblD = "服从泊松分布分布"
				    End If
				    cmdCheck.Visible = False
				End Sub
				
				'选择分布类型
				Private Sub Option1_Click()
				    If Option2.Value Then
				        Label2.Visible = True: txtP1.Visible = True
				        Label3.Visible = True: txtN1.Visible = True
				        txtP1.SetFocus
				    Else
				        Label2.Visible = False: txtP1.Visible = False
				        Label3.Visible = False: txtN1.Visible = False
				    End If
				End Sub
				
				'选择分布类型
				Private Sub Option2_Click()
				    If Option2.Value Then
				        Label2.Visible = True: txtP1.Visible = True
				        Label3.Visible = True: txtN1.Visible = True
				        txtP1.SetFocus
				    Else
				        Label2.Visible = False: txtP1.Visible = False
				        Label3.Visible = False: txtN1.Visible = False
				    End If
				End Sub
				
				'选择分布类型
				Private Sub Option3_Click()
				    If Option2.Value Then
				        Label2.Visible = True: txtP1.Visible = True
				        Label3.Visible = True: txtN1.Visible = True
				        txtP1.SetFocus
				    Else
				        Label2.Visible = False: txtP1.Visible = False
				        Label3.Visible = False: txtN1.Visible = False
				    End If
				End Sub
				
				
				'退出
				Private Sub cmdExit_Click()
				    Unload Me
				    End
				End Sub
				
							

相关资源