Health History.

This data is reported via the COG1 Session. We could also use the NCI Dietary questionnaire, since this includes questions about alcohol usage. Although, we'll start at Health History Questionnaire (HHQ). Tips for finding other useful variables are integraded below.

I have already used the RedCap 'Data Export Reports & Stats' tab to download this data and place it on the server under the following: "/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/"

library(tidyverse)
library(summarytools)
library(magrittr)
library(corrplot)

setwd("/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/")
FILE<-list.files("/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/", pattern="*.r")
PATH<-"/Volumes/IGNITE_Imaging/QC_Output/R_IGNITE/RedCap/PRE/Data/"
data<-paste(PATH, FILE, sep="")

source(data)

Variable Summary

HHQ<-data %>% select(starts_with("history_"))
HHQ<-HHQ[,c(1:18)]
HHQ[, (1:18)]<-lapply(HHQ[, (1:18)], as.numeric)


print(dfSummary(HHQ, plain.ascii = TRUE, 
                justify="c", graph.magnif = .60, 
                valid.col = FALSE, 
                labels.col = TRUE, style = "grid", 
                varnumbers = FALSE, tmp.img.dir = "/tmp"), 
      method = 'render' )

Data Frame Summary

HHQ

Dimensions: 729 x 18
Duplicates: 382
Variable Stats / Values Freqs (% of Valid) Graph Missing
history_pain [numeric] Min : 0 Mean : 0.2 Max : 1
0:574(78.7%)
1:155(21.3%)
0 (0%)
history_beats [numeric] Min : 0 Mean : 0.1 Max : 1
0:665(91.2%)
1:64(8.8%)
0 (0%)
history_dizzy [numeric] Min : 0 Mean : 0.1 Max : 1
0:667(91.5%)
1:62(8.5%)
0 (0%)
history_breath_sudden [numeric] Min : 0 Mean : 0 Max : 1
0:706(96.8%)
1:23(3.2%)
0 (0%)
history_breath_rest [numeric] Min : 0 Mean : 0.1 Max : 1
0:646(88.6%)
1:83(11.4%)
0 (0%)
history_ankle [numeric] Min : 0 Mean : 0.2 Max : 1
0:618(84.8%)
1:111(15.2%)
0 (0%)
history_pain_leg [numeric] Min : 0 Mean : 0.2 Max : 1
0:619(84.9%)
1:110(15.1%)
0 (0%)
history_fatigue [numeric] Min : 0 Mean : 0.1 Max : 1
0:668(91.6%)
1:61(8.4%)
0 (0%)
history_murmur [numeric] Min : 0 Mean : 0.1 Max : 1
0:656(90.0%)
1:73(10.0%)
0 (0%)
history_stiff [numeric] Min : 0 Mean : 0.5 Max : 1
0:358(49.1%)
1:371(50.9%)
0 (0%)
history_sore [numeric] Min : 0 Mean : 0.3 Max : 1
0:545(74.8%)
1:184(25.2%)
0 (0%)
history_sprain [numeric] Min : 0 Mean : 0.1 Max : 1
0:665(91.2%)
1:64(8.8%)
0 (0%)
history_pain_foot [numeric] Min : 0 Mean : 0.2 Max : 1
0:554(76.0%)
1:175(24.0%)
0 (0%)
history_fracture [numeric] Min : 0 Mean : 0 Max : 1
0:695(95.5%)
1:33(4.5%)
1 (0.14%)
history_recent_ill [numeric] Min : 0 Mean : 0.2 Max : 1
0:565(77.6%)
1:163(22.4%)
1 (0.14%)
history_recent_hospital [numeric] Min : 0 Mean : 0.1 Max : 1
0:690(94.8%)
1:38(5.2%)
1 (0.14%)
history_recent_surgery [numeric] Min : 0 Mean : 0.1 Max : 1
0:639(87.8%)
1:89(12.2%)
1 (0.14%)
history_cig_history [numeric] Min : 0 Mean : 0 Max : 1
0:704(96.6%)
1:25(3.4%)
0 (0%)

Generated by summarytools 0.9.6 (R version 3.6.1)
2021-03-23

Corr/Cov plots

HHQ<-HHQ[complete.cases(HHQ),]
M <- cor(HHQ)

Order = "hclust"

corrplot(M, method = "square",  order="hclust", addrect = 2 )

Order = "First Principal Componant"

corrplot(M, method = "square", order = "FPC")

Order = "Angular Order of the Eigenvectors", conf.level = .95

res1 <- cor.mtest(HHQ, conf.level = .95)
corrplot(M, is.corr = TRUE,p.mat = res1$p, sig.level = .2, order = "AOE")

Data Exploration-

PCA (FactoMineR & factoextra packages)

Best online expamples: http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/112-pca-principal-component-analysis-essentials/

library(corrplot)
library(FactoMineR)
library(factoextra)

HHQ<-data %>% select(  record_id, 
                       starts_with("history_"))
HHQ<-HHQ[,c(2:19)]
HHQ<-HHQ[(complete.cases(HHQ)),]


HHQ.pca<-PCA(HHQ, graph = FALSE)
fviz_eig(HHQ.pca, addlabels = TRUE) ## MAN thats a shit scree plot

var <- get_pca_var(HHQ.pca)

par(mfrow=c(1,2))
fviz_pca_var(HHQ.pca, col.var = "cos2",
             gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"), 
             repel = TRUE )

corrplot(var$cos2, is.corr=FALSE)

par(mfrow=c(1,2))

fviz_contrib(HHQ.pca, choice = "var", axes = 1)

fviz_contrib(HHQ.pca, choice = "var", axes = 2)