checkAvSd: Check how multiple groups of data separate or overlap based...

View source: R/checkAvSd.R

checkAvSdR Documentation

Check how multiple groups of data separate or overlap based on mean +/- sd

Description

checkAvSd compares if/how neighbour groups separate/overlap via the 'engineering approach' (+/- 2 standard-deviations is similar to a=0.05 t.test). This approach may be used as less elegant alternative to (multi-group) logistic regression. The function uses 'daAv' as matrix of means (rows are tested for up/down character/progression) which get compared with boundaries taken from daSd (for Sd values of each mean in 'daAv').

Usage

checkAvSd(
  daAv,
  daSd,
  nByGr = NULL,
  multSd = 2,
  codeConst = "const",
  extSearch = FALSE,
  outAsLogical = TRUE,
  silent = FALSE,
  callFrom = NULL
)

Arguments

daAv

matrix or data.frame

daSd

matrix or data.frame

nByGr

optinal specifying number of Elements per group, allows rather using SEM (adopt to variable n of different groups)

multSd

(numeric) the factor specifyin how many sd values should be used as margin

codeConst

(character) which term/word to use when specifying 'constant'

extSearch

(logical) if TRUE, extend search to one group further (will call result 'nearUp' or 'nearDw')

outAsLogical

to switch between 2col-output (separate col for 'up' and 'down') or simple categorical vector ('const','okDw','okUp')

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

vector describing character as 'const' or 'okUp','okDw' (or if extSearch=TRUE 'nearUp','nearDw')

See Also

rowGrpMeans

Examples

mat1 <- matrix(rep(11:24,3)[1:40],byrow=TRUE,ncol=8)
checkGrpOrderSEM(mat1,grp=gl(3,3)[-1])
checkAvSd(rowGrpMeans(mat1,gl(3,3)[-1]),rowGrpSds(mat1,gl(3,3)[-1]) )
# consider variable n :
checkAvSd(rowGrpMeans(mat1,gl(3,3)[-1]),rowGrpSds(mat1,gl(3,3)[-1]),nByGr=c(2,3,3)) 

wrMisc documentation built on Jan. 7, 2023, 1:27 a.m.