MyNixOS website logo
Description

Snell Scoring.

The Snell scoring procedure, implemented in R. This procedure was first described by E.J Snell (1964) <doi:10.2307/2528498> and was later used by Tong et al (1977) <doi:10.4141/cjas77-001> in dairy.

rsnell

An R implementation for Snell scoring

Paul F. Petrowski

[email protected]

February 18, 2023

With thanks to AbacusBio for funding the development of this package.

Summary

This package is an R implementation of the Snell scoring procedure originally derived by EJ Snell (1964) [1]. The scoring procedure is used to approximate the distance between ordinal values, assuming an approximately normal underlying distribution. The result are values on a continuous scale that are more amenable to conventional statistical analyses.

Tong et al [2] recognized the value in applying the Snell scoring procedure to calving ease data. Today, Interbull requires that calving ease traits are Snell transformed prior to genetic evaluation.

Practically, Snell scoring can be applied in any scenario where subjective ordinal scores have been used as measurements. Note that there must be three or more possible scores in order for the snell transformation to work. Binary scores will not work.

Chien Ho Wu (2008) [3] released an excel spreadsheet containing practical formulas and calculations to execute the snell procedure. This R package is based heavily on this excel spreadsheet. A significant difference between the R package and the spreadsheet is that while the spreadsheet uses a "rule fo thumb" to estimate boundary scores, the R package uses an analytic formula. The link to the spreadsheet appears to be broken today. A copy of the spreadsheet can be found in the tests directory of this repository.

Example

Create dataset. This is copied from the original Snell paper.

data <- data.frame(
 "X-3" = c(0,6,0,0,0,2,3,0,1,2,0,5),
 "X-2" = c(0,3,0,4,0,4,4,0,2,2,0,1),
 "X-1" = c(0,1,3,1,0,3,3,1,0,2,0,1),
 "X0" = c(3,0,2,2,0,1,0,1,0,0,0,0),
 "X1" = c(3,1,2,4,2,0,1,1,1,2,4,1),
 "X2" = c(2,1,4,0,5,2,1,5,4,4,1,3),
 "X3" = c(4,0,1,1,5,0,0,4,4,0,7,1),
 row.names = as.character(1:12)
)
summary(data)
'data.frame':	12 obs. of  7 variables:
 $ X.3: num  0 6 0 0 0 2 3 0 1 2 ...
 $ X.2: num  0 3 0 4 0 4 4 0 2 2 ...
 $ X.1: num  0 1 3 1 0 3 3 1 0 2 ...
 $ X0 : num  3 0 2 2 0 1 0 1 0 0 ...
 $ X1 : num  3 1 2 4 2 0 1 1 1 2 ...
 $ X2 : num  2 1 4 0 5 2 1 5 4 4 ...
 $ X3 : num  4 0 1 1 5 0 0 4 4 0 ...

Perform the Snell procedure

snell(data)
       X.3        X.2        X.1         X0         X1         X2         X3 
-1.0724177  0.6118877  1.6023234  2.1867387  2.8375348  4.0129725  5.8508914 

The originally published scores are: -1.1, 0.6, 1.6, 2.2, 2.8, 4.0, 5.8

The scores in the spreadsheet are: -1.1, 0.611887716, 1.602323384 ,2.186738697, 2.837534795, 4.012972486, 5.84348144

The results are identical to those published except for at the boundary catagories. This is because rsnell uses an analytic method to calculate the outermost scores. The analytic method is from [2].

In the above scenario, the input data was already tabulated as counts of occurences for each score by group. Commonly, this table will need to be derived from rawdata. The buildfreqtable function is included in this function to facilitate such transformations. Suppose we have raw data like this:

mydata <- data.frame("Groups" = rep(c("A", "B", "C", "D"), 10),
                     "Scores" = round(runif(40, 0, 5)))

Groups Scores
A	1			
B	2			
C	4			
D	0			
A	1			
B	1			
C	4			
D	1			
A	3			
B	3	

1-10 of 40 rows

This is a simple dataset that only contains a column of subgroup designations and a colunmn of scores, but it could contain and number of additional columns.

To convert this into a frequency table we would use:

freqtable <- buildfreqtable(data = mydata, trait = "Scores", subgroup = "Groups")
freqtable
  0 1 2 3 4 5
A	1	2	2	3	2	0
B	0	2	2	3	1	2
C	1	1	0	2	6	0
D	1	2	3	1	2	1

With this out of the way, it is now simple to perform the Snell scoring procedure.

snell(freqtable)
         0          1          2          3          4          5 
-1.0394872  0.7153731  1.8412364  2.7540183  4.1716475  6.1264721

References

  1. Snell, E. J. “A Scaling Procedure for Ordered Categorical Data.” Biometrics 20, no. 3 (September 1964): 592. https://doi.org/10.2307/2528498.
  2. Tong, A. K. W., J. W. Wilton, and L. R. Schaeffer. “APPLICATION OF A SCORING PROCEDURE AND TRANSFORMATIONS TO DAIRY TYPE CLASSIFICATION AND BEEF EASE OF CALVING CATEGORICAL DATA.” Canadian Journal of Animal Science 57, no. 1 (March 1, 1977): 1–5. https://doi.org/10.4141/cjas77-001.
  3. Wu, Chien-Ho. “A Note on the Computation Procedure for the Approximate Estimates of the SNELL Transformation,” 2008.
Metadata

Version

0.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows