discretize_from_thresholds: Discretize from thresholds

View source: R/thresholds.R

discretize_from_thresholdsR Documentation

Discretize from thresholds

Description

Discretizes continuous latent goal score values into discrete levels centred at 0, using a set of thresholds.

Usage

discretize_from_thresholds(score_continuous, thresholds)

Arguments

score_continuous

Numeric vector of continuous goal scores.

thresholds

Numeric vector of thresholds separating the goal attainment levels. Must be an even number of thresholds (which corresponds to an odd number of attainment levels)

Value

Numeric vector, the same length as score_continuous, of integers corresponding to discrete attainment levels. For a typical 5-point attainment scale, the returned values will be of the set {-2, -1, 0, 1, 2}.

Examples

thresh <- create_thresholds()
y <- rnorm(10)
y_discrete <- discretize_from_thresholds(y, thresh)

taylordunn/gasr documentation built on April 5, 2022, 1:37 a.m.