Learn R Programming

DEXiR (version 1.0.2)

plus_minus: plus_minus

Description

Plus-Minus Analysis: Investigate the effects of changing single attributes values on the evaluation of alternative. The values of discrete basic attributes ("input attributes") are changed, one attribute at a time, by a particular number of steps downwards (minus) and upwards (plus), while observing the changes of the target attribute values.

Usage

plus_minus(
  model,
  alternative,
  target = model$first(),
  minus = .Machine$integer.max,
  plus = .Machine$integer.max,
  print = TRUE,
  as_character = FALSE,
  round = NULL,
  id = NULL,
  evaluate = FALSE,
  ...
)

Value

A data frame consisting of columns:

id

IDs of input attributes (unless excluded by the id argument).

structure

Structure and names of input attributes (unless excluded by the id argument).

'For -minus to -1

Evaluation value of target when decreasing the corresponding attribute value by the corresponding number of steps.

target$id

Original alternative value assigned to the corresponding attribute id.

For 1 to plus

Evaluation value of target when increasing the corresponding attribute value by the corresponding number of steps.

Special values "[" and "]" denote that it is not possible to decrease of increase, respectively, the corresponding attributes value further.

Arguments

model

A DexiModel object.

alternative

Either a data.frame representing a single alternative or an index to model$alternatives.

target

The attribute on which effects are observed. Default: model$first().

minus

The maximum number of downward steps to be made for each input attribute. Default: .Machine$integer.max. The actual minus value is further determined with respect to alternative values and involved attributes' scales.

plus

The maximum number of upward steps to be made for each input attribute. Default: .Machine$integer.max. The actual plus value is further determined with respect to alternative values and involved attributes' scales.

print

logical(1). When TRUE, pretty print (left justify) the results.

as_character

logical(1). Whether to represent alternative values numerically (FALSE) or using text (TRUE).

round

An integer number, argument to value_text().

id

character(1). Determines the contents of the first or first two columns of the resulting data.frames:

"id"

Attribute ID.

"structure"

Attribute $structure() + $name.

anything else

Equivalent to both "id" and "structure".

evaluate

logical(1). Whether or not to evaluate alternative beforehand.

...

Optional parameters for evaluate().

See Also

evaluate(), value_text()

Examples

Run this code
# Load "Car.dxi"
CarDxi <- system.file("extdata", "Car.dxi", package = "DEXiR")
Car <- read_dexi(CarDxi)

alt <- Car$alternative("MyCar",
       BUY.PRICE="low", MAINT.PRICE="*", X.PERS="more", X.DOORS="4", LUGGAGE=2, SAFETY=c(1, 3))
alte <- Car$evaluate(alt)

# Default plus-minus analysis, evaluating `alt`.
plus_minus(Car, alt, evaluate = TRUE)

# Plus-minus analysis of `alte`, using character strings,
# no pretty-printing and excluding structure info.
plus_minus(Car, alte, as_character=TRUE, print=FALSE, id = "id")

# Plus-minus analysis on `target="PRICE"`, using character strings.
plus_minus(Car, alt, target="PRICE", as_character=TRUE, evaluate=TRUE)

Run the code above in your browser using DataLab