This is the output for my available data regarding the sub-chronic ozone exposed mice of the four core genotype mouse model.
for(i in names(flexi.summary[["FA.O3"]])){
plot = ggplot(flexi.summary[["FA.O3"]][[i]], aes(x=dose, y=mean, group=exposure, color=exposure)) +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3,
position=position_dodge(1)) +
geom_line() +
geom_point() +
labs(title = paste(i), y = paste(i)) +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
}
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
for(i in names(flexi.summary[["FA.O3.M.F"]])){
plot = ggplot(flexi.summary[["FA.O3.M.F"]][[i]], aes(x=dose, y=mean,
group= interaction(exposure, gonad), color=exposure, shape = gonad)) +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3,
position=position_dodge(1)) +
geom_line() +
geom_point() +
labs(title = paste(i), y = paste(i)) +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
}
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
for(i in names(flexi.summary[["FA.O3.XX.XY"]])){
plot = ggplot(flexi.summary[["FA.O3.XX.XY"]][[i]], aes(x=dose, y=mean,
group= interaction(exposure, chromosome), color=exposure, shape = chromosome)) +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3,
position=position_dodge(1)) +
geom_line() +
geom_point() +
labs(title = paste(i), y = paste(i)) +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
}
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: `position_dodge()` requires non-overlapping x intervals.
for(i in names(flexi.summary[["FA.O3.FCG"]])){
plot = ggplot(flexi.summary[["FA.O3.FCG"]][[i]], aes(x=dose, y=mean,
group= interaction(exposure, chromosome, gonad), color=exposure, shape = interaction(chromosome, gonad))) +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3, position=position_dodge(1)) +
geom_line() +
geom_point() +
labs(title = paste(i), y = paste(i)) +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
}
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: `position_dodge()` requires non-overlapping x intervals.
## Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
#plot setup
frame = data.frame(gonad = factor(rep(c("F", "M"), 4)),
chromosome = factor(rep(c(rep("XX", 2), rep("XY", 2)), 2)),
exposure = factor(c(rep("Filtered Air", 4), rep("Ozone", 4))),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], frame[,2], frame[,3], sep= ":")
data = flexi.data[which(flexi.data$dose == 100),]
colname = colnames(flexi.data)
for(i in colname[12:21]){
tmp.m = aggregate(data[, i], by = list(data$gonad, data$chromosome, data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$gonad, data$chromosome, data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$gonad, data$chromosome, data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$gonad * data$chromosome * data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$gonad:data$chromosome:data$exposure`$Letters
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = interaction(gonad, chromosome), y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
#y= paste(i, " (", v.units[i], ")", sep = ""),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "right", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.9), size = 3, vjust=-0.8, hjust=-1, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste("figures/baseline/", i, " plot.png", sep = ""), width = 6, height = 4, dpi = 1000)
print(plot)
}
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 2 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 3 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_point()`).
plot = ggplot(pv.loop.summary[["FA.O3"]], aes(x=pressure, y=volume,
group=exposure, color=exposure)) +
#geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3, position=position_dodge(1)) +
geom_path() +
geom_point() +
labs(title = "PV Loop", y = "Volume") +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
plot = ggplot(pv.loop.summary[["FA.O3.M.F"]], aes(x=pressure, y=volume,
group= interaction(exposure, gonad), color=exposure, shape = gonad)) +
#geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3,
# position=position_dodge(1)) +
geom_path() +
geom_point() +
labs(title = "PV Loop by Sex", y = "volume") +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
plot = ggplot(pv.loop.summary[["FA.O3.XX.XY"]], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome), color=exposure, shape = chromosome)) +
#geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), width=3,
# position=position_dodge(1)) +
geom_path() +
geom_point() +
labs(title = "PV Loop by Chromosome", y = "volume") +
scale_color_brewer(palette="Paired") +
theme_minimal()
print(plot)
plot = ggplot(pv.loop.summary[["FA.O3.FCG"]], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome, gonad), color=exposure,
shape = interaction(chromosome, gonad))) +
geom_path() +
geom_point() +
#geom_point(data = pv.loop.data[pv.loop.data$genotype %in% "XXF",], position = position_dodge(width=0.9), show.legend = F) +
labs(title = "PV Loop All", y = "Volume (mL)", x = "Pressure (cmH2O)", color = "Exposure") +
xlim(0,31) + ylim(0,1) +
scale_color_brewer(palette="Dark2") +
theme_bw() +
theme(panel.grid.major = element_line(), panel.grid.minor = element_blank()) +
theme(legend.position = "right", plot.title = element_text(size = rel(2)))
print(plot)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_path()`).
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
plot.pv.xxf = ggplot(pv.loop.summary[["FA.O3.FCG"]][1:30, ], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome, gonad), color=exposure)) +
geom_path() +
geom_point() +
#geom_point(data = pv.loop.data[pv.loop.data$genotype %in% "XXF",], position = position_dodge(width=0.9), show.legend = F) +
labs(title = "PV Loop XX Female", y = "Volume (mL)", x = "Pressure (cmH2O)", color = "Exposure") +
xlim(0,31) + ylim(0,1) +
scale_color_brewer(palette="Dark2") +
theme_bw() +
theme(panel.grid.major = element_line(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))
print(plot.pv.xxf)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_path()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
plot.pv.xyf = ggplot(pv.loop.summary[["FA.O3.FCG"]][31:60,], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome, gonad), color=exposure)) +
geom_path() +
geom_point() +
#geom_point(data = pv.loop.data[pv.loop.data$genotype %in% "XYF",], position = position_dodge(width=0.9), show.legend = F) +
labs(title = "PV Loop XY Female", y = "Volume (mL)", x = "Pressure (cmH2O)", color = "Exposure") +
xlim(0,31) + ylim(0,1) +
scale_color_brewer(palette="Dark2") +
theme_bw() +
theme(panel.grid.major = element_line(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))
print(plot.pv.xyf)
plot.pv.xxm = ggplot(pv.loop.summary[["FA.O3.FCG"]][61:90,], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome, gonad), color=exposure)) +
geom_path() +
geom_point() +
#geom_point(data = pv.loop.data[pv.loop.data$genotype %in% "XXM",], position = position_dodge(width=0.9), show.legend = F) +
labs(title = "PV Loop XX Male", y = "Volume (mL)", x = "Pressure (cmH2O)", color = "Exposure") +
xlim(0,31) + ylim(0,1) +
scale_color_brewer(palette="Dark2") +
theme_bw() +
theme(panel.grid.major = element_line(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))
print(plot.pv.xxm)
plot.pv.xym = ggplot(pv.loop.summary[["FA.O3.FCG"]][91:120,], aes(x=pressure, y=volume,
group= interaction(exposure, chromosome, gonad), color=exposure)) +
geom_path() +
geom_point() +
#geom_point(data = pv.loop.data[pv.loop.data$genotype %in% "XYM",], position = position_dodge(width=0.9), show.legend = F) +
labs(title = "PV Loop XY Male", y = "Volume (mL)", x = "Pressure (cmH2O)", color = "Exposure") +
xlim(0,31) + ylim(0,1) +
scale_color_brewer(palette="Dark2") +
theme_bw() +
theme(panel.grid.major = element_line(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))
print(plot.pv.xym)
ggarrange(plot.pv.xxf, plot.pv.xyf, plot.pv.xxm, plot.pv.xym,
labels = c("A", "B", "C", "D"),
ncol = 2, nrow = 2)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_path()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_point()`).
#ggsave("figures/PV loops wo legend.png")
for(i in colname[11:19]){
lm.tmp = lm(data[,i] ~ gonad * chromosome * exposure, data)
print(i)
print(summary(lm.tmp))
tmp.a = aov(data[, i] ~ data$gonad * data$chromosome * data$exposure)
tmp.t = TukeyHSD(tmp.a)
}
## [1] "Rrs"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.32014 -0.08915 -0.02669 0.07225 0.60303
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.70696 0.05345 13.226 <2e-16 ***
## gonadM -0.06590 0.07208 -0.914 0.364
## chromosomeXY -0.02151 0.07368 -0.292 0.771
## exposureOzone -0.00188 0.07368 -0.026 0.980
## gonadM:chromosomeXY 0.07658 0.09954 0.769 0.444
## gonadM:exposureOzone -0.09402 0.10168 -0.925 0.358
## chromosomeXY:exposureOzone -0.02294 0.10282 -0.223 0.824
## gonadM:chromosomeXY:exposureOzone 0.01222 0.14128 0.086 0.931
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1604 on 75 degrees of freedom
## (9 observations deleted due to missingness)
## Multiple R-squared: 0.1143, Adjusted R-squared: 0.03166
## F-statistic: 1.383 on 7 and 75 DF, p-value: 0.225
##
## [1] "Ers"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8.3683 -2.4476 -0.2235 2.0405 9.8993
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 35.584 1.405 25.331 < 2e-16 ***
## gonadM -9.884 1.814 -5.450 5.42e-07 ***
## chromosomeXY -8.651 1.846 -4.686 1.13e-05 ***
## exposureOzone -8.374 1.885 -4.443 2.82e-05 ***
## gonadM:chromosomeXY 6.021 2.458 2.450 0.01647 *
## gonadM:exposureOzone 4.557 2.539 1.795 0.07649 .
## chromosomeXY:exposureOzone 7.250 2.511 2.888 0.00499 **
## gonadM:chromosomeXY:exposureOzone -4.510 3.425 -1.317 0.19165
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.973 on 80 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.4929, Adjusted R-squared: 0.4486
## F-statistic: 11.11 on 7 and 80 DF, p-value: 9.812e-10
##
## [1] "Rn"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.25810 -0.06430 -0.00939 0.04936 0.44187
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.22408 0.04411 5.081 2.73e-06 ***
## gonadM 0.02696 0.05917 0.456 0.650
## chromosomeXY 0.04053 0.05917 0.685 0.495
## exposureOzone 0.03707 0.05917 0.626 0.533
## gonadM:chromosomeXY 0.05843 0.07972 0.733 0.466
## gonadM:exposureOzone -0.07304 0.08238 -0.887 0.378
## chromosomeXY:exposureOzone -0.04758 0.08133 -0.585 0.560
## gonadM:chromosomeXY:exposureOzone -0.01225 0.11133 -0.110 0.913
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1248 on 74 degrees of freedom
## (10 observations deleted due to missingness)
## Multiple R-squared: 0.09927, Adjusted R-squared: 0.01407
## F-statistic: 1.165 on 7 and 74 DF, p-value: 0.3332
##
## [1] "G"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.90918 -0.64287 0.00446 0.58889 1.63977
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.5077 0.2855 19.290 < 2e-16 ***
## gonadM -1.0823 0.3777 -2.865 0.00534 **
## chromosomeXY -0.7456 0.3936 -1.894 0.06183 .
## exposureOzone -0.7166 0.3936 -1.821 0.07242 .
## gonadM:chromosomeXY 0.3204 0.5265 0.608 0.54460
## gonadM:exposureOzone 0.4208 0.5380 0.782 0.43640
## chromosomeXY:exposureOzone 0.4851 0.5431 0.893 0.37443
## gonadM:chromosomeXY:exposureOzone -0.2120 0.7396 -0.287 0.77511
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.8566 on 79 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.2429, Adjusted R-squared: 0.1758
## F-statistic: 3.621 on 7 and 79 DF, p-value: 0.001954
##
## [1] "H"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -9.7634 -2.0880 -0.1358 1.4328 10.1087
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 32.187 1.676 19.206 < 2e-16 ***
## gonadM -8.666 1.995 -4.345 4.7e-05 ***
## chromosomeXY -8.662 2.053 -4.220 7.3e-05 ***
## exposureOzone -8.359 2.053 -4.072 0.000122 ***
## gonadM:chromosomeXY 6.078 2.672 2.275 0.026028 *
## gonadM:exposureOzone 4.155 2.672 1.555 0.124515
## chromosomeXY:exposureOzone 7.583 2.605 2.911 0.004851 **
## gonadM:chromosomeXY:exposureOzone -5.185 3.555 -1.458 0.149292
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.747 on 69 degrees of freedom
## (15 observations deleted due to missingness)
## Multiple R-squared: 0.4351, Adjusted R-squared: 0.3778
## F-statistic: 7.593 on 7 and 69 DF, p-value: 9.021e-07
##
## [1] "A"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.212991 -0.049140 -0.003274 0.054464 0.265111
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.60045 0.03043 19.729 < 2e-16 ***
## gonadM 0.19549 0.04026 4.856 6.39e-06 ***
## chromosomeXY 0.08263 0.04195 1.970 0.0526 .
## exposureOzone 0.20754 0.04601 4.511 2.35e-05 ***
## gonadM:chromosomeXY -0.09969 0.05734 -1.738 0.0862 .
## gonadM:exposureOzone -0.10409 0.05975 -1.742 0.0856 .
## chromosomeXY:exposureOzone -0.09162 0.06038 -1.517 0.1333
## gonadM:chromosomeXY:exposureOzone 0.10020 0.08140 1.231 0.2222
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0913 on 75 degrees of freedom
## (9 observations deleted due to missingness)
## Multiple R-squared: 0.5268, Adjusted R-squared: 0.4827
## F-statistic: 11.93 on 7 and 75 DF, p-value: 4.036e-10
##
## [1] "K"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0195946 -0.0051778 0.0000572 0.0046196 0.0169932
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.106175 0.002854 37.208 < 2e-16 ***
## gonadM 0.015457 0.003684 4.196 7.14e-05 ***
## chromosomeXY 0.023988 0.003750 6.396 1.08e-08 ***
## exposureOzone 0.013255 0.003750 3.534 0.000691 ***
## gonadM:chromosomeXY -0.014353 0.005100 -2.815 0.006181 **
## gonadM:exposureOzone -0.009026 0.005100 -1.770 0.080658 .
## chromosomeXY:exposureOzone -0.016729 0.005148 -3.250 0.001706 **
## gonadM:chromosomeXY:exposureOzone 0.007900 0.007043 1.122 0.265442
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.008071 on 78 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.4399, Adjusted R-squared: 0.3897
## F-statistic: 8.753 on 7 and 78 DF, p-value: 6.73e-08
##
## [1] "Cst"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0190851 -0.0058434 -0.0004032 0.0057143 0.0263983
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.054339 0.003259 16.675 < 2e-16 ***
## gonadM 0.017124 0.004311 3.972 0.000155 ***
## chromosomeXY 0.011927 0.004394 2.714 0.008135 **
## exposureOzone 0.020336 0.004609 4.413 3.16e-05 ***
## gonadM:chromosomeXY -0.012795 0.006069 -2.108 0.038140 *
## gonadM:exposureOzone -0.012099 0.006156 -1.965 0.052836 .
## chromosomeXY:exposureOzone -0.010966 0.006156 -1.781 0.078646 .
## gonadM:chromosomeXY:exposureOzone 0.015851 0.008422 1.882 0.063468 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.009776 on 80 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.4367, Adjusted R-squared: 0.3874
## F-statistic: 8.86 on 7 and 80 DF, p-value: 4.951e-08
##
## [1] "IC"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.247589 -0.055534 -0.004735 0.057665 0.277817
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.58617 0.03226 18.172 < 2e-16 ***
## gonadM 0.19034 0.04267 4.461 2.71e-05 ***
## chromosomeXY 0.09442 0.04446 2.124 0.0369 *
## exposureOzone 0.22732 0.04562 4.983 3.68e-06 ***
## gonadM:chromosomeXY -0.10442 0.06078 -1.718 0.0898 .
## gonadM:exposureOzone -0.14229 0.06093 -2.335 0.0221 *
## chromosomeXY:exposureOzone -0.11432 0.06163 -1.855 0.0674 .
## gonadM:chromosomeXY:exposureOzone 0.17135 0.08418 2.036 0.0452 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.09677 on 78 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.503, Adjusted R-squared: 0.4584
## F-statistic: 11.28 on 7 and 78 DF, p-value: 8.783e-10
#plot setup
frame = data.frame(exposure = factor(c("Filtered Air", "Ozone")),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], sep= ":")
for(i in colname[11:19]){
tmp.m = aggregate(data[, i], by = list(data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$exposure`$Letters
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = exposure, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, " (", v.units[i], ")", sep = ""),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste("figures/baseline/FvO/", i, " plot.png", sep = ""), width = 6, height = 4, dpi = 1000)
print(plot)
}
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
#plot setup
frame = data.frame(chromosome = factor(rep(c("XX", "XY"), 2)),
exposure = factor(c(rep("Filtered Air", 2), rep("Ozone", 2))),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], frame[,2], sep= ":")
for(i in colname[11:19]){
tmp.m = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$chromosome * data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$chromosome:data$exposure`$Letters
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = chromosome, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, " (", v.units[i], ")", sep = ""),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste("figures/baseline/chromosomes/", i, " plot.png", sep = ""), width = 6, height = 4, dpi = 1000)
print(plot)
}
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
#plot setup
frame = data.frame(gonad = factor(rep(c("F", "M"), 2)),
exposure = factor(c(rep("Filtered Air", 2), rep("Ozone", 2))),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], frame[,2], sep= ":")
for(i in colname[11:19]){
tmp.m = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$gonad * data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$gonad:data$exposure`$Letters#[c("Filtered Air:Male", "Ozone:Male", "Filtered Air:Female", "Ozone:Female")]
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = gonad, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, " (", v.units[i], ")", sep = ""),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste("figures/baseline/gonads/", i, " plot.png", sep = ""), width = 6, height = 4, dpi = 1000)
print(plot)
}
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 10 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 5 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 8 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 15 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 7 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_text()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_text()`).
for(i in colname[11:19]){
tmp.a = aov(data[which(data$exposure == "Ozone"), i] ~ gonad*chromosome, data = data[which(data$exposure == "Ozone"), ])
summary(tmp.a)
}
for(i in colname[11:17]){
lm.tmp = lm(data[,i] ~ gonad * chromosome * exposure, data)
print(i)
print(summary(lm.tmp))
}
## [1] "IL6"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.67195 -0.13504 -0.07808 0.13504 0.67195
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.58744 0.28740 2.044 0.0713 .
## gonadM 0.16674 0.40644 0.410 0.6912
## chromosomeXY -0.08953 0.40644 -0.220 0.8306
## exposureOzone 0.29242 0.40644 0.719 0.4901
## gonadM:chromosomeXY 0.33536 0.57479 0.583 0.5739
## gonadM:exposureOzone -0.15558 0.57479 -0.271 0.7928
## chromosomeXY:exposureOzone 0.23632 0.57479 0.411 0.6906
## gonadM:chromosomeXY:exposureOzone -0.73948 0.79576 -0.929 0.3770
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.4064 on 9 degrees of freedom
## Multiple R-squared: 0.2741, Adjusted R-squared: -0.2904
## F-statistic: 0.4856 on 7 and 9 DF, p-value: 0.8234
##
## [1] "Cxcl2"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.89878 -0.28041 -0.03591 0.28041 0.89878
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.76045 0.43584 1.745 0.115
## gonadM 0.12441 0.61638 0.202 0.845
## chromosomeXY -0.03189 0.61638 -0.052 0.960
## exposureOzone -0.22609 0.61638 -0.367 0.722
## gonadM:chromosomeXY 0.14703 0.87169 0.169 0.870
## gonadM:exposureOzone 1.11807 0.87169 1.283 0.232
## chromosomeXY:exposureOzone 0.19387 0.87169 0.222 0.829
## gonadM:chromosomeXY:exposureOzone -0.73695 1.20680 -0.611 0.557
##
## Residual standard error: 0.6164 on 9 degrees of freedom
## Multiple R-squared: 0.4201, Adjusted R-squared: -0.03099
## F-statistic: 0.9313 on 7 and 9 DF, p-value: 0.5265
##
## [1] "Nos2"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.5349 -0.1388 -0.0028 0.1388 0.5349
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.65923 0.24992 2.638 0.027 *
## gonadM 0.23179 0.35344 0.656 0.528
## chromosomeXY 0.05116 0.35344 0.145 0.888
## exposureOzone 0.34058 0.35344 0.964 0.360
## gonadM:chromosomeXY 0.05782 0.49984 0.116 0.910
## gonadM:exposureOzone -0.21717 0.49984 -0.434 0.674
## chromosomeXY:exposureOzone -0.24116 0.49984 -0.482 0.641
## gonadM:chromosomeXY:exposureOzone -0.18950 0.69199 -0.274 0.790
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3534 on 9 degrees of freedom
## Multiple R-squared: 0.2291, Adjusted R-squared: -0.3705
## F-statistic: 0.3821 on 7 and 9 DF, p-value: 0.891
##
## [1] "Ccl20"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.49471 -0.16256 0.02228 0.16256 0.49471
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.858667 0.259470 3.309 0.00909 **
## gonadM 0.201410 0.366945 0.549 0.59644
## chromosomeXY -0.005461 0.366945 -0.015 0.98845
## exposureOzone -0.277245 0.366945 -0.756 0.46923
## gonadM:chromosomeXY -0.054616 0.518939 -0.105 0.91849
## gonadM:exposureOzone -0.011850 0.518939 -0.023 0.98228
## chromosomeXY:exposureOzone 0.194059 0.518939 0.374 0.71710
## gonadM:chromosomeXY:exposureOzone -0.315901 0.718439 -0.440 0.67052
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3669 on 9 degrees of freedom
## Multiple R-squared: 0.2752, Adjusted R-squared: -0.2885
## F-statistic: 0.4883 on 7 and 9 DF, p-value: 0.8216
##
## [1] "IL.13"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.85749 -0.12210 -0.00642 0.12210 0.85749
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.315291 0.330171 0.955 0.365
## gonadM -0.123912 0.466932 -0.265 0.797
## chromosomeXY 0.134106 0.466932 0.287 0.780
## exposureOzone 0.077869 0.466932 0.167 0.871
## gonadM:chromosomeXY 0.674515 0.660341 1.021 0.334
## gonadM:exposureOzone -0.006613 0.660341 -0.010 0.992
## chromosomeXY:exposureOzone -0.166082 0.660341 -0.252 0.807
## gonadM:chromosomeXY:exposureOzone -0.417610 0.914201 -0.457 0.659
##
## Residual standard error: 0.4669 on 9 degrees of freedom
## Multiple R-squared: 0.3068, Adjusted R-squared: -0.2324
## F-statistic: 0.569 on 7 and 9 DF, p-value: 0.7653
##
## [1] "KC"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.80158 -0.09696 0.01515 0.09696 0.80158
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.44730 0.30320 1.475 0.174
## gonadM 0.19641 0.42879 0.458 0.658
## chromosomeXY -0.09463 0.42879 -0.221 0.830
## exposureOzone -0.06403 0.42879 -0.149 0.885
## gonadM:chromosomeXY 0.45092 0.60641 0.744 0.476
## gonadM:exposureOzone -0.07179 0.60641 -0.118 0.908
## chromosomeXY:exposureOzone 0.14030 0.60641 0.231 0.822
## gonadM:chromosomeXY:exposureOzone -0.66311 0.83953 -0.790 0.450
##
## Residual standard error: 0.4288 on 9 degrees of freedom
## Multiple R-squared: 0.2982, Adjusted R-squared: -0.2477
## F-statistic: 0.5463 on 7 and 9 DF, p-value: 0.7812
##
## [1] "IFNg"
##
## Call:
## lm(formula = data[, i] ~ gonad * chromosome * exposure, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.72491 -0.14703 -0.01761 0.14703 0.72491
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.7815 0.3777 7.365 4.26e-05 ***
## gonadM -1.7888 0.5341 -3.349 0.00853 **
## chromosomeXY 0.8486 0.5341 1.589 0.14655
## exposureOzone -1.4074 0.5341 -2.635 0.02713 *
## gonadM:chromosomeXY -0.8413 0.7553 -1.114 0.29420
## gonadM:exposureOzone 1.0220 0.7553 1.353 0.20904
## chromosomeXY:exposureOzone 0.3515 0.7553 0.465 0.65274
## gonadM:chromosomeXY:exposureOzone -0.5162 1.0457 -0.494 0.63336
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.5341 on 9 degrees of freedom
## Multiple R-squared: 0.8884, Adjusted R-squared: 0.8016
## F-statistic: 10.23 on 7 and 9 DF, p-value: 0.001184
#plot setup
frame = data.frame(exposure = factor(c("Filtered Air", "Ozone")),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], sep= ":")
for(i in colname[11:17]){
tmp.m = aggregate(data[, i], by = list(data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$exposure`$Letters
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = exposure, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, "Relative Gene Expression (Relative to 18S)", sep = " "),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste( i, "gene expression plot.png", sep = " "), width = 6, height = 4, dpi = 1000)
print(plot)
}
#plot setup
frame = data.frame(chromosome = factor(rep(c("XX", "XY"), 2)),
exposure = factor(c(rep("Filtered Air", 2), rep("Ozone", 2))),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], frame[,2], sep= ":")
for(i in colname[11:17]){
tmp.m = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$chromosome, data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$chromosome * data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$chromosome:data$exposure`$Letters#[c("Filtered Air:Male", "Ozone:Male", "Filtered Air:Female", "Ozone:Female")]
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = chromosome, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, "Relative Gene Expression (Relative to 18S)", sep = " "),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste( i, "gene expression plot.png", sep = " "), width = 6, height = 4, dpi = 1000)
print(plot)
}
#plot setup
frame = data.frame(gonad = factor(rep(c("F", "M"), 2)),
exposure = factor(c(rep("Filtered Air", 2), rep("Ozone", 2))),
mean = NA, sd = NA, Tukey = NA)
ord = paste(frame[,1], frame[,2], sep= ":")
for(i in colname[11:17]){
tmp.m = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = mean, na.rm = TRUE)
tmp.s = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = sd, na.rm = TRUE)
tmp.n = aggregate(data[, i], by = list(data$gonad, data$exposure), FUN = length)
tmp.s = tmp.s$x/sqrt(tmp.n$x)
tmp.a = aov(data[, i] ~ data$gonad * data$exposure)
tmp.t = TukeyHSD(tmp.a)
tmp.l = multcompLetters4(tmp.a, tmp.t)
tmp.l = tmp.l$`data$gonad:data$exposure`$Letters
summary = frame
summary$mean = tmp.m$x
summary$sd = tmp.s
summary$Tukey = tmp.l[ord]
plot = ggplot(summary, aes(x = gonad, y = mean, fill = exposure)) +
geom_bar(stat = "identity", position = "dodge", alpha = 0.5, colour = "gray25") +
geom_point(data = data, aes(y = data[,i]), position = position_dodge(width=0.9), show.legend = F) +
#geom_text(data = data, aes(label = mouse, y = data[,i]), position = position_dodge(width=0.9), show.legend = F)+
geom_errorbar(aes(ymin=mean-sd, ymax=mean+sd), position = position_dodge(0.9),
width = 0.15, show.legend = FALSE, colour = "gray25")+
labs(title= paste(i), x="Groups",
y= paste(i, "Relative Gene Expression (Relative to 18S)", sep = " "),
fill = "Exposure")+
theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
theme(legend.position = "none", plot.title = element_text(size = rel(2)))+
geom_text(aes(label=Tukey), position = position_dodge(0.90), size = 3, vjust=-0.8, hjust=-3, color = "gray25")+
scale_fill_brewer(palette="Dark2")
#ggsave(paste( i, "gene expression plot.png", sep = " "), width = 6, height = 4, dpi = 1000)
print(plot)
}
## $Primary
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = -0.88674, df = 5.9089, p-value = 0.4099
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## -6.314425 2.964425
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 6.075 7.750
##
##
## $Secondary
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = -0.7284, df = 5.5124, p-value = 0.4961
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## -7.092232 3.892232
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 5.4 7.0
##
##
## $Pre.Ovulatory
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = 0.54973, df = 4.8928, p-value = 0.6067
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## -2.224229 3.424229
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 4.425 3.825
##
##
## $Corpus.Lutea
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = 3.0317, df = 3.458, p-value = 0.04678
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## 0.05996585 4.79003415
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 5.250 2.825
##
##
## $Artretic
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = -0.53264, df = 3.8838, p-value = 0.6233
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## -23.53023 16.03023
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 11.15 14.90
##
##
## $Total
##
## Welch Two Sample t-test
##
## data: x by data$exposure
## t = -0.06176, df = 5.7548, p-value = 0.9528
## alternative hypothesis: true difference in means between group Filtered Air and group Ozone is not equal to 0
## 95 percent confidence interval:
## -10.258175 9.758175
## sample estimates:
## mean in group Filtered Air mean in group Ozone
## 21.15 21.40