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.
pem(
data,
dvar,
pvar,
decreasing = FALSE,
binom.test = TRUE,
chi.test = FALSE,
FUN = median,
phases = c(1, 2),
...
)
A single-case data frame. See scdf()
to learn about this
format.
Character string with the name of the dependent variable. Defaults to the attributes in the scdf file.
Character string with the name of the phase variable. Defaults to the attributes in the scdf file.
If you expect data to be lower in the B phase, set
decreasing = TRUE
. Default is decreasing = FALSE
.
Computes a binomial test for a 50/50 distribution. Default
is binom.test = TRUE
.
Computes a Chi-square test. The default setting
chi.test = FALSE
skips the Chi-square test.
Data points are compared with the phase A median. Use this
argument to implement alternative measures of central tendency. Default is
FUN = median
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.
Juergen Wilbert
Other overlap functions:
cdc()
,
ird()
,
nap()
,
overlap()
,
pand()
,
pet()
,
pnd()
,
tau_u()
## 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)
Run the code above in your browser using DataLab