Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 当我们有很多变量时,如何处理测试依赖性_R - Fatal编程技术网

R 当我们有很多变量时,如何处理测试依赖性

R 当我们有很多变量时,如何处理测试依赖性,r,R,我想使用在R中实现的卡方检验来测试许多分类变量的依赖性。事实上,我有14个变量,对所有变量进行14*14的测试非常长。正如你所知,卡方检验只涉及在正常情况下对两个变量进行测试,就像这样,当我需要测试TYPE\u PEAU和sensitive之间的依赖关系时 > library(MASS) > tbl = table(DATA_BASE$TYPE_PEAU, DATA_BASE$SENSIBILITE) > chisq.test(tbl) Pearson's Chi-s

我想使用在R中实现的卡方检验来测试许多分类变量的依赖性。事实上,我有14个变量,对所有变量进行14*14的测试非常长。正如你所知,卡方检验只涉及在正常情况下对两个变量进行测试,就像这样,当我需要测试
TYPE\u PEAU
sensitive
之间的依赖关系时

> library(MASS)
> tbl = table(DATA_BASE$TYPE_PEAU, DATA_BASE$SENSIBILITE)
> chisq.test(tbl)

    Pearson's Chi-squared test

data:  tbl
X-squared = 5727.5, df = 12, p-value < 2.2e-16

提前感谢

这似乎不是一个适合堆栈溢出的特定编程问题。如果您对各种统计方法的适当使用有一般性问题,那么您应该在上询问这些问题。你更有可能在那里得到更好的答案。或者澄清一下你所说的“很长”和“我该如何处理它们”的意思,请检查@A.Suliman,非常感谢!这就是我需要的
> dput(DATA_BASE[1:50,15:18])
structure(list(TYPE_PEAU = structure(c(3L, 4L, 5L, 1L, 3L, 1L, 
1L, 1L, 3L, 1L, 1L, 1L, 4L, 3L, 1L, 3L, 1L, 3L, 3L, 3L, 1L, 1L, 
1L, 3L, 1L, 1L, 3L, 1L, 3L, 5L, 1L, 5L, 2L, 1L, 5L, 5L, 3L, 1L, 
3L, 1L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 3L, 1L), .Label = c("", 
"Grasse", "Mixte", "Normale", "Sèche"), class = "factor"), SENSIBILITE = structure(c(4L, 
4L, 4L, 1L, 3L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 4L, 4L, 1L, 3L, 1L, 
3L, 3L, 4L, 1L, 1L, 1L, 2L, 1L, 1L, 4L, 1L, 2L, 3L, 1L, 4L, 4L, 
1L, 3L, 4L, 4L, 1L, 4L, 1L, 1L, 1L, 1L, 4L, 1L, 1L, 1L, 1L, 4L, 
1L), .Label = c("", "Aucune", "Fréquente", "Occasionnelle"), class = "factor"), 
    IMPERFECTIONS = structure(c(3L, 4L, 3L, 1L, 2L, 1L, 1L, 1L, 
    4L, 1L, 1L, 1L, 3L, 3L, 1L, 2L, 1L, 3L, 2L, 3L, 1L, 1L, 1L, 
    4L, 1L, 1L, 3L, 1L, 3L, 2L, 1L, 4L, 3L, 1L, 3L, 3L, 3L, 1L, 
    2L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 3L, 1L), .Label = c("", 
    "Fréquente", "Occasionnelle", "Rares"), class = "factor"), 
    BRILLANCE = structure(c(4L, 2L, 2L, 1L, 4L, 1L, 1L, 1L, 4L, 
    1L, 1L, 1L, 4L, 4L, 1L, 4L, 1L, 4L, 4L, 4L, 1L, 1L, 1L, 4L, 
    1L, 1L, 4L, 1L, 4L, 4L, 1L, 2L, 3L, 1L, 4L, 4L, 4L, 1L, 4L, 
    1L, 1L, 1L, 1L, 4L, 1L, 1L, 1L, 1L, 4L, 1L), .Label = c("", 
    "Aucune", "Partout", "Zone T"), class = "factor")), .Names = c("TYPE_PEAU", 
"SENSIBILITE", "IMPERFECTIONS", "BRILLANCE"), row.names = c(15L, 
22L, 33L, 40L, 48L, 54L, 59L, 65L, 74L, 78L, 87L, 89L, 104L, 
108L, 115L, 121L, 141L, 159L, 161L, 163L, 165L, 175L, 179L, 186L, 
196L, 202L, 211L, 222L, 231L, 265L, 272L, 290L, 300L, 318L, 325L, 
327L, 349L, 372L, 374L, 380L, 392L, 393L, 394L, 398L, 427L, 440L, 
449L, 450L, 456L, 470L), class = "data.frame")