z_tests_cfa: Two z-Approximation Tests

View source: R/z_tests_cfa.R

z_tests_cfaR Documentation

Two z-Approximation Tests

Description

Calculates the Chi-square approximation to the z-test and the binomial approximation to the z-test.

Usage

z_tests_cfa(observed, expected, ccor = FALSE, ntotal = sum(observed))

Arguments

observed

a vector giving the observed frequencies.

expected

a vector giving the expected frequencies.

ccor

either a logical (TRUE / FALSE) determining wether to apply a continuity correction or not to the Binomial Approximation of the z-Test. When set to ccor=TRUE continuity correction is applied for expected values 5 =< expected =< 10. For ccor=FALSE no continuity correction is applied. Another option is to set ccor=c(x,y) where x is the lower and y the upper bound for expected values where continuity correction is applied. So ccor=c(5,10) is equivalent to ccor=TRUE.

ntotal

optional a numeric giving the total number of observations. By default ntotal is calculated as ntotal=sum(observed).

Details

An continuity correction can be applied to the binomial approximation – see argument ccor.

Value

a list with z and p-values.

References

No references in the moment

Examples

#######################################
# expected counts for LienertLSD data example.
designmatrix<-design_cfg_cfa(kat=c(2,2,2)) # generate an designmatrix (only main effects)
data(LienertLSD) # load example data
observed<-LienertLSD[,4] # extract observed counts
expected<-expected_cfa(des=designmatrix, observed=observed) # calculation of expected counts
z_tests_cfa(observed,expected)
####################################### 

confreq documentation built on Nov. 13, 2022, 9:05 a.m.