데이터 세트 iris에서 품종(Species)에 따른 Sepal.Length, Sepal.Width, Petal.Length, Petal.Width 변수의 변화를 알아보는 분석입니다. 아래 문제에 답을 하세요.

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(rstatix) 
## 
## Attaching package: 'rstatix'
## 
## The following object is masked from 'package:stats':
## 
##     filter

Q1: 위 분석에서 독립변수와 종속변수는 무엇인가요?

  • species는 독립 변수이고 Sepal.Length, Sepal.Width, Petal.Length, Petal.Width는 종속변수이다.
dat <- iris
str(iris)
## 'data.frame':    150 obs. of  5 variables:
##  $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
##  $ Sepal.Width : num  3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
##  $ Petal.Length: num  1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
##  $ Petal.Width : num  0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
##  $ Species     : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...

Q2: 등분산 검정에서 등분산 조건을 만족하는 종속변수는 무엇인가요?

등분산 조건을 만족하는 종속변수는 Sepal.Width, Petal.Length, Petal.Width 이다

  • Sepal.Length를 종속변수로 같는 두 집단은등분산이 아니다 p_value가 0.00226여서 0.05 보다 작으므로.
levene_test(Sepal.Length ~ Species, data = iris)
## # A tibble: 1 × 4
##     df1   df2 statistic       p
##   <int> <int>     <dbl>   <dbl>
## 1     2   147      6.35 0.00226
  • Sepal.Width를 종속변수로 같는 두 집단은 등분산이다 p value가 0.556으로 0.05보다 크므로.
levene_test(Sepal.Width ~ Species, data = iris)
## # A tibble: 1 × 4
##     df1   df2 statistic     p
##   <int> <int>     <dbl> <dbl>
## 1     2   147     0.590 0.556
  • Petal.Length를 종속변수로 같는 두 집단은 p value가 3.128757e-08으로 0.05보다 작으므로 등분산이 아니다.
levene_test(Petal.Length ~ Species, data = iris)
## # A tibble: 1 × 4
##     df1   df2 statistic            p
##   <int> <int>     <dbl>        <dbl>
## 1     2   147      19.5 0.0000000313
  • Petal.Width를 종속변수로 같는 두 집단은 p value가 2.26052e-08 으로 0.05보다 작으므로 등분산이 아니다.
levene_test(Petal.Width ~ Species, data = iris)
## # A tibble: 1 × 4
##     df1   df2 statistic            p
##   <int> <int>     <dbl>        <dbl>
## 1     2   147      19.9 0.0000000226

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.