Data Processing

Step one - James (Karin’s colleague) wrote a script to transform the old Actiheart text files into single columns of RR interval data

Step two - Karin reads those files into Kubios (demo - time consuming this is really the step we are at now, and I hope to be able to help Karin soon :)

Step three - explore….. and consider models to test hypotheses

Exploration

The data for this exploration is from one subject (FL109) during one CPET (day 2). Data was processed by Karin in Kubios and exported as a time series of data. For this analysis the time series provides HR and HRV data every minute centered on a 5 minute epoch.

The window of analysis is 5 minutes, and that window slides down the raw data by minute, so we have a 5 minute HR and HRV analysis every minute.

> # This section will need to be changed drastically with additional files
> 
> data<-read.csv("~/Dropbox/MECFS/HRV-Data-Analysis/data/FL109d2_hrv_ts.csv")
> data$Time <- lubridate::hms(data$Time)
> 
> data <- mutate(data, lnHFP = log(HF.power))
> data <- mutate(data, Beats.corrected.percent = (Beats.corrected / Beats.total)*100)

Beats corrected

As expected the number of beats that are corrected increases during the CPET

Partly more noise

Partly more data

Disregard “Time” data representation on the X axis for now, but know that data points are occurring each minute of the monitoring period and represent a centered window of 5 minutes of raw RR interval data

> with(data, lineplot(Time, Beats.corrected))

Trend persists even when adjusting for the total number of beats

> with(data, lineplot(Time, Beats.corrected.percent))

Expected - Mean HR goes up during CPET

> with(data, lineplot(Time, Mean.HR))

HRV data correlation matrix

> hrv <- select(data, PNS.index, SNS.index, SDNN, Mean.HR, RMSSD, LF.power, HF.power, LF.HF.ratio, SD1, SD2, SampEn, DFA.a1, DFA.a2)
> hrvCor<-cor(hrv)
> corrplot(hrvCor, method="circle")

> corrplot(hrvCor, method="pie")

> corrplot(hrvCor, method="number")

> col <- colorRampPalette(c("#BB4444", "#EE9988", "#FFFFFF", "#77AADD", "#4477AA"))
> corrplot(hrvCor, method="color", col=col(200),  
+          type="upper", order="hclust", 
+          addCoef.col = "black", # Add coefficient of correlation
+          tl.col="black", tl.srt=45, #Text label color and rotation
+          diag=FALSE 
+          )

HFP - log normal distribution

> with(data, Hist(HF.power, scale="frequency", breaks="Sturges", col="darkgray"))

It’s common to take the natural log

Though - with this data that just seems to switch us from a strong right skew to a less strong left skew….?…. Something to keep track of as we get more of the processed files

> with(data, Hist(lnHFP, scale="frequency", breaks="Sturges", col="darkgray"))

HFP and RMSSD

> scatterplot(HF.power~RMSSD, regLine=TRUE, smooth=FALSE, boxplots=FALSE, data=data)

> scatterplot(lnHFP~RMSSD, regLine=TRUE, smooth=FALSE, boxplots=FALSE, data=data)

lnHFP during CPET

> with(data, lineplot(Time, lnHFP))

RMSSD during CPET

> with(data, lineplot(Time, RMSSD))

HR - lnHFP relationship during CPET

> scatterplot(Mean.HR~lnHFP, regLine=TRUE, smooth=FALSE, boxplots=FALSE, data=data)

> model <- lm(Mean.HR~lnHFP, data)
> summary(model)

Call:
lm(formula = Mean.HR ~ lnHFP, data = data)

Residuals:
   Min     1Q Median     3Q    Max 
-7.724 -4.773  0.066  3.444 10.613 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  129.711      2.500   51.88  < 2e-16 ***
lnHFP         -6.687      0.601  -11.12 5.89e-11 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 5.565 on 24 degrees of freedom
Multiple R-squared:  0.8376,    Adjusted R-squared:  0.8308 
F-statistic: 123.8 on 1 and 24 DF,  p-value: 5.888e-11
> res <- resid(model)
> plot(fitted(model), res)
> abline(0,0)

HR - RMSSD relationship during CPET

> scatterplot(Mean.HR~RMSSD, regLine=TRUE, smooth=FALSE, boxplots=FALSE, data=data)

> model2 <- lm(Mean.HR~RMSSD, data)
> summary(model2)

Call:
lm(formula = Mean.HR ~ RMSSD, data = data)

Residuals:
   Min     1Q Median     3Q    Max 
-8.845 -5.668 -4.081  4.082 19.513 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) 119.7337     3.0422  39.358  < 2e-16 ***
RMSSD        -1.0591     0.1769  -5.988 3.51e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 8.744 on 24 degrees of freedom
Multiple R-squared:  0.599, Adjusted R-squared:  0.5823 
F-statistic: 35.85 on 1 and 24 DF,  p-value: 3.511e-06
> res2 <- resid(model2)
> plot(fitted(model2), res2)
> abline(0,0)