n_goalposts {COINr}R Documentation

Normalise using goalpost method

Description

The fraction of the distance of each value of x from the lower "goalpost" to the upper one. Goalposts are specified by gposts = c(l, u, a), where l is the lower bound, u is the upper bound, and a is a scaling parameter.

Usage

n_goalposts(x, gposts, direction = 1, trunc2posts = TRUE)

Arguments

x

A numeric vector

gposts

A numeric vector c(l, u, a), where l is the lower bound, u is the upper bound, and a is a scaling parameter.

direction

Either 1 or -1. Set to -1 to flip goalposts.

trunc2posts

If TRUE (default) will truncate any values that fall outside of the goalposts.

Details

Specify direction = -1 to "flip" the goalposts. In this case, the fraction from the upper to the lower goalpost is measured.

The goalposts equations are:

(x - GP_{low})/(GP_{high} - GP_{low})

and for a negative directionality indicator:

(x - GP_{high})/(GP_{low} - GP_{high})

This function also supports parameter specification in iMeta for the Normalise.coin() method. To do this, add columns:

to the iMeta table. Then set f_n_para = "use_iMeta" within the global_specs list. See also examples in the normalisation vignette.

Value

Numeric vector

Examples

# positive direction
n_goalposts(1, gposts = c(0, 10, 1))
# negative direction
n_goalposts(1, gposts = c(0, 10, 1), direction = -1)


[Package COINr version 1.1.14 Index]