Function Math Statistics Class

ChiTst

Returns the chi-squared (X2) test for independence.

Signature (Visual Basic / VBA)

Public Function ChiTst( _
      ByVal vActual As Variant _
    , ByVal vExpected As Variant _
    ) As Variant

Code Example

    See the ChiTstVerify Subroutine for examples of this Function.

Parameters

Parameter Description
vActual Observations to be tested against expected values. Two-dimensional numeric-type array or Variant array containing only numeric elements. This function is NOT affected by the current setting of the StatVarType Property. It assumes that vActual is an array that contains only numeric elements.
vExpected Expected values against which the observations vActual are tested. Two-dimensional numeric-type array or Variant array containing only numeric elements. This function assumes that vExpected is an array that contains only numeric elements.

Return Value

Function returns the value from the ChiSquare cumulative distribution function for the X2 statistic with the degrees of freedom calculated from the number of rows and columns in the arrays. Function returns Null if the bounds of either of the dimensions of vActual and vExpected are different, or if there is some type of error, such as if one of the arguments is a Variant array which contains an Object reference or String.