search for: sqsm

Displaying 1 result from an estimated 1 matches for "sqsm".

Did you mean: qsm
2004 Dec 13
3
Percentages in contingency tables *warning trivial question*
...the help for "addmargins": Bee <- sample( c("Hum","Buzz"), 177, replace=TRUE ) Sea <- sample( c("White","Black","Red","Dead"), 177, replace=TRUE ) ... # Weird function needed to return the N when computing percentages sqsm <- function( x ) sum( x )^2/100 B <- table(Sea, Bee) round(sweep(addmargins(B, 1, list(list(All=sum, N=sqsm))), 2, apply( B, 2, sum )/100, "/" ), 1) round(sweep(addmargins(B, 2, list(list(All=sum, N=sqsm))), 1, apply(B, 1, sum )/100, "/"), 1) .. Which introduced me t...