MyNixOS website logo
Description

Measure Dependence Between Categorical and Continuous Variables.

Semi-distance and mean-variance (MV) index are proposed to measure the dependence between a categorical random variable and a continuous variable. Test of independence and feature screening for classification problems can be implemented via the two dependence measures. For the details of the methods, see Zhong et al. (2023) <doi:10.1080/01621459.2023.2284988>; Cui and Zhong (2019) <doi:10.1016/j.csda.2019.05.004>; Cui, Li and Zhong (2015) <doi:10.1080/01621459.2014.920256>.

Semi-Distance Correlation and MV Index: Measure Dependence Between Categorical and Continuous Variables

R-CMD-check

The goal of package `semidist` is to provide an

easy way to implement the semi-distance methods (Zhong et al., 2023) and MV index methods (Cui, Li and Zhong, 2015; Cui and Zhong, 2019).

Installation

To install semidist,

install.packages("semidist")

Example

Here is a simple example showing how to use semidist to measure the dependence between a categorical variable and a multivariate continuous variable, and apply the measure on testing the independence and conduct groupwise feature screening.

library(semidist)
X <- mtcars[, c("mpg", "disp", "drat", "wt")]
y <- factor(mtcars[, "am"])

sdcov(X, y)
#> [1] 31.78288
sdcor(X, y)
#> [1] 0.3489821

sd_test(X, y)
#> 
#>  Semi-Distance Independence Test (Permutation Test with K = 10000)
#> 
#> Data: X and y,   Sample size = 32
#> Test statistic = 940.344,    p-value = 0.0005999
#> Alternative hypothesis: Two random variables are not independent

sd_sis(X, y, d = 2)
#> $group_info
#> $group_info$`Grp mpg`
#> [1] "mpg"
#> 
#> $group_info$`Grp disp`
#> [1] "disp"
#> 
#> $group_info$`Grp drat`
#> [1] "drat"
#> 
#> $group_info$`Grp wt`
#> [1] "wt"
#> 
#> 
#> $measurement
#>   Grp mpg  Grp disp  Grp drat    Grp wt 
#> 0.3447938 0.3488447 0.5054821 0.5358834 
#> 
#> $selected
#> [1] "wt"   "drat"
#> 
#> $ordering
#> [1] "Grp wt"   "Grp drat" "Grp disp" "Grp mpg"

# Suppose we have prior information for the group structure as
# ("mpg", "drat"), ("disp", "hp") and ("wt", "qsec")
group_info <- list(
  mpg_drat = c("mpg", "drat"),
  disp_wt = c("disp", "wt")
)
sd_sis(X, y, group_info, d = 2)
#> $group_info
#> $group_info$mpg_drat
#> [1] "mpg"  "drat"
#> 
#> $group_info$disp_wt
#> [1] "disp" "wt"  
#> 
#> 
#> $measurement
#>  mpg_drat   disp_wt 
#> 0.3518051 0.3488598 
#> 
#> $selected
#> [1] "mpg"  "drat"
#> 
#> $ordering
#> [1] "mpg_drat" "disp_wt"

References

  1. Wei Zhong, Zhuoxi Li, Wenwen Guo and Hengjian Cui. (2023) “Semi-Distance Correlation and Its Applications.” Journal of the American Statistical Association.
  2. Hengjian Cui and Wei Zhong (2019). “A Distribution-Free Test of Independence Based on Mean Variance Index.” Computational Statistics & Data Analysis, 139, 117-133.
  3. Hengjian Cui, Runze Li and Wei Zhong (2015). “Model-Free Feature Screening for Ultrahigh Dimensional Discriminant Analysis.” Journal of the American Statistical Association, 110, 630-641.
Metadata

Version

0.1.0

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