InteractionClassification {qvirus} | R Documentation |
This function performs k-means clustering on viral load and CD4 count differences to classify interactions into distinct groups. It returns an S3 object containing the clustering results and means for each cluster.
InteractionClassification(vl_diff, cd_diff, k = 4, ns = 100, seed = 123)
vl_diff |
A numeric vector of viral load differences. |
cd_diff |
A numeric vector of CD4 count differences. |
k |
An integer specifying the number of clusters (default is 4). |
ns |
An integer specifying the number of random starts for the k-means algorithm (default is 100). |
seed |
An integer seed for reproducibility of the clustering results (default is 123). |
An S3 object of class InteractionClassification
, containing:
data |
A data frame with the original differences and their corresponding cluster classifications. |
kmeans_result |
The result of the k-means clustering, including cluster centers and within-cluster sum of squares. |
centers |
A matrix of the cluster centers. |
k |
The number of clusters used in the clustering. |
data(vl_3)
data(cd_3)
interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1])
class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff)