Title: | Quantum Computing for Analyzing CD4 Lymphocytes and Antiretroviral Therapy |
---|---|
Description: | Resources, tutorials, and code snippets dedicated to exploring the intersection of quantum computing and artificial intelligence (AI) in the context of analyzing Cluster of Differentiation 4 (CD4) lymphocytes and optimizing antiretroviral therapy (ART) for human immunodeficiency virus (HIV). With the emergence of quantum artificial intelligence and the development of small-scale quantum computers, there's an unprecedented opportunity to revolutionize the understanding of HIV dynamics and treatment strategies. This project leverages the R package 'qsimulatR' (Ostmeyer and Urbach, 2023, <https://CRAN.R-project.org/package=qsimulatR>), a quantum computer simulator, to explore these applications in quantum computing techniques, addressing the challenges in studying CD4 lymphocytes and enhancing ART efficacy. |
Authors: | Juan Pablo Acuña González [aut, cre, cph] |
Maintainer: | Juan Pablo Acuña González <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.3 |
Built: | 2024-10-27 12:34:58 UTC |
Source: | CRAN |
Contains longitudinal measurements of CD4 lymphocyte counts for 176 patients living with HIV, recorded over the period from 2018 to 2024. CD4 counts are a critical indicator of immune function, used to monitor the progression of HIV and the effectiveness of treatments. Measurements were taken at various points throughout the study, with some missing values due to unavailable data for specific patients at certain times.
cd_3
cd_3
A data frame with 176 rows and 18 variables:
Unique identifier for each patient.
CD4 count for the first measurement in 2018.
CD4 count for the second measurement in 2018.
CD4 count for the first measurement in 2019.
CD4 count for the second measurement in 2019.
CD4 count for the first measurement in 2020.
CD4 count for the first measurement in 2021.
CD4 count for the second measurement in 2021.
CD4 count for the third measurement in 2021.
CD4 count for the first measurement in 2022.
CD4 count for the second measurement in 2022.
CD4 count for the third measurement in 2022.
CD4 count for the first measurement in 2023.
CD4 count for the second measurement in 2023.
CD4 count for the third measurement in 2023.
CD4 count for the first measurement in 2024.
CD4 count for the second measurement in 2024.
CD4 count for the third measurement in 2024.
. CD4 counts are used to monitor immune system health in individuals with HIV. A lower CD4 count often indicates a weakened immune system, whereas higher counts suggest a stronger immune response. Some values are missing, indicating no measurement was taken for a particular patient at that time.
Clinical data from Hospital Vicente Guerrero, IMSS, HIV Clinic.
# Load the dataset data(cd_3) # Summarize CD4 counts for the year 2021 summary(cd_3[, c("cd_2021_1", "cd_2021_2", "cd_2021_3")])
# Load the dataset data(cd_3) # Summarize CD4 counts for the year 2021 summary(cd_3[, c("cd_2021_1", "cd_2021_2", "cd_2021_3")])
This function returns the class of the coefficients of a given qubit state object
complex_check(qstate_obj)
complex_check(qstate_obj)
qstate_obj |
A qubit state object created using the qsimulatR package. |
Coefficients class of given qubit state object
library(qsimulatR) ket1 <- qstate(nbits = 1, coefs = c(0, 1)) complex_check(ket1)
library(qsimulatR) ket1 <- qstate(nbits = 1, coefs = c(0, 1)) complex_check(ket1)
This function calculates the conjugate transpose of a given quantum state represented by a qstate object.
conjugate_transpose(state)
conjugate_transpose(state)
state |
A qstate object for which the conjugate transpose is to be calculated. |
The conjugate transpose of the input quantum state.
library(qsimulatR) library(qvirus) # Calculate the conjugate transpose of ket0 state <- six_state(1)[[1]] conjugate_transpose(state)
library(qsimulatR) library(qvirus) # Calculate the conjugate transpose of ket0 state <- six_state(1)[[1]] conjugate_transpose(state)
This function computes the differences in CD4 counts and viral load from the provided datasets. It returns standardized values and logs transformed viral loads, enabling interaction analysis for further modeling.
create_interactions(cd_data, vl_data)
create_interactions(cd_data, vl_data)
cd_data |
A data frame containing CD4 counts. Each row should represent an individual, and each column should represent a different time point or measurement. |
vl_data |
A data frame containing viral load measurements. It should have the same
structure as |
A list of class "interaction" containing:
A numeric vector of CD4 differences computed from the input cd_data
.
A numeric vector of standardized CD4 differences.
A numeric vector of viral load differences computed from the input vl_data
.
A numeric vector of log-transformed viral load differences.
A numeric vector of standardized log-transformed viral load differences.
# Example data frames for CD4 counts and viral loads data(cd_3) data(vl_3) # Create interactions create_interactions(cd_3[, -1], vl_3[, -1])
# Example data frames for CD4 counts and viral loads data(cd_3) data(vl_3) # Create interactions create_interactions(cd_3[, -1], vl_3[, -1])
This function estimates the payoff parameters for HIV phenotype interactions based on the provided classification object and predictions from a viral load model. It calculates the mean differences in viral loads and CD4 counts, as well as the average payoffs for each classification.
estimate_payoffs(class_obj, predictions_df)
estimate_payoffs(class_obj, predictions_df)
class_obj |
An object of class |
predictions_df |
A data frame containing predictions of viral loads,
with a column named |
A payoffs object containing the estimated payoff parameters
## Not run: library(dplyr) library(earth) library(baguette) library(rules) library(kknn) library(viralmodels) # Load required data data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Prepare predictions traindata <- interaction_obj[c(2, 5)] |> as_tibble() target <- "vlogs_diff" predictions_df <- viralpreds(target, 2, 1, 2, 123, traindata) # Estimate payoffs payoffs_results <- estimate_payoffs(class_obj, predictions_df) ## End(Not run)
## Not run: library(dplyr) library(earth) library(baguette) library(rules) library(kknn) library(viralmodels) # Load required data data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Prepare predictions traindata <- interaction_obj[c(2, 5)] |> as_tibble() target <- "vlogs_diff" predictions_df <- viralpreds(target, 2, 1, 2, 123, traindata) # Estimate payoffs payoffs_results <- estimate_payoffs(class_obj, predictions_df) ## End(Not run)
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)
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)
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)
Mean squared errors (MSE) for viral load differences and CD4 count differences by comparing the actual values with the group means from the classification.
mse(object, ...)
mse(object, ...)
object |
An object of class |
... |
Additional arguments passed to other methods (currently not used). |
A list containing the MSE for viral load differences
(vlogs_mse
) and CD4 count differences (cds_mse
).
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) mse(class_obj)
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) mse(class_obj)
This method computes the mean squared errors (MSE) for viral load and CD4 differences based on the classification results from an InteractionClassification object.
## S3 method for class 'InteractionClassification' mse(object, ...)
## S3 method for class 'InteractionClassification' mse(object, ...)
object |
An object of class |
... |
Additional arguments (currently not used). |
This function computes the nearest simulated payoff from a given list of payoffs based on a viral load difference (vl_diff). It returns both the nearest payoff value and its corresponding payoff name.
nearest_payoff(vl_diff, payoffs_list)
nearest_payoff(vl_diff, payoffs_list)
vl_diff |
Numeric value representing the viral load difference for which the nearest payoff will be found. |
payoffs_list |
A named list of payoff values, where the names correspond to specific payoffs and the values are the associated payoff values. |
A list with two elements: value
(the nearest payoff value) and name
(the name of the nearest payoff).
# Load data library(dplyr) library(qsimulatR) data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Define gates and parameters for payoffs gates <- list( T = Tgate(2), X = X(2), Id = Id(2), H = H(2), Z = Z(2), S = S(2), Y = Y(2) ) alpha <- -0.4518303; beta <- -1.654192; gamma <- -0.2638399; theta <- -0.5619246 alpha2 <- -0.04186888; beta2 <- -3.01931; gamma2 <- 0.3922753; theta2 <-1.055114 # Generate the payoffs list payoffs_list <- payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2) # Filtered data based on specific patient IDs filtered_data <- class_obj$data |> bind_cols(id = cd_3$ID) |> relocate(id) |> filter(id %in% c(37, 102, 148, 174, 180, 205)) # Apply the nearest_payoff function to each vl_diff in the filtered data filtered_data <- filtered_data |> rowwise() |> mutate(nearest = list(nearest_payoff(vl_diff, payoffs_list))) |> mutate(nearest_payoff = nearest$value, payoff_name = nearest$name) |> select(-nearest) # Remove the intermediate column # Display the updated filtered data with nearest payoff and its name print(filtered_data)
# Load data library(dplyr) library(qsimulatR) data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Define gates and parameters for payoffs gates <- list( T = Tgate(2), X = X(2), Id = Id(2), H = H(2), Z = Z(2), S = S(2), Y = Y(2) ) alpha <- -0.4518303; beta <- -1.654192; gamma <- -0.2638399; theta <- -0.5619246 alpha2 <- -0.04186888; beta2 <- -3.01931; gamma2 <- 0.3922753; theta2 <-1.055114 # Generate the payoffs list payoffs_list <- payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2) # Filtered data based on specific patient IDs filtered_data <- class_obj$data |> bind_cols(id = cd_3$ID) |> relocate(id) |> filter(id %in% c(37, 102, 148, 174, 180, 205)) # Apply the nearest_payoff function to each vl_diff in the filtered data filtered_data <- filtered_data |> rowwise() |> mutate(nearest = list(nearest_payoff(vl_diff, payoffs_list))) |> mutate(nearest_payoff = nearest$value, payoff_name = nearest$name) |> select(-nearest) # Remove the intermediate column # Display the updated filtered data with nearest payoff and its name print(filtered_data)
Check the normalization of a qstate object created by qsimulatR package.
normalize_check(qstate_obj, probs = FALSE)
normalize_check(qstate_obj, probs = FALSE)
qstate_obj |
A quantum state object. |
probs |
Are probabilities required as output? |
Either the sum of the squared magnitudes of the coefficients of the qstate object or its probabilities.
library(qsimulatR) ket0 <- qstate(nbits = 1) normalize_check(ket0)
library(qsimulatR) ket0 <- qstate(nbits = 1) normalize_check(ket0)
This function generates a list of payoffs for different combinations of quantum gate matrices. The payoffs are computed for two sets of parameters, where each set defines different values for the phenotype payoffs (v and V) in the quantum game model. The names of the payoffs are dynamically generated based on the provided gate names.
payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2)
payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2)
gates |
A named list of gate matrices. Each element of the list is a quantum gate matrix (e.g., T, X, Id, H, Z, S, Y). The names of the list elements are used to create payoff names dynamically. |
alpha |
Numeric value for the first parameter set, defining payoff for v×v. |
beta |
Numeric value for the first parameter set, defining payoff for v×V. |
gamma |
Numeric value for the first parameter set, defining payoff for V×v. |
theta |
Numeric value for the first parameter set, defining payoff for V×V. |
alpha2 |
Numeric value for the second parameter set, defining payoff for v×v. |
beta2 |
Numeric value for the second parameter set, defining payoff for v×V. |
gamma2 |
Numeric value for the second parameter set, defining payoff for V×v. |
theta2 |
Numeric value for the second parameter set, defining payoff for V×V. |
A list of payoffs where the list names correspond to the gate combinations, and the values represent the computed payoffs based on the input parameters and gate matrices.
library(qsimulatR) gates <- list( T = Tgate(2), X = X(2), Id = Id(2), H = H(2), Z = Z(2), S = S(2), Y = Y(2) ) alpha <- 0.5; beta <- 0.2; gamma <- 0.3; theta <- 0.1 alpha2 <- 0.6; beta2 <- 0.25; gamma2 <- 0.35; theta2 <- 0.15 payoffs_list <- payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2) print(payoffs_list)
library(qsimulatR) gates <- list( T = Tgate(2), X = X(2), Id = Id(2), H = H(2), Z = Z(2), S = S(2), Y = Y(2) ) alpha <- 0.5; beta <- 0.2; gamma <- 0.3; theta <- 0.1 alpha2 <- 0.6; beta2 <- 0.25; gamma2 <- 0.35; theta2 <- 0.15 payoffs_list <- payoffs_list(gates, alpha, beta, gamma, theta, alpha2, beta2, gamma2, theta2) print(payoffs_list)
This function calculates the final quantum state and expected payoffs for two players in a quantum game based on their strategies. The function uses quantum gates and unitary transformations to simulate the game dynamics.
phen_hiv(strategy1, strategy2, alpha, beta, gamma, theta)
phen_hiv(strategy1, strategy2, alpha, beta, gamma, theta)
strategy1 |
A 2x2 matrix representing the strategy of player 1. |
strategy2 |
A 2x2 matrix representing the strategy of player 2. |
alpha |
A numeric value representing the payoff for outcome |00>. |
beta |
A numeric value representing the payoff for outcome |01>. |
gamma |
A numeric value representing the payoff for outcome |10>. |
theta |
A numeric value representing the payoff for outcome |11>. |
A list containing the final quantum state (final_state
), the payoffs
for each basis state (payoffs
), and the expected payoffs for player 1 (pi_v
)
and player 2 (pi_V
).
Özlüer Başer, B. (2022). "Analyzing the competition of HIV-1 phenotypes with quantum game theory". Gazi University Journal of Science, 35(3), 1190–1198. doi:10.35378/gujs.772616
library(qsimulatR) strategy1 <- diag(2) # Identity matrix for strategy 1 strategy2 <- diag(2) # Identity matrix for strategy 2 alpha <- 1 beta <- 0.5 gamma <- 2 theta <- 0.1 result <- phen_hiv(strategy1, strategy2, alpha, beta, gamma, theta) print(result)
library(qsimulatR) strategy1 <- diag(2) # Identity matrix for strategy 1 strategy2 <- diag(2) # Identity matrix for strategy 2 alpha <- 1 beta <- 0.5 gamma <- 2 theta <- 0.1 result <- phen_hiv(strategy1, strategy2, alpha, beta, gamma, theta) print(result)
This function generates histograms and QQ plots for the differences in CD4 and viral load values contained in an interaction object. Users can choose to plot all differences or specify which type to plot.
## S3 method for class 'interaction' plot(x, type = "all", ...)
## S3 method for class 'interaction' plot(x, type = "all", ...)
x |
An interaction object containing the differences to be plotted. This object should include fields for CD4 differences (raw and standardized) and viral load differences (raw, log10-transformed, and log10-standardized). |
type |
A character string indicating the type of plot to generate. Options include: "cd_diff", "cds_diff", "vl_diff", "vlog_diff", "vlogs_diff", or "all" (the default) to plot all types of differences. |
... |
Additional arguments passed to the plot function. |
Plots histograms and QQ plots for the specified differences. If
type
is "all", all plots are arranged in a grid layout.
data("vl_3") data("cd_3") interaction_obj <- create_interactions(cd_3, vl_3) plot(interaction_obj, type = "cd_diff")
data("vl_3") data("cd_3") interaction_obj <- create_interactions(cd_3, vl_3) plot(interaction_obj, type = "cd_diff")
This function visualizes the clusters formed by the InteractionClassification
object.
It displays the viral load differences (vl_diff
) and CD4 count differences (cd_diff
)
as points, with each point color-coded by its cluster. Cluster centers are shown as red stars.
## S3 method for class 'InteractionClassification' plot( x, plot_clusters = TRUE, evaluate_clusters = FALSE, max_clusters = 10, n_clusters = 4, ... )
## S3 method for class 'InteractionClassification' plot( x, plot_clusters = TRUE, evaluate_clusters = FALSE, max_clusters = 10, n_clusters = 4, ... )
x |
An object of class |
plot_clusters |
Logical. If TRUE, plots the cluster visualization. Default is TRUE. |
evaluate_clusters |
Logical. If TRUE, plots the WSS to evaluate the optimal number of clusters. Default is FALSE. |
max_clusters |
Integer. The maximum number of clusters to evaluate if |
n_clusters |
Integer. The number of clusters to suggest when plotting the elbow method. It determines where the vertical line (xintercept) is drawn in the plot. Default is 4. |
... |
Additional arguments (currently unused). |
Additionally, it can evaluate the optimal number of clusters using the elbow method by plotting
the within-cluster sum of squares (WSS) using fviz_nbclust
.
A ggplot object that visualizes the clusters and their centers, or the WSS plot to evaluate the optimal number of clusters.
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) plot(class_obj)
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) plot(class_obj)
This method prints a summary of the CD4 and viral load differences contained in the interaction object. It provides both raw and standardized values for CD4 differences, as well as raw, log10-transformed, and log10-standardized values for viral load differences.
## S3 method for class 'interaction' print(x, ...)
## S3 method for class 'interaction' print(x, ...)
x |
An object of class |
... |
Additional arguments passed to the summary function. |
This function does not return a value; it prints the summary statistics directly to the console.
data("vl_3") data("cd_3") interaction_obj <- create_interactions(cd_3, vl_3) print(interaction_obj)
data("vl_3") data("cd_3") interaction_obj <- create_interactions(cd_3, vl_3) print(interaction_obj)
This method prints a summary of the InteractionClassification object, including the number of clusters, the cluster means, and the sizes of each cluster.
## S3 method for class 'InteractionClassification' print(x, ...)
## S3 method for class 'InteractionClassification' print(x, ...)
x |
An object of class |
... |
Additional arguments that may be passed to the print method. |
The function does not return a value; it prints the summary information to the console.
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) # Print the summary of the classification print(class_obj)
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) # Print the summary of the classification print(class_obj)
Create a normalized pure quantum state for a 1-qubit system.
pure_qubit1(theta, phi, spherical = FALSE)
pure_qubit1(theta, phi, spherical = FALSE)
theta |
The parameter theta in radians. |
phi |
The parameter phi in radians. |
spherical |
Whether to return coordinates in spherical form (default is FALSE). |
A qstate object representing the normalized pure quantum state for a 1-qubit system.
# Quantum simulator library(qsimulatR) # Define the parameters theta <- pi/4 phi <- pi/6 # Create the quantum state psi_qubit1 <- pure_qubit1(theta, phi) psi_qubit1
# Quantum simulator library(qsimulatR) # Define the parameters theta <- pi/4 phi <- pi/6 # Create the quantum state psi_qubit1 <- pure_qubit1(theta, phi) psi_qubit1
Create a normalized pure quantum state for a 2-qubit system.
pure_qubit2(theta1, theta2, phi1, phi2)
pure_qubit2(theta1, theta2, phi1, phi2)
theta1 |
The parameter theta1 in radians for the first qubit. |
theta2 |
The parameter theta2 in radians for the second qubit. |
phi1 |
The phase parameter phi1 in radians for the first qubit. |
phi2 |
The phase parameter phi2 in radians for the second qubit. |
A qstate object representing the normalized pure quantum state for a 2-qubit system.
#' # Quantum simulator library(qsimulatR) # Define the parameters theta1 <- pi/3 theta2 <- pi/4 phi1 <- pi/6 phi2 <- pi/5 # Create the quantum state psi_qubit2 <- pure_qubit2(theta1, theta2, phi1, phi2) psi_qubit2
#' # Quantum simulator library(qsimulatR) # Define the parameters theta1 <- pi/3 theta2 <- pi/4 phi1 <- pi/6 phi2 <- pi/5 # Create the quantum state psi_qubit2 <- pure_qubit2(theta1, theta2, phi1, phi2) psi_qubit2
This function simulates the evolution of entanglement between two quantum states x1 and x2 using the CNOT gate.
simulate_entanglement(x1, x2, iterations, angle, verbose = FALSE)
simulate_entanglement(x1, x2, iterations, angle, verbose = FALSE)
x1 |
Quantum state for qubit 1, represented as a qstate object. |
x2 |
Quantum state for qubit 2, represented as a qstate object. |
iterations |
Number of iterations for the entanglement process. |
angle |
Rotation angle for applying Rx gate. |
verbose |
If TRUE, prints detailed information to the console. |
A list containing the entangled quantum state x2 after each iteration and other relevant information.
library(qsimulatR) library(qvirus) x1 <- qstate(1, coefs = as.complex(c(0.8, 0.6))) x2 <- qstate(1, coefs = as.complex(c(0.38, 0.92))) results <- simulate_entanglement(x1, x2, iterations = 3, angle = pi/4, verbose = TRUE) print(results)
library(qsimulatR) library(qvirus) x1 <- qstate(1, coefs = as.complex(c(0.8, 0.6))) x2 <- qstate(1, coefs = as.complex(c(0.38, 0.92))) results <- simulate_entanglement(x1, x2, iterations = 3, angle = pi/4, verbose = TRUE) print(results)
This function creates and returns six important states on the Bloch Sphere based on the specified vector numbers.
six_state(vec_num = c(1, 2, 3, 4, 5, 6))
six_state(vec_num = c(1, 2, 3, 4, 5, 6))
vec_num |
A numeric vector specifying the indices of the states to include. Valid indices are 1 to 6. |
A list containing the selected quantum states based on the input vector vec_num.
library(qsimulatR) # Select and return states 1, 3, and 5 six_state(c(1, 3, 5))
library(qsimulatR) # Select and return states 1, 3, and 5 six_state(c(1, 3, 5))
This function provides a summary of various statistics for an interaction object, including raw and standardized differences for CD4 lymphocyte counts and viral loads. It returns a structured list of summary statistics, useful for understanding the differences in immune response and viral suppression between HIV phenotypes.
## S3 method for class 'interaction' summary(object, ...)
## S3 method for class 'interaction' summary(object, ...)
object |
An object of class |
... |
Additional arguments (currently not used). |
A list with the following components:
cd_diff_raw
Summary statistics for the raw differences in CD4 lymphocyte counts.
cd_diff_standardized
Summary statistics for the standardized CD4 lymphocyte differences.
vl_diff_raw
Summary statistics for the raw differences in viral loads.
vl_diff_log_transformed
Summary statistics for the log-transformed viral load differences.
vl_diff_log_standardized
Summary statistics for the standardized log-transformed viral load differences.
data(cd_3) data(vl_3) interaction_obj <- create_interactions(cd_3, vl_3) summary(interaction_obj)
data(cd_3) data(vl_3) interaction_obj <- create_interactions(cd_3, vl_3) summary(interaction_obj)
This function calculates and summarizes the mean viral load differences and CD4 count differences for each classification in the Interaction Classification object.
## S3 method for class 'InteractionClassification' summary(object, ...)
## S3 method for class 'InteractionClassification' summary(object, ...)
object |
An object of class |
... |
Additional arguments passed to other methods (currently not used). |
A data frame summarizing the mean viral load differences and CD4 count differences for each classification, along with the count of observations in each classification.
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) summary(class_obj)
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) summary(class_obj)
This function summarizes the payoffs object by classification.
## S3 method for class 'payoffs' summary(object, ...)
## S3 method for class 'payoffs' summary(object, ...)
object |
A payoffs object. |
... |
Additional arguments (not used). |
A tibble summarizing the estimated payoffs.
## Not run: library(dplyr) library(earth) library(baguette) library(rules) library(kknn) library(viralmodels) # Load required data data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Prepare predictions traindata <- interaction_obj[c(2, 5)] |> as_tibble() target <- "vlogs_diff" predictions_df <- viralpreds(target, 2, 1, 2, 123, traindata) # Estimate payoffs payoffs_results <- estimate_payoffs(class_obj, predictions_df) summary(payoffs_results) ## End(Not run)
## Not run: library(dplyr) library(earth) library(baguette) library(rules) library(kknn) library(viralmodels) # Load required data data(vl_3) data(cd_3) # Create interaction object and classification interaction_obj <- create_interactions(cd_3[,-1], vl_3[,-1]) class_obj <- InteractionClassification(interaction_obj$vlogs_diff, interaction_obj$cds_diff) # Prepare predictions traindata <- interaction_obj[c(2, 5)] |> as_tibble() target <- "vlogs_diff" predictions_df <- viralpreds(target, 2, 1, 2, 123, traindata) # Estimate payoffs payoffs_results <- estimate_payoffs(class_obj, predictions_df) summary(payoffs_results) ## End(Not run)
Contains longitudinal measurements of viral load for 176 patients from 2018 to 2024. Viral load is a critical marker used to monitor the effectiveness of HIV treatment by measuring the amount of HIV RNA in the blood.
vl_3
vl_3
A data frame with 176 rows and 18 variables:
Unique identifier for each patient.
Viral load for the first measurement in 2018.
Viral load for the second measurement in 2018.
Viral load for the first measurement in 2019.
Viral load for the second measurement in 2019.
Viral load for the first measurement in 2020.
Viral load for the first measurement in 2021.
Viral load for the second measurement in 2021.
Viral load for the third measurement in 2021.
Viral load for the first measurement in 2022.
Viral load for the second measurement in 2022.
Viral load for the third measurement in 2022.
Viral load for the first measurement in 2023.
Viral load for the second measurement in 2023.
Viral load for the third measurement in 2023.
Viral load for the first measurement in 2024.
Viral load for the second measurement in 2024.
Viral load for the third measurement in 2024.
The viral load measurements provide insight into the patient's response to antiretroviral therapy (ART). Lower viral load values, especially undetectable levels, indicate better control of the infection. Missing values indicate that no viral load measurement was available for that patient at that specific time.
Clinical data from Hospital Vicente Guerrero, IMSS, HIV Clinic.
## Not run: # Load the dataset data(vl_3) # Summarize viral loads for the year 2021 summary(vl_3[, c("cd_2021_1", "cd_2021_2", "cd_2021_3")]) ## End(Not run)
## Not run: # Load the dataset data(vl_3) # Summarize viral loads for the year 2021 summary(vl_3[, c("cd_2021_1", "cd_2021_2", "cd_2021_3")]) ## End(Not run)