R/calculateHotellingPValue.R
calculateHotellingPValue.Rd
Computes Hotelling's T-squared test statistic and p-values for each specified cell type based on PCA-projected data from query and reference datasets.
calculateHotellingPValue(
query_data,
reference_data,
query_cell_type_col,
ref_cell_type_col,
cell_types = NULL,
pc_subset = 1:5,
n_permutation = 500,
assay_name = "logcounts"
)
A SingleCellExperiment
object containing numeric expression matrix for the query cells.
A SingleCellExperiment
object containing numeric expression matrix for the reference cells.
character. The column name in the colData
of query_data
that identifies the cell types.
character. The column name in the colData
of reference_data
that identifies the cell types.
A character vector specifying the cell types to include in the plot. If NULL, all cell types are included.
A numeric vector specifying which principal components to include in the plot. Default is PC1 to PC5.
Number of permutations to perform for p-value calculation. Default is 500.
Name of the assay on which to perform computations. Default is "logcounts".
A named numeric vector of p-values from Hotelling's T-squared test for each cell type.
This function calculates Hotelling's T-squared statistic for comparing multivariate means between reference and query datasets, projected onto a subset of principal components (PCs). It performs a permutation test to obtain p-values for each cell type specified.
Hotelling, H. (1931). "The generalization of Student's ratio". *Annals of Mathematical Statistics*. 2 (3): 360–378. doi:10.1214/aoms/1177732979.
# Load data
data("reference_data")
data("query_data")
# Get the p-values
p_values <- calculateHotellingPValue(query_data = query_data,
reference_data = reference_data,
query_cell_type_col = "SingleR_annotation",
ref_cell_type_col = "expert_annotation",
pc_subset = 1:10)
round(p_values, 5)
#> CD4 CD8 B_and_plasma Myeloid
#> 0.000 0.000 0.108 0.000