Multivariate redundancy analysis (RDA) in
- Analysis of associations between data with different units
- Using z-score standardized data
- 'vegan' package
- 'rda' funtion
# Install package
library(vegan)
# Redating csv form data
data1 <- read.csv("C:/Users/data.csv", header=TRUE, row.names=1)
# Converting variable types after checking data and variable types
str(data1)
data1$Var1_1 <- as.numeric(data1$Var1)
data1$Var2_1 <- as.numeric(data1$Var2)
# Data separtion after checking variable name and column
colnames(data1)
data2 <- data1[,3:12]
data3 <- data1[,13:17]
data4 <- data1[,18:25]
# Data z-score standardization
## Centering (means~0), Scaling (standard deviations=1)
data2_std.z <- decostand(data2 , method="standardize")
apply(data2_std.z, 2, mean)
apply(data2_std.z, 2, sd)
data3_std.z <- decostand(data3 , method="standardize")
apply(data3_std.z, 2, mean)
apply(data3_std.z, 2, sd)
# RDA
my.rda <- rda(data2_std.z ~ ., data=data3_std.z)
summary(my.rda)
- Interpreting results
Partitioning of variance:
Inertia | Proportion | |
Total | 5.000 | 1.0000 |
Constrained | 0.231 | 0.0462 |
Unconstrained | 4.769 | 0.9538 |
Eigenvalues, and their contribution to the variance
Importance of components:
RDA1 | RDA2 | RDA3 | PC1 | PC2 | PC3 | PC4 | PC5 | |
Eigenvalue | 0.12472 | 0.09552 | 0.010785 | 1.4360 | 1.0720 | 0.9243 | 0.8090 | 0.5277 |
Proportion Explained |
0.02494 | 0.01910 | 0.002157 | 0.2872 | 0.2144 | 0.1849 | 0.1618 | 0.1055 |
Cumulative Proportion |
0.02494 | 0.04405 | 0.046205 | 0.3334 | 0.5478 | 0.7327 | 0.8945 | 1.0000 |
Variables explain 0.04% of the variance;
(0.12472+0.09552) / 5.000 = 0.04405%
The first constrained axis (RDA1) explains 0.12472 / 5.000 = 0.025% of the variance.
The secod constrained axis (RDA2) explains 0.09552 / 5.000 = 0.019% of the variance.
Receiver operating characteristic (ROC) in R
- Validation the accuracy of the relationship
- 'pROC' package
- 'roc' funtion
'Study' 카테고리의 다른 글
Microbiome Diversity - Alpha &Beta (0) | 2022.08.03 |
---|---|
Redundancy analysis (RDA) vs. Principal Component Regression (PCA) (0) | 2022.06.30 |