R/TOSts.R

Defines functions TOSts

Documented in TOSts

TOSts <-
function(spec){
#
# Calculate Test Statistic on spectrum spec
#

#
# Get dimensions
#
J <- spec$nlevels
n <- 2^J

#
# Turn spectrum coefficients into matrix
#
m <- matrix(spec$D, nrow=J, ncol=n, byrow=TRUE)
#
# Compute empirical variance for each level
#
answer <- sum(apply(m,1,var))

return(answer)
}

Try the costat package in your browser

Any scripts or data that you put into this service are public.

costat documentation built on Sept. 8, 2023, 5:18 p.m.