SecreC 2 language  2.8.0 (2023.09)
Language and standard library reference
Functions
chiSquared(with codebook)

Functions

template<domain D>
D float32 chiSquared (D uint32[[1]] data, D bool[[1]] cases, D bool[[1]] controls, uint32[[2]] codeBook)
 
template<domain D>
D float64 chiSquared (D uint64[[1]] data, D bool[[1]] cases, D bool[[1]] controls, uint64[[2]] 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]

D float32 chiSquared ( D uint32[[1]]  data,
D bool[[1]]  cases,
D bool[[1]]  controls,
uint32[[2]]  codeBook 
)

◆ chiSquared() [2/2]

D float64 chiSquared ( D uint64[[1]]  data,
D bool[[1]]  cases,
D bool[[1]]  controls,
uint64[[2]]  codeBook 
)