Parent

Class/Module Index [+]

Quicksearch

Statsample::Test::BartlettSphericity

Bartlett’s test of Sphericity.

Test the hyphotesis that the sample correlation matrix comes from a multivariate normal population where variables are independent. In other words, the population correlation matrix is the identity matrix.

Reference

Attributes

name[RW]
ncases[R]
nvars[R]
value[R]
df[R]

Public Class Methods

new(matrix,ncases) click to toggle source

Args

  • matrix: correlation matrix

  • ncases: number of cases

# File lib/statsample/test/bartlettsphericity.rb, line 21
def initialize(matrix,ncases)
  @matrix=matrix
  @ncases=ncases
  @nvars=@matrix.row_size
  @name=_("Bartlett's test of sphericity")
  compute
end

Public Instance Methods

compute() click to toggle source

Uses SPSS formula. On Dziuban & Shirkey, the minus between the first and second statement is a *!!!

# File lib/statsample/test/bartlettsphericity.rb, line 32
def compute
  @value=-((@ncases-1)-(2*@nvars+5).quo(6))*Math::log(@matrix.determinant)
  @df=(@nvars*(@nvars-1)).quo(2)
end
probability() click to toggle source
# File lib/statsample/test/bartlettsphericity.rb, line 36
def probability
  1-Distribution::ChiSquare.cdf(@value,@df)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.