Learn R Programming

uclust (version 1.0.0)

utest3: U-test for three groups

Description

Test for the separation of three groups. The null hypothesis states that the groups are homogeneous and the alternative hypothesis states that at least one is separated from the others.

Usage

utest3(group_id, md = NULL, data = NULL, alpha = 0.05, numB = 1000)

Arguments

group_id

A vector of 1s, 2s and 3s indicating to which group the samples belong. Must be in the same order as data or md.

md

Matrix of distances between all data points.

data

Data matrix. Each row represents an observation.

alpha

Significance level

numB

Number of resampling iterations.

Value

Returns a list with the following elements:

is.homo

Logical of whether test indicates that data is homogeneous

Pvalue

Replication based p-value

Bn

Test Statistic

sdBn

Standard error for Bn statistic computed through resampling

Details

Either data or md should be provided. If data are entered directly, Bn will be computed considering the squared Euclidean distance.

For more detail see Bello, Debora Zava, Marcio Valk and Gabriela Bettella Cybis. "Clustering inference in multiple groups." arXiv preprint arXiv:2106.09115 (2021).

See Also

bn3,utest,is_homo3

Examples

Run this code
# NOT RUN {
# Simulate a dataset with two separate groups,
# the first row has mean -4, the next 5 rows have mean 0 and the last 5 rows have mean 4.
data <- matrix(c(rnorm(15, -4),rnorm(75, 0), rnorm(75, 4)), nrow = 11, byrow=TRUE)
# U test for mixed up groups
utest3(group_id=c(1,2,3,1,2,3,1,2,3,1,2), data=data, numB=3000)
# U test for correct group definitions
utest3(group_id=c(1,2,2,2,2,2,3,3,3,3,3), data=data, numB=3000)


# }

Run the code above in your browser using DataLab