A mixed effects analysis of variance approach was used to account for correlation between CPAP, BPAP and Diagnostic treatments within a subject. Pairwise differences were only evaluated when the overall test statistic was significant, thus ensuring the family-wise significant level was kept at 0.05.

library(nlme)
data <-read.csv("QTResult2.csv", stringsAsFactors=FALSE)

QTc <- lme(QT_mean ~ treatment, random = ~ 1 | Id, data=data, na.action = na.omit)
anova(QTc)
##             numDF denDF  F-value p-value
## (Intercept)     1    10 405.3377  <.0001
## treatment       2    10   2.3905  0.1417
QTVN <- lme(log(QTVN) ~ treatment, random = ~ 1 | Id, data=data, na.action = na.omit )
anova(QTVN)
##             numDF denDF  F-value p-value
## (Intercept)     1    10 610.0577  <.0001
## treatment       2    10   2.5563  0.1269
summary(QTVN)
## Linear mixed-effects model fit by REML
##   Data: data 
##        AIC      BIC    logLik
##   49.83644 53.37669 -19.91822
## 
## Random effects:
##  Formula: ~1 | Id
##         (Intercept)  Residual
## StdDev:   0.5716662 0.6172512
## 
## Fixed effects:  log(QTVN) ~ treatment 
##                         Value Std.Error DF    t-value p-value
## (Intercept)         -6.328066 0.3434631 10 -18.424297  0.0000
## treatmentcpap       -0.676909 0.3563701 10  -1.899456  0.0867
## treatmentdiagnostic -0.717020 0.3563701 10  -2.012008  0.0719
##  Correlation: 
##                     (Intr) trtmntc
## treatmentcpap       -0.519        
## treatmentdiagnostic -0.519  0.500 
## 
## Standardized Within-Group Residuals:
##         Min          Q1         Med          Q3         Max 
## -1.14989029 -0.68668511  0.04574463  0.68306291  1.13760868 
## 
## Number of Observations: 18
## Number of Groups: 6
STVQT <- lme(STVQT ~ treatment, random = ~ 1 | Id, data=data, na.action = na.omit)
anova(STVQT)
##             numDF denDF  F-value p-value
## (Intercept)     1    10 41.26577  0.0001
## treatment       2    10  4.49248  0.0405
library(emmeans)
emmeans(STVQT, pairwise ~ treatment)
## $emmeans
##  treatment  emmean   SE df lower.CL upper.CL
##  bpap        12.62 1.87  5     7.80     17.4
##  cpap         9.12 1.87  5     4.30     13.9
##  diagnostic   6.62 1.87  5     1.81     11.4
## 
## Degrees-of-freedom method: containment 
## Confidence level used: 0.95 
## 
## $contrasts
##  contrast          estimate   SE df t.ratio p.value
##  bpap - cpap           3.50 2.01 10 1.741   0.2383 
##  bpap - diagnostic     5.99 2.01 10 2.984   0.0336 
##  cpap - diagnostic     2.50 2.01 10 1.243   0.4564 
## 
## Degrees-of-freedom method: containment 
## P value adjustment: tukey method for comparing a family of 3 estimates