Tetrachoric correlation in statsample requires installation of the statsample-bivariate-extension gem. This gem extends the Statsample::Bivariate class with useful algorithms for polychoric and tetrachoric correlation.
Statsample will automatically detect presence of polychoric/tetrachoric algorithms so there is no need to explicitly require the gem.
In this example we'll see how tetrachoric correlation can be performed using statsampl
require 'statsample'
Statsample::Analysis.store(Statsample::Bivariate::Tetrachoric) do
a = 40
b = 10
c = 20
d = 30
# The 'tetrachoric' shorthand calls the Statsample::Bivariate::Tetrachoric class internally
summary tetrachoric(a,b,c,d)
end
Statsample::Analysis.run_batch