Как я могу исправить эту ошибку t-теста - он говорит, что «данные по существу постоянны»? - PullRequest
0 голосов
/ 09 января 2019

Вот мой код, и вот ошибка, которую я получаю:

t.test(replication$Expecatation_Factor, replication$Amused_After_centered)

#replication$Expecatation_Factor is a factor as verified by str() and class()
#replication$Amused_After_centered is an integer as verified by srt() and class()

ОШИБКА ОТЧЕТА

Error in if (stderr < 10 * .Machine$double.eps * max(abs(mx),
abs(my))) stop("data are essentially constant") :    missing value
where TRUE/FALSE needed In addition: Warning messages: 1: In
mean.default(x) : argument is not numeric or logical: returning NA 2:
In var(x) :   Calling var(x) on a factor x is deprecated and will
become an error.   Use something like 'all(duplicated(x)[-1L])' to
test for a constant vector.

1 Ответ

0 голосов
/ 09 января 2019

Не видя вашего фактического набора данных, трудно сказать точно, что происходит, но кажется, что один из векторов, которые вы используете, на самом деле не является числовым. Ниже описано, что происходит, когда вы пытаетесь использовать t.test для строковой переменной; это очень близко к вашему предупреждению.

> t.test(factor(c('a', 'b', 'c')), c(1, 2, 3)) # you can't run a t-test on c('a', 'b', 'c')
Error in if (stderr < 10 * .Machine$double.eps * max(abs(mx), abs(my))) stop("data are essentially constant") : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In mean.default(x) : argument is not numeric or logical: returning NA
2: In var(x) :
  Calling var(x) on a factor x is deprecated and will become an error.
  Use something like 'all(duplicated(x)[-1L])' to test for a constant vector.
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...