pem: Percent exceeding the median

View source: R/pem.R

pemR Documentation

Percent exceeding the median

Description

The pem function returns the percentage of phase B data exceeding the phase A median. Additionally, a chi square test against a 50/50 distribution is computed. Different measures of central tendency can be addressed for alternative analyses.

Usage

pem(
  data,
  dvar,
  pvar,
  decreasing = FALSE,
  binom.test = TRUE,
  chi.test = FALSE,
  FUN = median,
  phases = c(1, 2),
  ...
)

Arguments

data

A single-case data frame. See scdf() to learn about this format.

dvar

Character string with the name of the dependent variable. Defaults to the attributes in the scdf file.

pvar

Character string with the name of the phase variable. Defaults to the attributes in the scdf file.

decreasing

If you expect data to be lower in the B phase, set decreasing = TRUE. Default is decreasing = FALSE.

binom.test

Computes a binomial test for a 50/50 distribution. Default is binom.test = TRUE.

chi.test

Computes a Chi-square test. The default setting chi.test = FALSE skips the Chi-square test.

FUN

Data points are compared with the phase A median. Use this argument to implement alternative measures of central tendency. Default is FUN = median

phases

A vector of two characters or numbers indicating the two phases that should be compared. E.g., phases = c("A","C") or phases = c(2,4) for comparing the second to the fourth phase. Phases could be combined by providing a list with two elements. E.g., phases = list(A = c(1,3), B = c(2,4)) will compare phases 1 and 3 (as A) against 2 and 4 (as B). Default is phases = c(1,2).

...

Additional arguments for the FUN parameter (e.g. FUN = mean, trim = 0.1 will use the 10 percent trimmed arithmetic mean instead of the median for comparisons). The function must take a vector of numeric values and the na.rm argument and return a numeric value.

Author(s)

Juergen Wilbert

See Also

Other overlap functions: cdc(), nap(), overlap(), pand(), pet(), pnd(), tau_u()

Examples


## Calculate the PEM including the Binomial and Chi-square tests for a single-case
dat <- random_scdf(5, level = 0.5)
pem(dat, chi.test = TRUE)


scan documentation built on July 1, 2024, 9:07 a.m.