R/dsquared.R

Defines functions dsquared

Documented in dsquared

dsquared <- function(V) {
# calculate ordinal concentration, following Blair & Lacy 2000
# argument: V = frequency vector
k <- length(V) # number of categories
n <- sum(V)    # number of cases
V <- V/n       # standardizing
# from 1 to k-1(Fi -.5)^2
dsq <- sum(sapply(1:(k-1), function(x) (sum(V[1:x]) - .5)^2))
return(dsq)
}

Try the agrmt package in your browser

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

agrmt documentation built on Nov. 23, 2023, 1:07 a.m.