This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
library(lmerTest)
map <- read.table("/mnt/ultrastarQuatre/Microbiome/Skin/skin_pool/skin1234567/No_Ear_Face/Alpha_Diversity_11766_Depth/final_map.txt", sep = '\t', header=TRUE)
choa1_file <- read.table("/mnt/ultrastarQuatre/Microbiome/Skin/skin_pool/skin1234567/No_Ear_Face/Alpha_Diversity_11766_Depth/chao1.txt", sep = '\t', header =TRUE)
simpson_file <- read.table("/mnt/ultrastarQuatre/Microbiome/Skin/skin_pool/skin1234567/No_Ear_Face/Alpha_Diversity_11766_Depth/simpson.txt", sep = '\t', header =TRUE)
merge the two tables
mdata <- merge(map,choa1_file,by="SampleID")
mdata <- merge(mdata,simpson_file, by="SampleID")
mdata <- mdata[,c(1,5,9,10,13,14)]
mdata <- merge(mdata, beta_file, by="SampleID")
LME with Healthy as reference
mdata$Treatment <- factor(mdata$Treatment,levels=c("Healthy","PSO_L","PSO_N"))
### Chao1 stats (reference=Healthy)
chao1.model.healthy = lmer(Chao1 ~ Treatment + (1|Patient) , data=mdata)
summary(chao1.model.healthy)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: Chao1 ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: 6441.2
Scaled residuals:
Min 1Q Median 3Q Max
-2.3497 -0.5633 -0.0451 0.4410 4.3364
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 102521 320.2
Residual 272936 522.4
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 888.58 76.24 63.58 11.654 <2e-16 ***
TreatmentPSO_L 168.07 109.55 72.24 1.534 0.129
TreatmentPSO_N 124.73 105.90 63.64 1.178 0.243
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.696
TrtmntPSO_N -0.720 0.817
### Simpson stats (reference= Healthy)
simpson.model.healthy = lmer(Simpson ~Treatment +(1|Patient), data=mdata)
summary(simpson.model.healthy)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: Simpson ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: -265.2
Scaled residuals:
Min 1Q Median 3Q Max
-4.1327 -0.3715 0.2769 0.5856 1.8460
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 0.00963 0.09813
Residual 0.02513 0.15852
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.77381 0.02329 59.82000 33.222 <2e-16 ***
TreatmentPSO_L 0.05284 0.03345 67.95000 1.579 0.119
TreatmentPSO_N 0.03621 0.03235 59.87000 1.119 0.268
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.696
TrtmntPSO_N -0.720 0.819
### Beta-diversity (PC1) stats (reference= Healthy)
beta.pc1.healthy = lmer(PC1 ~ Treatment + (1|Patient), data = mdata)
summary(beta.pc1.healthy)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: PC1 ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: -348.4
Scaled residuals:
Min 1Q Median 3Q Max
-2.54785 -0.62132 -0.03505 0.67839 2.97771
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 0.008044 0.08969
Residual 0.020505 0.14319
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.03222 0.02121 61.44000 1.519 0.134
TreatmentPSO_L -0.04946 0.03045 69.63000 -1.624 0.109
TreatmentPSO_N -0.04547 0.02946 61.49000 -1.543 0.128
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.697
TrtmntPSO_N -0.720 0.822
RME using PSO_N as reference
mdata$Treatment <- factor(mdata$Treatment,levels=c("PSO_N","PSO_L","Healthy"))
### Chao1 stats (refence = PSO_N)
chao1.model.PSO_N = lmer(Chao1 ~ Treatment + (1|Patient) , data=mdata)
summary(chao1.model.PSO_N)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: Chao1 ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: 6441.2
Scaled residuals:
Min 1Q Median 3Q Max
-2.3497 -0.5633 -0.0451 0.4410 4.3364
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 102521 320.2
Residual 272936 522.4
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 1013.31 73.49 63.70 13.788 <2e-16 ***
TreatmentPSO_L 43.34 65.30 372.20 0.664 0.507
TreatmentHealthy -124.73 105.90 63.60 -1.178 0.243
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.362
TrtmntHlthy -0.694 0.251
### Simpson stats (reference= PSO_N)
simpson.model.PSO_N = lmer(Simpson ~Treatment +(1|Patient), data=mdata)
summary(simpson.model.PSO_N)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: Simpson ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: -265.2
Scaled residuals:
Min 1Q Median 3Q Max
-4.1327 -0.3715 0.2769 0.5856 1.8460
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 0.00963 0.09813
Residual 0.02513 0.15852
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 0.81002 0.02245 59.90000 36.078 <2e-16 ***
TreatmentPSO_L 0.01663 0.01981 367.50000 0.839 0.402
TreatmentHealthy -0.03621 0.03235 59.90000 -1.119 0.268
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.360
TrtmntHlthy -0.694 0.250
### Beta-diversity (PC1) stats (reference= PSO_N)
beta.pc1.PSO_N = lmer(PC1 ~ Treatment + (1|Patient), data = mdata)
summary(beta.pc1.PSO_N)
Linear mixed model fit by REML
t-tests use Satterthwaite approximations to degrees of freedom ['lmerMod']
Formula: PC1 ~ Treatment + (1 | Patient)
Data: mdata
REML criterion at convergence: -348.4
Scaled residuals:
Min 1Q Median 3Q Max
-2.54785 -0.62132 -0.03505 0.67839 2.97771
Random effects:
Groups Name Variance Std.Dev.
Patient (Intercept) 0.008044 0.08969
Residual 0.020505 0.14319
Number of obs: 417, groups: Patient, 54
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) -0.013249 0.020445 61.600000 -0.648 0.519
TreatmentPSO_L -0.003989 0.017900 368.800000 -0.223 0.824
TreatmentHealthy 0.045469 0.029460 61.500000 1.543 0.128
Correlation of Fixed Effects:
(Intr) TPSO_L
TrtmntPSO_L -0.357
TrtmntHlthy -0.694 0.248