Multivariate Data For sPCA and sPLS-DA
database <- textshape::column_to_rownames(database, loc = 1)
spinach <- as.data.frame(database)
spinach <- subset(spinach, select= -c(Class))
X <- spinach
Y <- database$Class
dim(X)
## [1] 30 26
“Sparse Principal Component Analysis” sPCA
explainedVariance <- tune.pca(X, ncomp = 10, center = TRUE, scale = TRUE)
plot(explainedVariance)

test.keepX <- c(seq(26))
tune.spca.res <- tune.spca(X, ncomp = 3,
nrepeat = 5,
folds = 10,
test.keepX = test.keepX)
plot(tune.spca.res)

spca <- spca(X, ncomp = 3,
scale = TRUE,
center = TRUE)
plotIndiv(spca, comp = c(1, 2), ind.names = TRUE,
group = database$Class,
ellipse = TRUE,
cutoff = 0.5,
size.title = 15,
size.legend = 15,
size.xlabel = 15,
size.ylabel = 15,
col = c("red", "orange", "blue", "green","black","purple"),
legend = TRUE, title = 'Iron stress in Spinach')

plotVar(spca, comp = c(1, 2), var.names = TRUE,
cutoff = 0,
rad.in = 1,
title = 'Iron stress in spinach')

biplot(spca, cex = 1,
group = database$Class,
pch.size = 5,
cutoff = 0.5,
size.legend = 20,
size.xlabel = 20,
size.ylabel = 20,
col = c("red", "orange", "blue", "green","black","purple"),
title = 'Iron stress in Spinach')

plotLoadings(spca, comp = 1,
size.title = 1.5,
size.name = 1,
size.axis = 1,
ncomp = 20)

plotLoadings(spca, comp = 2,
size.title = 1.5,
size.name = 1,
size.axis = 1,
ncomp = 20)

“Sparse Partial Least Squares-Discriminant Analysis” sPLS-DA
splsda <- splsda(X, Y, ncomp = 10, scale = TRUE)
set.seed(30)
plotIndiv(splsda, comp = c(1, 2), ind.names = TRUE,
group = database$Class,
ellipse = TRUE,
cutoff = 0.5,
size.title = 15,
size.legend = 15,
size.xlabel = 15,
size.ylabel = 15,
col = c("red", "orange", "blue", "green","black","purple"),
legend = TRUE, title = 'Iron stress in Spinach')

perf.splsda <- perf(splsda, validation = "Mfold",
folds = 3, nrepeat = 50,
progressBar = FALSE, auc = TRUE)
plot(perf.splsda, sd = TRUE, legend.position = "vertical")

perf.splsda$choice.ncomp
## max.dist centroids.dist mahalanobis.dist
## overall 6 8 4
## BER 6 8 4
tune.splsda <- tune.splsda(X, Y, ncomp = 4,
validation = 'Mfold',
folds = 3, nrepeat = 50,
dist = 'max.dist',
test.keepX = c (5, 10, 15, 20),
measure = "BER")
plot(tune.splsda)

final.splsda <- splsda(X, Y, ncomp = 3, keepX = c(5, 10) , scale = TRUE)
plotIndiv(final.splsda, comp = c(1, 2), ind.names = TRUE,
group = database$Class,
ellipse = TRUE,
cutoff = 0.5,
size.title = 15,
size.legend = 15,
size.xlabel = 15,
size.ylabel = 15,
col = c("red", "orange", "blue", "green","black","purple"),
legend = TRUE, title = 'Iron stress in Spinach')

plotVar(final.splsda, comp = c(1, 2), var.names = TRUE,
cutoff = 0,
rad.in = 1,
title = 'Iron stress in spinach')

biplot(final.splsda, cex = 1,
group = database$Class,
pch.size = 5,
cutoff = 0,
size.legend = 20,
size.xlabel = 20,
size.ylabel = 20,
col = c("red", "orange", "blue", "green","black","purple"),
title = 'Iron stress Spinach')

