Learn R Programming

riskyr (version 0.1.0)

riskyr: Create riskyr scenarios.

Description

The instantiation function riskyr is used to create scenarios of class "riskyr", which can then be visualized by the plot method plot.riskyr and summarized by the summary method summary.riskyr.

Usage

riskyr(scen.lbl = "", scen.lng = txt$scen.lng, scen.txt = txt$scen.txt,
  popu.lbl = txt$popu.lbl, cond.lbl = txt$cond.lbl,
  cond.true.lbl = txt$cond.true.lbl, cond.false.lbl = txt$cond.false.lbl,
  dec.lbl = txt$dec.lbl, dec.pos.lbl = txt$dec.pos.lbl,
  dec.neg.lbl = txt$dec.neg.lbl, hi.lbl = txt$hi.lbl, mi.lbl = txt$mi.lbl,
  fa.lbl = txt$fa.lbl, cr.lbl = txt$cr.lbl, prev = num$prev,
  sens = num$sens, spec = num$spec, fart = NA, N = NA,
  scen.src = txt$scen.src, scen.apa = txt$scen.apa)

Arguments

scen.lbl

The current scenario title (sometimes in Title Caps).

scen.lng

Language of the current scenario (as character code). Options: "en" for English, "de" for German.

scen.txt

A longer text description of the current scenario (which may extend over several lines).

popu.lbl

A brief description of the current target population popu or sample.

cond.lbl

A name for the condition or feature (e.g., some disease) currently considered.

cond.true.lbl

A label for the presence of the current condition or cond.true cases (the condition's true state of TRUE).

cond.false.lbl

A label for the absence of the current condition or cond.false cases (the condition's true state of FALSE).

dec.lbl

A name for the decision or judgment (e.g., some diagnostic test) currently made.

dec.pos.lbl

A label for positive decisions or dec.pos cases (e.g., predicting the presence of the condition).

dec.neg.lbl

A label for negative decisions or dec.neg cases (e.g., predicting the absence of the condition).

hi.lbl

A label for hits or true positives hi (i.e., correct decisions of the presence of the condition, when the condition is actually present).

mi.lbl

A label for misses or false negatives mi (i.e., incorrect decisions of the absence of the condition when the condition is actually present).

fa.lbl

A label for false alarms or false positives fa (i.e., incorrect decisions of the presence of the condition when the condition is actually absent).

cr.lbl

A label for correct rejections or true negatives cr (i.e., a correct decision of the absence of the condition, when the condition is actually absent).

Numeric elements:

prev

The condition's prevalence prev (i.e., the probability of condition being TRUE).

sens

The decision's sensitivity sens (i.e., the conditional probability of a positive decision provided that the condition is TRUE). sens is optional when its complement mirt is provided.

spec

The decision's specificity value spec (i.e., the conditional probability of a negative decision provided that the condition is FALSE). spec is optional when its complement fart is provided.

fart

The decision's false alarm rate fart (i.e., the conditional probability of a positive decision provided that the condition is FALSE). fart is optional when its complement spec is provided.

Source information:

N

The number of individuals in the scenario's population. A suitable value of N is computed, if not provided.

scen.src

Source information for the current scenario.

scen.apa

Source information for the current scenario in the style of the American Psychological Association (APA style).

Value

A list object of class "riskyr" containing information on a risky scenario.

Text elements (all elements of txt:

Format

An object of class "riskyr" with 21 entries on textual and numeric information on a riskyr scenario.

Details

Beyond basic scenario information only the population size N and the essential probabilities prev, sens, spec, and fart are used and returned.

Examples

Run this code
# NOT RUN {
# Defining a scenario:
custom.scenario <- riskyr(scen.lbl = "Identify reoffenders",
  cond.lbl = "Being a reoffender", popu.lbl = "Prisoners",
  cond.true.lbl = "Has reoffended", cond.false.lbl = "Has not reoffended",
  dec.lbl = "Test result",
  dec.pos.lbl = "will reoffend", dec.neg.lbl = "will not reoffend",
  hi.lbl = "Reoffender found", mi.lbl = "Reoffender missed",
  fa.lbl = "False accusation", cr.lbl = "Correct release",
  prev = .45,  # prevalence of being a reoffender.
  sens = .98, spec = .46, fart = NA, N = 753,
  scen.src = "Ficticious example scenario")

# Using a scenario:
summary(custom.scenario)
plot(custom.scenario)

# }

Run the code above in your browser using DataLab