각 범주에 속하는 객체들에 대한 표분 분산-공분산행렬을 구한다. group_variance returns a list of covariance matrices each of which represents covariance matrix within each group.

group_variance(.data, .group_var, .xvar)

Arguments

.data

관측 데이터 프레임. A raw data frame.

.group_var

범주변수. A variable to group by.

.xvar

분산-공분산 행렬에 포함될 변수. One or more variables separated by commas within c(). Each variable needs to be a numeric column of .data.

Value

리스트 형태로, 각 리스트의 원소는 각 범주의 표본 분산-공분산 행렬을 나타낸다. A list of covariance matrix

Details

이 함수는 데이터 프레임 .data 내의 범주변수 .group_var의 범주별로 .xvar에 주어진 변수들에 대한 관측 데이터의 표본 분산-공분산 행렬을 범주별 분산-공분산행렬로 추정한다. This function aggregated .data into .group_var level to have a column .group_var as group variable and columns .xvar that represent group mean value of .xvar in the original data .data.

Examples

data(binaryclass2, package = "dmtr") group_variance(binaryclass2, class, c(x1, x2))
#> [[1]] #> x1 x2 #> x1 3.333333 1.0000000 #> x2 1.000000 0.6666667 #> #> [[2]] #> x1 x2 #> x1 4.30 2.95 #> x2 2.95 3.80 #> #> attr(,"group") #> [1] 1 2 #> Levels: 1 2