Learn R Programming

VizTest (version 0.7)

get_viztest_levels: Extract representative difficulty levels from a VizTest result

Description

get_viztest_levels() selects one or more representative stimulus levels from a VizTest result object based on empirical difficulty and agreement. Levels are chosen from rows with the maximum agreement probability (psame) and can be returned individually (e.g., lowest, highest) or collectively.

Usage

get_viztest_levels(
  x,
  method = c("easiest", "all", "lowest", "highest", "middle"),
  ...
)

Value

A numeric value when method is one of "lowest", "highest", "middle", or "easiest". When method = "all", a named numeric vector with elements lowest, highest, middle, and easiest.

Arguments

x

A VizTest result object containing a component tab, a data frame with at least the columns level, psame, and easy.

method

Character string specifying which level(s) to return. One of "easiest", "all", "lowest", "highest", or "middle".

...

Reserved for future extensions; currently unused.

Details

The function first subsets x$tab to rows achieving the maximum value of psame (ignoring missing values). From this subset:

  • "lowest" returns the smallest level.

  • "highest" returns the largest level.

  • "middle" returns the median level.

  • "easiest" returns the level with the maximum easy value.

  • "all" returns a named vector containing all four selections.

See Also

VizTest

Examples

Run this code
data(mtcars)
mtcars$cyl <- as.factor(mtcars$cyl)
mtcars$hp <- scale(mtcars$hp)
mtcars$wt <- scale(mtcars$wt)
mod <- lm(qsec ~ hp + wt + cyl, data=mtcars)
v <- viztest(mod)
v

get_viztest_levels(v, "easiest")

Run the code above in your browser using DataLab