plotLoadings(final.splsda, comp = 1,
size.title = 1,
size.name = 1)

plotLoadings(final.splsda, comp = 2,
size.title = 1,
size.name = 1)

sPLS-DA model evaluation
perf.res <- perf.assess(final.splsda, dist = "max.dist",
validation = "Mfold",
folds = 5,
nrepeat = 50)
perf.res$error.rate$overall[,'max.dist']
## [1] 0.356
perf.res$error.rate.class$max.dist
## Deficiency S4 Deficiency S5 Excess S4 Excess S5 Standard S4
## 0.548 0.000 0.984 0.060 0.344
## Standard S5
## 0.200
summary(Y)
## Length N.unique N.blank Min.nchar Max.nchar
## 30 6 0 9 13
perf.res$error.rate$BER[,'max.dist']
## [1] 0.356
auc.plsda <- auroc(final.splsda, roc.comp = 3, print = FALSE)

Analysis of Variance ANOVA for 10 most important variables
ANOVATest.data <- read.csv("C:/Users/cesar/Desktop/ESPINACA MAESTRÍA/TRATAMIENTOS/Hierro/Hierro Espinaca Anovas.csv")
attach(ANOVATest.data)
str(ANOVATest.data)
## 'data.frame': 30 obs. of 28 variables:
## $ Sample : int 1 2 3 4 5 6 7 8 9 10 ...
## $ Condition : chr "Standard S4" "Standard S4" "Standard S4" "Standard S4" ...
## $ Valine : num 78.8 80.6 86.3 34.7 38.6 ...
## $ Alanine : num 230.9 231.4 207.7 71.7 91.1 ...
## $ GABA : num 1057 1060 1136 300 625 ...
## $ Glutamate : num 1018 1073 766 514 398 ...
## $ Malate : num 693 795 822 162 790 ...
## $ Succinate : num 122.3 123.2 62.1 28.1 34.5 ...
## $ Citrate : num 190.5 119 308.2 99.2 212.4 ...
## $ Aspartate : num 751 616 448 253 272 ...
## $ Betaine : num 1069 942 1187 636 471 ...
## $ Glucose : num 1070 1060 1154 408 448 ...
## $ Fructose : num 700 740 907 322 332 ...
## $ Sucrose : num 1082 1151 1162 194 329 ...
## $ Ascorbate : num 33.5 28.2 28.9 17.1 0 ...
## $ Uridine : num 165.9 178.5 137.9 85.9 86.6 ...
## $ Adenosine : num 155.9 149.9 128.3 86.1 80.4 ...
## $ Fumarate : num 233.1 262.4 248 40.9 128.3 ...
## $ Tyrosine : num 40.1 40 47.2 17.2 20.4 32.4 64.6 68.6 93.2 55.8 ...
## $ Phenylalanine: num 42.4 39 60.6 22.8 23.8 26.2 41.4 59.7 71.2 43.9 ...
## $ Guanosine : num 110.5 116.5 94.6 85 79.4 ...
## $ Formate : num 72.8 78.8 75.9 14.7 9.7 ...
## $ Choline : num 240 202 207 146 148 ...
## $ Ferulate : num 36.2 43.6 25.6 26 11.7 20 69.5 67.3 60.2 50.5 ...
## $ Glycerol : num 282 295 312 160 188 ...
## $ Isoleucine : num 37.3 37.9 46.5 19.8 19.2 32.2 55.3 61.3 71.5 52.7 ...
## $ Leucine : num 85 85.7 116.7 35 46.8 ...
## $ p.Cumarate : num 14.5 18 13.2 11.3 5.6 52.8 36 53.8 26.4 17.8 ...
Alanine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Standard S4"]
## W = 0.79129, p-value = 0.06869
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Standard S5"]
## W = 0.7975, p-value = 0.07731
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Deficiency S4"]
## W = 0.83241, p-value = 0.145
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Deficiency S5"]
## W = 0.90223, p-value = 0.4223
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Excess S4"]
## W = 0.9227, p-value = 0.5475
with(ANOVATest.data, shapiro.test(Alanine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Alanine[Condition == "Excess S5"]
## W = 0.94153, p-value = 0.6767
Hm_var <- bartlett.test(Alanine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Alanine by Condition
## Bartlett's K-squared = 10.231, df = 5, p-value = 0.06894
#### ONE WAY - ANOVA
OneWay_test <- aov(Alanine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 658135 131627 16.35 4.75e-07 ***
## Residuals 24 193179 8049
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Alanine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 81.76 -93.6823549 257.20235 0.7027974
## Excess S4-Deficiency S4 84.04 -91.4023549 259.48235 0.6788933
## Excess S5-Deficiency S4 443.74 268.2976451 619.18235 0.0000007
## Standard S4-Deficiency S4 30.30 -145.1423549 205.74235 0.9941562
## Standard S5-Deficiency S4 176.16 0.7176451 351.60235 0.0486554
## Excess S4-Deficiency S5 2.28 -173.1623549 177.72235 1.0000000
## Excess S5-Deficiency S5 361.98 186.5376451 537.42235 0.0000183
## Standard S4-Deficiency S5 -51.46 -226.9023549 123.98235 0.9409441
## Standard S5-Deficiency S5 94.40 -81.0423549 269.84235 0.5671192
## Excess S5-Excess S4 359.70 184.2576451 535.14235 0.0000202
## Standard S4-Excess S4 -53.74 -229.1823549 121.70235 0.9298531
## Standard S5-Excess S4 92.12 -83.3223549 267.56235 0.5918832
## Standard S4-Excess S5 -413.44 -588.8823549 -237.99765 0.0000022
## Standard S5-Excess S5 -267.58 -443.0223549 -92.13765 0.0010763
## Standard S5-Standard S4 145.86 -29.5823549 321.30235 0.1436309
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Alanine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Leucine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Standard S4"]
## W = 0.93425, p-value = 0.6256
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Standard S5"]
## W = 0.95138, p-value = 0.747
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Deficiency S4"]
## W = 0.95775, p-value = 0.7922
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Deficiency S5"]
## W = 0.93432, p-value = 0.6261
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Excess S4"]
## W = 0.92917, p-value = 0.5907
with(ANOVATest.data, shapiro.test(Leucine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Leucine[Condition == "Excess S5"]
## W = 0.96759, p-value = 0.8596
Hm_var <- bartlett.test(Leucine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Leucine by Condition
## Bartlett's K-squared = 8.6674, df = 5, p-value = 0.1231
#### ONE WAY - ANOVA
OneWay_test <- aov(Leucine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 187485 37497 11.25 1.14e-05 ***
## Residuals 24 79999 3333
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Leucine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 126.66 13.75927 239.56073 0.0216263
## Excess S4-Deficiency S4 -26.26 -139.16073 86.64073 0.9776628
## Excess S5-Deficiency S4 30.22 -82.68073 143.12073 0.9593674
## Standard S4-Deficiency S4 -124.06 -236.96073 -11.15927 0.0254325
## Standard S5-Deficiency S4 -71.92 -184.82073 40.98073 0.3875356
## Excess S4-Deficiency S5 -152.92 -265.82073 -40.01927 0.0039325
## Excess S5-Deficiency S5 -96.44 -209.34073 16.46073 0.1256274
## Standard S4-Deficiency S5 -250.72 -363.62073 -137.81927 0.0000058
## Standard S5-Deficiency S5 -198.58 -311.48073 -85.67927 0.0001805
## Excess S5-Excess S4 56.48 -56.42073 169.38073 0.6390570
## Standard S4-Excess S4 -97.80 -210.70073 15.10073 0.1169065
## Standard S5-Excess S4 -45.66 -158.56073 67.24073 0.8078256
## Standard S4-Excess S5 -154.28 -267.18073 -41.37927 0.0035917
## Standard S5-Excess S5 -102.14 -215.04073 10.76073 0.0924216
## Standard S5-Standard S4 52.14 -60.76073 165.04073 0.7104258
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Leucine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Isoleucine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Standard S4"]
## W = 0.86532, p-value = 0.248
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Standard S5"]
## W = 0.95057, p-value = 0.7412
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Deficiency S4"]
## W = 0.79115, p-value = 0.06849
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Deficiency S5"]
## W = 0.9121, p-value = 0.4803
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Excess S4"]
## W = 0.85569, p-value = 0.2132
with(ANOVATest.data, shapiro.test(Isoleucine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Isoleucine[Condition == "Excess S5"]
## W = 0.95008, p-value = 0.7378
Hm_var <- bartlett.test(Isoleucine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Isoleucine by Condition
## Bartlett's K-squared = 13.832, df = 5, p-value = 0.01671
#### ONE WAY - ANOVA
OneWay_test <- aov(Isoleucine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 46954 9391 8.499 9.66e-05 ***
## Residuals 24 26520 1105
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Isoleucine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 65.52 0.5163819 130.523618 0.0474188
## Excess S4-Deficiency S4 -12.44 -77.4436181 52.563618 0.9906370
## Excess S5-Deficiency S4 43.74 -21.2636181 108.743618 0.3300275
## Standard S4-Deficiency S4 -49.00 -114.0036181 16.003618 0.2208501
## Standard S5-Deficiency S4 -26.54 -91.5436181 38.463618 0.8017643
## Excess S4-Deficiency S5 -77.96 -142.9636181 -12.956382 0.0124077
## Excess S5-Deficiency S5 -21.78 -86.7836181 43.223618 0.9010008
## Standard S4-Deficiency S5 -114.52 -179.5236181 -49.516382 0.0001766
## Standard S5-Deficiency S5 -92.06 -157.0636181 -27.056382 0.0024668
## Excess S5-Excess S4 56.18 -8.8236181 121.183618 0.1183098
## Standard S4-Excess S4 -36.56 -101.5636181 28.443618 0.5210115
## Standard S5-Excess S4 -14.10 -79.1036181 50.903618 0.9835614
## Standard S4-Excess S5 -92.74 -157.7436181 -27.736382 0.0022787
## Standard S5-Excess S5 -70.28 -135.2836181 -5.276382 0.0287701
## Standard S5-Standard S4 22.46 -42.5436181 87.463618 0.8890266
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Isoleucine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Phenylalanine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Standard S4"]
## W = 0.91022, p-value = 0.4689
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Standard S5"]
## W = 0.97409, p-value = 0.9008
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Deficiency S4"]
## W = 0.91798, p-value = 0.517
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Deficiency S5"]
## W = 0.94345, p-value = 0.6904
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Excess S4"]
## W = 0.9189, p-value = 0.5229
with(ANOVATest.data, shapiro.test(Phenylalanine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Phenylalanine[Condition == "Excess S5"]
## W = 0.9455, p-value = 0.705
Hm_var <- bartlett.test(Phenylalanine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Phenylalanine by Condition
## Bartlett's K-squared = 9.0424, df = 5, p-value = 0.1074
#### ONE WAY - ANOVA
OneWay_test <- aov(Phenylalanine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 95897 19179 10.8 1.59e-05 ***
## Residuals 24 42633 1776
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Phenylalanine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 113.56 31.14094 195.979059 0.0032977
## Excess S4-Deficiency S4 27.38 -55.03906 109.799059 0.9041314
## Excess S5-Deficiency S4 20.04 -62.37906 102.459059 0.9729375
## Standard S4-Deficiency S4 -58.22 -140.63906 24.199059 0.2812325
## Standard S5-Deficiency S4 -47.46 -129.87906 34.959059 0.4959859
## Excess S4-Deficiency S5 -86.18 -168.59906 -3.760941 0.0367537
## Excess S5-Deficiency S5 -93.52 -175.93906 -11.100941 0.0197473
## Standard S4-Deficiency S5 -171.78 -254.19906 -89.360941 0.0000157
## Standard S5-Deficiency S5 -161.02 -243.43906 -78.600941 0.0000414
## Excess S5-Excess S4 -7.34 -89.75906 75.079059 0.9997556
## Standard S4-Excess S4 -85.60 -168.01906 -3.180941 0.0385599
## Standard S5-Excess S4 -74.84 -157.25906 7.579059 0.0905119
## Standard S4-Excess S5 -78.26 -160.67906 4.159059 0.0695822
## Standard S5-Excess S5 -67.50 -149.91906 14.919059 0.1542664
## Standard S5-Standard S4 10.76 -71.65906 93.179059 0.9984381
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Phenylalanine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Aspartate
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Standard S4"]
## W = 0.91633, p-value = 0.5065
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Standard S5"]
## W = 0.8624, p-value = 0.237
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Deficiency S4"]
## W = 0.84847, p-value = 0.1897
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Deficiency S5"]
## W = 0.81641, p-value = 0.1095
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Excess S4"]
## W = 0.92982, p-value = 0.5951
with(ANOVATest.data, shapiro.test(Aspartate[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Aspartate[Condition == "Excess S5"]
## W = 0.95756, p-value = 0.7909
Hm_var <- bartlett.test(Aspartate ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Aspartate by Condition
## Bartlett's K-squared = 11.294, df = 5, p-value = 0.04585
#### ONE WAY - ANOVA
OneWay_test <- aov(Aspartate ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 3206630 641326 17.42 2.68e-07 ***
## Residuals 24 883530 36814
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Aspartate ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 103.26 -271.94177 478.46177 0.9544147
## Excess S4-Deficiency S4 119.86 -255.34177 495.06177 0.9174022
## Excess S5-Deficiency S4 920.32 545.11823 1295.52177 0.0000011
## Standard S4-Deficiency S4 200.04 -175.16177 575.24177 0.5764802
## Standard S5-Deficiency S4 597.84 222.63823 973.04177 0.0006390
## Excess S4-Deficiency S5 16.60 -358.60177 391.80177 0.9999923
## Excess S5-Deficiency S5 817.06 441.85823 1192.26177 0.0000079
## Standard S4-Deficiency S5 96.78 -278.42177 471.98177 0.9652028
## Standard S5-Deficiency S5 494.58 119.37823 869.78177 0.0051622
## Excess S5-Excess S4 800.46 425.25823 1175.66177 0.0000109
## Standard S4-Excess S4 80.18 -295.02177 455.38177 0.9846150
## Standard S5-Excess S4 477.98 102.77823 853.18177 0.0071752
## Standard S4-Excess S5 -720.28 -1095.48177 -345.07823 0.0000534
## Standard S5-Excess S5 -322.48 -697.68177 52.72177 0.1217383
## Standard S5-Standard S4 397.80 22.59823 773.00177 0.0332536
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Aspartate, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Malate
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Malate[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Standard S4"]
## W = 0.69262, p-value = 0.008004
with(ANOVATest.data, shapiro.test(Malate[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Standard S5"]
## W = 0.94179, p-value = 0.6786
with(ANOVATest.data, shapiro.test(Malate[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Deficiency S4"]
## W = 0.85884, p-value = 0.2241
with(ANOVATest.data, shapiro.test(Malate[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Deficiency S5"]
## W = 0.94898, p-value = 0.7299
with(ANOVATest.data, shapiro.test(Malate[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Excess S4"]
## W = 0.94965, p-value = 0.7347
with(ANOVATest.data, shapiro.test(Malate[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Malate[Condition == "Excess S5"]
## W = 0.67618, p-value = 0.005306
Hm_var <- bartlett.test(Malate ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Malate by Condition
## Bartlett's K-squared = 12.851, df = 5, p-value = 0.02481
#### ONE WAY - ANOVA
OneWay_test <- aov(Malate ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 10330744 2066149 14.99 1.03e-06 ***
## Residuals 24 3307604 137817
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Malate ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 -110.86 -836.8171 615.0971 0.9967115
## Excess S4-Deficiency S4 -1199.28 -1925.2371 -473.3229 0.0004081
## Excess S5-Deficiency S4 -1343.78 -2069.7371 -617.8229 0.0000897
## Standard S4-Deficiency S4 -1196.36 -1922.3171 -470.4029 0.0004208
## Standard S5-Deficiency S4 -1412.08 -2138.0371 -686.1229 0.0000441
## Excess S4-Deficiency S5 -1088.42 -1814.3771 -362.4629 0.0013115
## Excess S5-Deficiency S5 -1232.92 -1958.8771 -506.9629 0.0002864
## Standard S4-Deficiency S5 -1085.50 -1811.4571 -359.5429 0.0013523
## Standard S5-Deficiency S5 -1301.22 -2027.1771 -575.2629 0.0001398
## Excess S5-Excess S4 -144.50 -870.4571 581.4571 0.9888099
## Standard S4-Excess S4 2.92 -723.0371 728.8771 1.0000000
## Standard S5-Excess S4 -212.80 -938.7571 513.1571 0.9410936
## Standard S4-Excess S5 147.42 -578.5371 873.3771 0.9877539
## Standard S5-Excess S5 -68.30 -794.2571 657.6571 0.9996803
## Standard S5-Standard S4 -215.72 -941.6771 510.2371 0.9377948
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Malate, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Citrate
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Standard S4"]
## W = 0.94196, p-value = 0.6798
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Standard S5"]
## W = 0.94918, p-value = 0.7313
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Deficiency S4"]
## W = 0.96714, p-value = 0.8566
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Deficiency S5"]
## W = 0.95944, p-value = 0.8041
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Excess S4"]
## W = 0.93515, p-value = 0.6319
with(ANOVATest.data, shapiro.test(Citrate[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Citrate[Condition == "Excess S5"]
## W = 0.97157, p-value = 0.8852
Hm_var <- bartlett.test(Citrate ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Citrate by Condition
## Bartlett's K-squared = 27.587, df = 5, p-value = 4.382e-05
#### ONE WAY - ANOVA
OneWay_test <- aov(Citrate ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 20123902 4024780 13.16 3.16e-06 ***
## Residuals 24 7342364 305932
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Citrate ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 1925.42 843.8064 3007.0336 0.0001535
## Excess S4-Deficiency S4 727.44 -354.1736 1809.0536 0.3305401
## Excess S5-Deficiency S4 -201.34 -1282.9536 880.2736 0.9917483
## Standard S4-Deficiency S4 -565.74 -1647.3536 515.8736 0.5957361
## Standard S5-Deficiency S4 -31.26 -1112.8736 1050.3536 0.9999991
## Excess S4-Deficiency S5 -1197.98 -2279.5936 -116.3664 0.0239185
## Excess S5-Deficiency S5 -2126.76 -3208.3736 -1045.1464 0.0000377
## Standard S4-Deficiency S5 -2491.16 -3572.7736 -1409.5464 0.0000032
## Standard S5-Deficiency S5 -1956.68 -3038.2936 -875.0664 0.0001233
## Excess S5-Excess S4 -928.78 -2010.3936 152.8336 0.1223103
## Standard S4-Excess S4 -1293.18 -2374.7936 -211.5664 0.0127470
## Standard S5-Excess S4 -758.70 -1840.3136 322.9136 0.2881102
## Standard S4-Excess S5 -364.40 -1446.0136 717.2136 0.8989448
## Standard S5-Excess S5 170.08 -911.5336 1251.6936 0.9962261
## Standard S5-Standard S4 534.48 -547.1336 1616.0936 0.6505930
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Citrate, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Adenosine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Standard S4"]
## W = 0.86549, p-value = 0.2486
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Standard S5"]
## W = 0.77997, p-value = 0.05509
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Deficiency S4"]
## W = 0.82429, p-value = 0.126
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Deficiency S5"]
## W = 0.70483, p-value = 0.01075
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Excess S4"]
## W = 0.94655, p-value = 0.7125
with(ANOVATest.data, shapiro.test(Adenosine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Adenosine[Condition == "Excess S5"]
## W = 0.86618, p-value = 0.2513
Hm_var <- bartlett.test(Adenosine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Adenosine by Condition
## Bartlett's K-squared = 28.213, df = 5, p-value = 3.307e-05
#### ONE WAY - ANOVA
OneWay_test <- aov(Adenosine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 688449 137690 18.83 1.31e-07 ***
## Residuals 24 175504 7313
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Adenosine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 31.22 -136.003561 198.44356 0.9916365
## Excess S4-Deficiency S4 14.90 -152.323561 182.12356 0.9997550
## Excess S5-Deficiency S4 419.62 252.396439 586.84356 0.0000008
## Standard S4-Deficiency S4 47.48 -119.743561 214.70356 0.9482101
## Standard S5-Deficiency S4 216.68 49.456439 383.90356 0.0061018
## Excess S4-Deficiency S5 -16.32 -183.543561 150.90356 0.9996177
## Excess S5-Deficiency S5 388.40 221.176439 555.62356 0.0000028
## Standard S4-Deficiency S5 16.26 -150.963561 183.48356 0.9996245
## Standard S5-Deficiency S5 185.46 18.236439 352.68356 0.0236728
## Excess S5-Excess S4 404.72 237.496439 571.94356 0.0000014
## Standard S4-Excess S4 32.58 -134.643561 199.80356 0.9898439
## Standard S5-Excess S4 201.78 34.556439 369.00356 0.0117634
## Standard S4-Excess S5 -372.14 -539.363561 -204.91644 0.0000056
## Standard S5-Excess S5 -202.94 -370.163561 -35.71644 0.0111834
## Standard S5-Standard S4 169.20 1.976439 336.42356 0.0462043
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Adenosine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Guanosine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Standard S4"]
## W = 0.92915, p-value = 0.5906
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Standard S5"]
## W = 0.80398, p-value = 0.08728
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Deficiency S4"]
## W = 0.80209, p-value = 0.08427
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Deficiency S5"]
## W = 0.99158, p-value = 0.9849
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Excess S4"]
## W = 0.96321, p-value = 0.8301
with(ANOVATest.data, shapiro.test(Guanosine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Guanosine[Condition == "Excess S5"]
## W = 0.94116, p-value = 0.6741
Hm_var <- bartlett.test(Guanosine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Guanosine by Condition
## Bartlett's K-squared = 25.942, df = 5, p-value = 9.156e-05
#### ONE WAY - ANOVA
OneWay_test <- aov(Guanosine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 340434 68087 18.48 1.56e-07 ***
## Residuals 24 88417 3684
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Guanosine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 18.52 -100.17237 137.21237 0.9963609
## Excess S4-Deficiency S4 21.94 -96.75237 140.63237 0.9920088
## Excess S5-Deficiency S4 307.10 188.40763 425.79237 0.0000004
## Standard S4-Deficiency S4 29.84 -88.85237 148.53237 0.9687849
## Standard S5-Deficiency S4 101.12 -17.57237 219.81237 0.1273162
## Excess S4-Deficiency S5 3.42 -115.27237 122.11237 0.9999991
## Excess S5-Deficiency S5 288.58 169.88763 407.27237 0.0000013
## Standard S4-Deficiency S5 11.32 -107.37237 130.01237 0.9996583
## Standard S5-Deficiency S5 82.60 -36.09237 201.29237 0.2959502
## Excess S5-Excess S4 285.16 166.46763 403.85237 0.0000016
## Standard S4-Excess S4 7.90 -110.79237 126.59237 0.9999417
## Standard S5-Excess S4 79.18 -39.51237 197.87237 0.3389447
## Standard S4-Excess S5 -277.26 -395.95237 -158.56763 0.0000025
## Standard S5-Excess S5 -205.98 -324.67237 -87.28763 0.0002158
## Standard S5-Standard S4 71.28 -47.41237 189.97237 0.4508801
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Guanosine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()

Uridine
#### NORMALITY's TEST AND HOMOGENEITY OF VARIANCE
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Standard S4"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Standard S4"]
## W = 0.86488, p-value = 0.2463
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Standard S5"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Standard S5"]
## W = 0.82815, p-value = 0.1347
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Deficiency S4"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Deficiency S4"]
## W = 0.83352, p-value = 0.1478
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Deficiency S5"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Deficiency S5"]
## W = 0.97516, p-value = 0.9072
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Excess S4"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Excess S4"]
## W = 0.95553, p-value = 0.7766
with(ANOVATest.data, shapiro.test(Uridine[Condition == "Excess S5"]))
##
## Shapiro-Wilk normality test
##
## data: Uridine[Condition == "Excess S5"]
## W = 0.93549, p-value = 0.6342
Hm_var <- bartlett.test(Uridine ~ Condition, data =ANOVATest.data)
Hm_var
##
## Bartlett test of homogeneity of variances
##
## data: Uridine by Condition
## Bartlett's K-squared = 13.07, df = 5, p-value = 0.02273
#### ONE WAY - ANOVA
OneWay_test <- aov(Uridine ~ Condition, data =ANOVATest.data)
summary(OneWay_test)
## Df Sum Sq Mean Sq F value Pr(>F)
## Condition 5 286169 57234 14.01 1.85e-06 ***
## Residuals 24 98034 4085
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#### POST-HOC TUKEY's Test
TukeyHSD(OneWay_test)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = Uridine ~ Condition, data = ANOVATest.data)
##
## $Condition
## diff lwr upr p adj
## Deficiency S5-Deficiency S4 23.16 -101.820346 148.140346 0.9919170
## Excess S4-Deficiency S4 36.60 -88.380346 161.580346 0.9413224
## Excess S5-Deficiency S4 282.50 157.519654 407.480346 0.0000043
## Standard S4-Deficiency S4 57.84 -67.140346 182.820346 0.7086668
## Standard S5-Deficiency S4 151.20 26.219654 276.180346 0.0114972
## Excess S4-Deficiency S5 13.44 -111.540346 138.420346 0.9993869
## Excess S5-Deficiency S5 259.34 134.359654 384.320346 0.0000168
## Standard S4-Deficiency S5 34.68 -90.300346 159.660346 0.9528482
## Standard S5-Deficiency S5 128.04 3.059654 253.020346 0.0424312
## Excess S5-Excess S4 245.90 120.919654 370.880346 0.0000373
## Standard S4-Excess S4 21.24 -103.740346 146.220346 0.9945768
## Standard S5-Excess S4 114.60 -10.380346 239.580346 0.0856085
## Standard S4-Excess S5 -224.66 -349.640346 -99.679654 0.0001345
## Standard S5-Excess S5 -131.30 -256.280346 -6.319654 0.0355344
## Standard S5-Standard S4 93.36 -31.620346 218.340346 0.2288876
#### BOXPLOT
ggplot(ANOVATest.data, aes(x = Condition, y = Uridine, fill = Condition)) +
geom_boxplot() +
geom_jitter (shape = 15,
color = "steelblue",
position = position_jitter(0.21)) +
theme_classic()
