SecreC 2 language 2.9.0 (2026.10)
Language and standard library reference
Loading...
Searching...
No Matches
Functions
chiSquared(with codebook)

Functions

template<domain D>
D float32 chiSquared (D uint32 data, D bool cases, D bool controls, uint32 codeBook)
 
template<domain D>
D float64 chiSquared (D uint64 data, D bool cases, D bool controls, uint64 codeBook)
 

Detailed Description

Perform Pearson's chi-squared test of independence.

Note
D - any protection domain
Supported types - uint32 / uint64
This version does not do continuity correction so the R equivalent is chisq.test(contingencyTable, correct=FALSE)
Parameters
data- input vector
cases- vector indicating which elements of the input vector belong to the first sample
controls- vector indicating which elements of the input vector belong to the second sample
codeBook- matrix used for creating the contingency table. The first row contains expected values of the input vector and the second row contains the classes that these values will be put into. The classes should begin with 1.
Returns
returns the test statistic
Leakage
None

Function Documentation

◆ chiSquared() [1/2]

template<domain D>
D float32 chiSquared ( D uint32  data,
D bool  cases,
D bool  controls,
uint32  codeBook 
)

◆ chiSquared() [2/2]

template<domain D>
D float64 chiSquared ( D uint64  data,
D bool  cases,
D bool  controls,
uint64  codeBook 
)