Skip to contents

This function calculates percentile norms for a given dataset.

Usage

percentile_norms(dat, method = "all", range = NULL)

Arguments

dat

A numeric vector representing the dataset for which percentile norms are to be calculated.

method

A character string specifying the method for calculating percentiles: "a" for method a, "b" for method b, "c" for method c, or "all" for all methods. Default is "all".

range

An optional numeric vector specifying the range of values over which to calculate percentiles, or a range specified as a sequence (e.g., (1:12)). Default is the range from the minimum to the maximum value in the dataset.

Value

A data frame containing the following columns:

raw

The raw values for which percentiles are calculated.

count

The count of occurrences of each raw value in the dataset.

definition_a

The percentile values calculated using method "a".

definition_b

The percentile values calculated using method "b".

definition_c

The percentile values calculated using method "c".

Examples

# Generate example data
set.seed(123)
data <- rnorm(100)

# Calculate percentile norms using all methods
percentile_norms(data, method = "all")
#>          raw count definition_a definition_b definition_c
#> 1 -2.3091689     1            0            1          0.5
#> 2 -1.3091689     0            4            4          4.0
#> 3 -0.3091689     0           34           34         34.0
#> 4  0.6908311     0           75           75         75.0
#> 5  1.6908311     0           95           95         95.0

# Calculate percentile norms using a specific method
percentile_norms(data, method = "c")
#>          raw count definition_c
#> 1 -2.3091689     1          0.5
#> 2 -1.3091689     0          4.0
#> 3 -0.3091689     0         34.0
#> 4  0.6908311     0         75.0
#> 5  1.6908311     0         95.0

# re-create Crawford (2009) table
crawford_2009 <- c(rep(0:12, c(0, 0, 0, 0, 0, 2, 4, 4, 14, 16, 20, 30, 10)))
percentile_norms(crawford_2009)
#>   raw count definition_a definition_b definition_c
#> 1   5     2            0            2            1
#> 2   6     4            2            6            4
#> 3   7     4            6           10            8
#> 4   8    14           10           24           17
#> 5   9    16           24           40           32
#> 6  10    20           40           60           50
#> 7  11    30           60           90           75
#> 8  12    10           90          100           95