नॉन-पैरामेट्रिक ANOVA और अनपेयर्ड t-टेस्ट

R में Hypothesis Testing

Richie Cotton

Data Evangelist at DataCamp

Non-parametric tests

एक non-parametric test वह हाइपोथेसिस टेस्ट है जो टेस्ट स्टैटिस्टिक के लिए किसी प्रायिकता डिस्ट्रीब्यूशन को मानकर नहीं चलता।

non-parametric हाइपोथेसिस टेस्ट दो तरह के होते हैं:

  1. सिमुलेशन-आधारित.
  2. रैंक-आधारित.
R में Hypothesis Testing

t_test()

$H_{0}$: $\mu_{child} - \mu_{adult} = 0$     $H_{A}$: $\mu_{child} - \mu_{adult} > 0$

library(infer)
stack_overflow %>% 
  t_test(
    converted_comp ~ age_first_code_cut,
    order = c("child", "adult"),
    alternative = "greater"
  )
# A tibble: 1 x 6
  statistic  t_df p_value alternative lower_ci upper_ci
      <dbl> <dbl>   <dbl> <chr>          <dbl>    <dbl>
1      2.40 2083. 0.00814 greater        8438.      Inf
R में Hypothesis Testing

नल डिस्ट्रीब्यूशन निकालना

सिमुलेशन-आधारित पाइपलाइन
null_distn <- stack_overflow %>% 
  specify(converted_comp ~ age_first_code_cut) %>%

hypothesize(null = "independence") %>%
generate(reps = 5000, type = "permute") %>%
calculate( stat = "diff in means", order = c("child", "adult") )
तुलना के लिए t-test
library(infer)
stack_overflow %>% 
  t_test(
    converted_comp ~ age_first_code_cut,
    order = c("child", "adult"),
    alternative = "greater"
  )
R में Hypothesis Testing

Observed statistic निकालना

सिमुलेशन-आधारित पाइपलाइन
obs_stat <- stack_overflow %>% 
  specify(converted_comp ~ age_first_code_cut) %>% 
  calculate(
    stat = "diff in means", 
    order = c("child", "adult")
  )
तुलना के लिए t-test
library(infer)
stack_overflow %>% 
  t_test(
    converted_comp ~ age_first_code_cut,
    order = c("child", "adult"),
    alternative = "greater"
  )
R में Hypothesis Testing

p-value प्राप्त करें

सिमुलेशन-आधारित पाइपलाइन
get_p_value(
  null_distn, obs_stat, 
  direction = "greater"
)
# A tibble: 1 x 1
  p_value
    <dbl>
1  0.0066
तुलना के लिए t-test
library(infer)
stack_overflow %>% 
  t_test(
    converted_comp ~ age_first_code_cut,
    order = c("child", "adult"),
    alternative = "greater"
  )
# A tibble: 1 x 6
  statistic  t_df p_value alternative lower_ci upper_ci
      <dbl> <dbl>   <dbl> <chr>          <dbl>    <dbl>
1      2.40 2083. 0.00814 greater        8438.      Inf
R में Hypothesis Testing

वेक्टर की रैंक्स

x <- c(1, 15, 3, 10, 6)
rank(x)
1 5 2 4 3

Wilcoxon-Mann-Whitney test (उर्फ़ Wilcoxon rank sum test) मोटे तौर पर न्यूमेरिक इनपुट की रैंक्स पर t-test जैसा है।

R में Hypothesis Testing

Wilcoxon-Mann-Whitney test

wilcox.test(
  converted_comp ~ age_first_code_cut,
  data = stack_overflow,
  alternative = "greater",
  correct = FALSE
) 
    Wilcoxon rank sum test

data:  converted_comp by age_first_code_cut
W = 967298, p-value <2e-16
alternative hypothesis: true location shift is greater than 0
1 इसे "Wilcoxon rank-sum test" और "Mann-Whitney U test" भी कहा जाता है।
R में Hypothesis Testing

Kruskal-Wallis test

Kruskal-Wallis test का संबंध Wilcoxon-Mann-Whitney test से वैसा ही है जैसा ANOVA का t-test से।

kruskal.test(
  converted_comp ~ job_sat,
  data = stack_overflow
)
    Kruskal-Wallis rank sum test

data:  converted_comp by job_sat
Kruskal-Wallis chi-square = 81, df = 4, p-value <2e-16
R में Hypothesis Testing

अभ्यास करते हैं!

R में Hypothesis Testing

Preparing Video For Download...