#Creating Kansas Map
## ── Attaching packages ───────────────────────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ purrr 0.3.4
## ✓ tibble 3.0.3 ✓ dplyr 1.0.2
## ✓ tidyr 1.1.0 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ──────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
##
## Attaching package: 'maps'
## The following object is masked from 'package:purrr':
##
## map
## Warning in f(...): True north is not meaningful without coord_sf()
#20 Minute Aggregate Graphs by Location
## `summarise()` regrouping output by 'horizon', 'location' (override with `.groups` argument)
#20 Minute Aggregate Graphs by Treatment
## `summarise()` regrouping output by 'horizon', 'Treatment' (override with `.groups` argument)
#20 (loc) ANOVA and TukeyHSD test for all the combinations for 20-minutes methods
aggregate_mean_loc <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - location, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
return (subset_data_1)}
method_20_anova_loc <- aggregate_mean_loc(c("location", "horizon","20wsa2000",
"20wsa250", "20wsa53", "20wsa20"),
c("20wsa2000", "20wsa250", "20wsa53", "20wsa20"),
c("8mm-2mm","2mm-250um","250um-53um", "53-20um"))
for (j in 1:7){
for (i in c("8mm-2mm","2mm-250um","250um-53um", "53-20um")){
anova_one_way <- aov(value~location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
print(paste("horizon:", j, " aggregate size: ", i))
print(summary(anova_one_way))
print(TukeyHSD(anova_one_way))}}
## [1] "horizon: 1 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 1301 433.8 2.834 0.0562 .
## Residuals 28 4286 153.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -12.7518994 -29.64183 4.1380284 0.1905127
## Ottawa-Hays -20.0494757 -40.73533 0.6363767 0.0600341
## Tribune 1-Hays -11.7593682 -27.17769 3.6589559 0.1835273
## Ottawa-Konza -7.2975763 -27.98343 13.3882761 0.7711218
## Tribune 1-Konza 0.9925312 -14.42579 16.4108553 0.9980236
## Tribune 1-Ottawa 8.2901075 -11.21270 27.7929162 0.6559707
##
## [1] "horizon: 1 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 1722 573.8 7.796 0.000617 ***
## Residuals 28 2061 73.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -4.555551 -16.267779 7.156677 0.7149365
## Ottawa-Hays 8.323142 -6.021349 22.667632 0.4035331
## Tribune 1-Hays -13.215781 -23.907533 -2.524029 0.0110438
## Ottawa-Konza 12.878693 -1.465798 27.223184 0.0904063
## Tribune 1-Konza -8.660230 -19.351982 2.031523 0.1447870
## Tribune 1-Ottawa -21.538922 -35.063038 -8.014807 0.0008949
##
## [1] "horizon: 1 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 1047 348.9 0.99 0.412
## Residuals 28 9863 352.3
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 1.195110 -24.42709 26.81731 0.9992436
## Ottawa-Hays -14.658008 -46.03866 16.72265 0.5857014
## Tribune 1-Hays 3.831521 -19.55824 27.22128 0.9696116
## Ottawa-Konza -15.853118 -47.23377 15.52754 0.5222692
## Tribune 1-Konza 2.636411 -20.75335 26.02617 0.9896655
## Tribune 1-Ottawa 18.489529 -11.09644 48.07549 0.3394496
##
## [1] "horizon: 1 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 244.2 81.42 12.59 2.17e-05 ***
## Residuals 28 181.1 6.47
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -4.47375 -7.945826 -1.001674 0.0077364
## Ottawa-Hays 2.19000 -2.062407 6.442407 0.5061515
## Tribune 1-Hays -5.03000 -8.199557 -1.860443 0.0009325
## Ottawa-Konza 6.66375 2.411343 10.916157 0.0010775
## Tribune 1-Konza -0.55625 -3.725807 2.613307 0.9630773
## Tribune 1-Ottawa -7.22000 -11.229208 -3.210792 0.0001943
##
## [1] "horizon: 2 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 1262 420.6 4.29 0.013 *
## Residuals 28 2745 98.0
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -11.308215 -24.825253 2.2088219 0.1260516
## Ottawa-Hays -19.407934 -35.962856 -2.8530120 0.0168745
## Tribune 1-Hays -12.800682 -25.139993 -0.4613719 0.0398395
## Ottawa-Konza -8.099719 -24.654641 8.4552034 0.5486587
## Tribune 1-Konza -1.492467 -13.831777 10.8468435 0.9873056
## Tribune 1-Ottawa 6.607252 -9.000878 22.2153821 0.6588739
##
## [1] "horizon: 2 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 3272 1090.7 6.925 0.00125 **
## Residuals 28 4410 157.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -5.6625017 -22.795191 11.470188 0.8036434
## Ottawa-Hays 25.6004350 4.617262 46.583608 0.0122979
## Tribune 1-Hays -5.7638369 -21.403771 9.876097 0.7471062
## Ottawa-Konza 31.2629366 10.279763 52.246110 0.0018798
## Tribune 1-Konza -0.1013353 -15.741269 15.538599 0.9999980
## Tribune 1-Ottawa -31.3642719 -51.147398 -11.581146 0.0009431
##
## [1] "horizon: 2 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 2098 699.3 2.192 0.111
## Residuals 28 8933 319.0
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -2.5497909 -26.93348 21.833895 0.9917035
## Ottawa-Hays -26.1888245 -56.05262 3.674970 0.1014587
## Tribune 1-Hays -2.8805186 -25.13968 19.378640 0.9845527
## Ottawa-Konza -23.6390336 -53.50283 6.224761 0.1590303
## Tribune 1-Konza -0.3307277 -22.58989 21.928431 0.9999754
## Tribune 1-Ottawa 23.3083059 -4.84755 51.464162 0.1319897
##
## [1] "horizon: 2 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 195.13 65.04 22.4 1.34e-07 ***
## Residuals 28 81.31 2.90
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -5.82375 -8.150065 -3.4974353 0.0000012
## Ottawa-Hays -3.89500 -6.744142 -1.0458580 0.0044899
## Tribune 1-Hays -5.85000 -7.973625 -3.7263749 0.0000002
## Ottawa-Konza 1.92875 -0.920392 4.7778920 0.2729010
## Tribune 1-Konza -0.02625 -2.149875 2.0973751 0.9999858
## Tribune 1-Ottawa -1.95500 -4.641197 0.7311969 0.2168418
##
## [1] "horizon: 3 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 752 250.8 1.989 0.138
## Residuals 28 3531 126.1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -5.620143 -20.950910 9.710624 0.7501058
## Ottawa-Hays -16.508928 -35.285206 2.267350 0.1001865
## Tribune 1-Hays -7.397446 -21.392457 6.597566 0.4840937
## Ottawa-Konza -10.888786 -29.665064 7.887492 0.4039977
## Tribune 1-Konza -1.777303 -15.772314 12.217709 0.9853732
## Tribune 1-Ottawa 9.111483 -8.590962 26.813927 0.5066429
##
## [1] "horizon: 3 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 598 199.32 3.85 0.02 *
## Residuals 28 1450 51.77
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 6.161301 -3.661587 15.98418843 0.3363223
## Ottawa-Hays 8.919366 -3.111165 20.94989749 0.2033646
## Tribune 1-Hays -2.454989 -11.422018 6.51203923 0.8769446
## Ottawa-Konza 2.758065 -9.272466 14.78859688 0.9228609
## Tribune 1-Konza -8.616290 -17.583319 0.35073862 0.0630483
## Tribune 1-Ottawa -11.374356 -22.716849 -0.03186167 0.0491629
##
## [1] "horizon: 3 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 1623 541.1 1.987 0.139
## Residuals 28 7625 272.3
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -16.356409 -38.88409 6.171275 0.2186087
## Ottawa-Hays -19.830689 -47.42135 7.759976 0.2261623
## Tribune 1-Hays -14.484861 -35.04973 6.080007 0.2415778
## Ottawa-Konza -3.474281 -31.06495 24.116384 0.9857291
## Tribune 1-Konza 1.871548 -18.69332 22.436416 0.9944863
## Tribune 1-Ottawa 5.345829 -20.66690 31.358557 0.9427076
##
## [1] "horizon: 3 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 316.3 105.42 9.348 0.000191 ***
## Residuals 28 315.8 11.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.462500 -13.046831 -3.878169 0.0001393
## Ottawa-Hays -4.351250 -9.965886 1.263386 0.1727630
## Tribune 1-Hays -6.247083 -10.431986 -2.062181 0.0018416
## Ottawa-Konza 4.111250 -1.503386 9.725886 0.2123686
## Tribune 1-Konza 2.215417 -1.969486 6.400319 0.4827940
## Tribune 1-Ottawa -1.895833 -7.189363 3.397696 0.7630358
##
## [1] "horizon: 4 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 808.4 269.5 2.615 0.0708 .
## Residuals 28 2884.7 103.0
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 6.519482 -7.336915 20.37587843 0.5800037
## Ottawa-Hays -10.454866 -27.425417 6.51568485 0.3517030
## Tribune 1-Hays -1.688083 -14.337185 10.96101885 0.9831127
## Ottawa-Konza -16.974348 -33.944898 -0.00379689 0.0499329
## Tribune 1-Konza -8.207565 -20.856666 4.44153711 0.3077163
## Tribune 1-Ottawa 8.766783 -7.233206 24.76677177 0.4532277
##
## [1] "horizon: 4 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 3746 1249 10.68 7.51e-05 ***
## Residuals 28 3275 117
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 9.652655 -5.1116926 24.417004 0.3014301
## Ottawa-Hays 17.931911 -0.1506489 36.014470 0.0525581
## Tribune 1-Hays -11.957613 -25.4355573 1.520331 0.0958929
## Ottawa-Konza 8.279255 -9.8033044 26.361815 0.6012021
## Tribune 1-Konza -21.610269 -35.0882128 -8.132325 0.0008275
## Tribune 1-Ottawa -29.889524 -46.9379245 -12.841123 0.0002761
##
## [1] "horizon: 4 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 4547 1515.7 8.734 0.000301 ***
## Residuals 28 4859 173.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -33.205891 -51.189971 -15.221811023 0.0001389
## Ottawa-Hays -22.020354 -44.046264 0.005555124 0.0500758
## Tribune 1-Hays -15.303650 -31.720793 1.113493885 0.0744489
## Ottawa-Konza 11.185536 -10.840373 33.211445967 0.5179086
## Tribune 1-Konza 17.902241 1.485097 34.319384728 0.0286145
## Tribune 1-Ottawa 6.716705 -14.049522 27.482931281 0.8135632
##
## [1] "horizon: 4 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 309.6 103.20 25.3 3.99e-08 ***
## Residuals 28 114.2 4.08
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.03125 -10.7882339 -5.2742661 0.0000001
## Ottawa-Hays -3.41375 -6.7903519 -0.0371481 0.0467926
## Tribune 1-Hays -6.48875 -9.0055205 -3.9719795 0.0000007
## Ottawa-Konza 4.61750 1.2408981 7.9941019 0.0044767
## Tribune 1-Konza 1.54250 -0.9742705 4.0592705 0.3561364
## Tribune 1-Ottawa -3.07500 -6.2584908 0.1084908 0.0612153
##
## [1] "horizon: 5 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 352.1 117.35 3.075 0.0438 *
## Residuals 28 1068.5 38.16
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 3.197370 -5.235720 11.6304613 0.7305215
## Ottawa-Hays -8.093594 -18.421979 2.2347909 0.1654930
## Tribune 1-Hays -1.526332 -9.224656 6.1719914 0.9481014
## Ottawa-Konza -11.290964 -21.619349 -0.9625796 0.0281230
## Tribune 1-Konza -4.723703 -12.422026 2.9746209 0.3551370
## Tribune 1-Ottawa 6.567262 -3.170433 16.3049564 0.2759395
##
## [1] "horizon: 5 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 5423 1807.6 14.98 5.23e-06 ***
## Residuals 28 3378 120.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 7.540339 -7.454618 22.535297 0.5261125
## Ottawa-Hays 6.140531 -12.224467 24.505528 0.7981509
## Tribune 1-Hays -22.029415 -35.717875 -8.340954 0.0007924
## Ottawa-Konza -1.399809 -19.764806 16.965188 0.9967360
## Tribune 1-Konza -29.569754 -43.258215 -15.881293 0.0000138
## Tribune 1-Ottawa -28.169945 -45.484631 -10.855260 0.0006970
##
## [1] "horizon: 5 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 3881 1293.7 7.475 0.000797 ***
## Residuals 28 4846 173.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -28.396335 -46.356501 -10.4361695 0.0009733
## Ottawa-Hays -21.655408 -43.652029 0.3412123 0.0548559
## Tribune 1-Hays -7.708099 -24.103412 8.6872145 0.5806119
## Ottawa-Konza 6.740927 -15.255694 28.7375475 0.8365525
## Tribune 1-Konza 20.688237 4.292923 37.0835496 0.0092784
## Tribune 1-Ottawa 13.947310 -6.791303 34.6859227 0.2782110
##
## [1] "horizon: 5 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 309.1 103.04 3.558 0.0268 *
## Residuals 28 810.8 28.96
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.631250 -15.977593 -1.284907 0.0165921
## Ottawa-Hays -4.408750 -13.406146 4.588646 0.5474280
## Tribune 1-Hays -3.117917 -9.824179 3.588346 0.5893512
## Ottawa-Konza 4.222500 -4.774896 13.219896 0.5820158
## Tribune 1-Konza 5.513333 -1.192929 12.219596 0.1359853
## Tribune 1-Ottawa 1.290833 -7.191993 9.773659 0.9753683
##
## [1] "horizon: 6 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 588.3 196.09 4.509 0.0106 *
## Residuals 28 1217.7 43.49
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 0.06592548 -8.936884 9.068734 0.9999971
## Ottawa-Hays 8.00924649 -3.016898 19.035391 0.2182734
## Tribune 1-Hays -5.53326524 -13.751668 2.685137 0.2773085
## Ottawa-Konza 7.94332102 -3.082823 18.969465 0.2244296
## Tribune 1-Konza -5.59919071 -13.817593 2.619212 0.2677630
## Tribune 1-Ottawa -13.54251173 -23.938060 -3.146963 0.0070168
##
## [1] "horizon: 6 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 7152 2383.8 14.97 5.25e-06 ***
## Residuals 28 4457 159.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 22.252171 5.028255 39.47609 0.0075562
## Ottawa-Hays 34.729856 13.634952 55.82476 0.0006048
## Tribune 1-Hays -5.407359 -21.130572 10.31585 0.7842918
## Ottawa-Konza 12.477685 -8.617219 33.57259 0.3868301
## Tribune 1-Konza -27.659530 -43.382743 -11.93632 0.0002642
## Tribune 1-Ottawa -40.137215 -60.025680 -20.24875 0.0000391
##
## [1] "horizon: 6 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 13872 4624 26.24 2.76e-08 ***
## Residuals 28 4934 176
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -42.82301 -60.94544 -24.700569 0.0000032
## Ottawa-Hays -59.60772 -81.80308 -37.412353 0.0000003
## Tribune 1-Hays -13.27018 -29.81363 3.273266 0.1507246
## Ottawa-Konza -16.78471 -38.98007 5.410652 0.1893857
## Tribune 1-Konza 29.55283 13.00938 46.096272 0.0002162
## Tribune 1-Ottawa 46.33754 25.41155 67.263523 0.0000093
##
## [1] "horizon: 6 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 3 378.7 126.23 15.38 4.19e-06 ***
## Residuals 28 229.8 8.21
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.105 -12.016077 -4.193923 0.0000262
## Ottawa-Hays -9.620 -14.410071 -4.829929 0.0000420
## Tribune 1-Hays -6.660 -10.230308 -3.089692 0.0001207
## Ottawa-Konza -1.515 -6.305071 3.275071 0.8234107
## Tribune 1-Konza 1.445 -2.125308 5.015308 0.6894539
## Tribune 1-Ottawa 2.960 -1.556123 7.476123 0.2993408
##
## [1] "horizon: 7 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 6819 3409 46.03 2.35e-06 ***
## Residuals 12 889 74
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -2.884963 -17.27610 11.50617 0.8559384
## Ottawa-Hays 46.302116 30.06672 62.53751 0.0000173
## Ottawa-Konza 49.187078 34.79594 63.57822 0.0000027
##
## [1] "horizon: 7 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 1149 574.3 1.889 0.194
## Residuals 12 3648 304.0
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 20.900028 -8.254743 50.05480 0.1775047
## Ottawa-Hays 16.834785 -16.056232 49.72580 0.3884811
## Ottawa-Konza -4.065243 -33.220013 25.08953 0.9270128
##
## [1] "horizon: 7 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 9160 4580 36.45 7.98e-06 ***
## Residuals 12 1508 126
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -32.18964 -50.93527 -13.44401 0.0016875
## Ottawa-Hays -67.63942 -88.78734 -46.49150 0.0000054
## Ottawa-Konza -35.44978 -54.19541 -16.70415 0.0007742
##
## [1] "horizon: 7 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 452.2 226.12 19.6 0.000166 ***
## Residuals 12 138.5 11.54
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_20_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -9.426071 -15.10632 -3.7458250 0.0021980
## Ottawa-Hays -14.777500 -21.18568 -8.3693178 0.0001351
## Ottawa-Konza -5.351429 -11.03168 0.3288179 0.0654790
#20 (trt) ANOVA and TukeyHSD test for all the combinations for 20-minutes methods
aggregate_mean_trt <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - Treatment, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
return (subset_data_1)}
method_20_anova <- aggregate_mean_trt(c("Treatment", "horizon","20wsa2000",
"20wsa250", "20wsa53", "20wsa20"),
c("20wsa2000", "20wsa250", "20wsa53", "20wsa20"),
c("8mm-2mm","2mm-250um","250um-53um", "53-20um"))
for (j in 1:7){
for (i in c("8mm-2mm","2mm-250um","250um-53um", "53-20um")){
anova_one_way <- aov(value~Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
print(paste("horizon:", j, " aggregate size: ", i))
print(summary(anova_one_way))
print(TukeyHSD(anova_one_way))}}
## [1] "horizon: 1 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 3621 1810.7 26.71 2.65e-07 ***
## Residuals 29 1966 67.8
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 6.500537 -2.780679 15.78175 0.2114758
## NP-AG 23.949712 15.648341 32.25108 0.0000002
## NP-EA 17.449175 8.167960 26.73039 0.0001967
##
## [1] "horizon: 1 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 681.5 340.8 3.187 0.0561 .
## Residuals 29 3101.0 106.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -1.812328 -13.468699 9.844042 0.9221618
## NP-AG 8.696664 -1.729111 19.122439 0.1160977
## NP-EA 10.508992 -1.147378 22.165363 0.0834418
##
## [1] "horizon: 1 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 6250 3125.1 19.45 4.39e-06 ***
## Residuals 29 4660 160.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 6.21554 -8.073402 20.50448 0.5372980
## NP-AG -25.95051 -38.730924 -13.17009 0.0000706
## NP-EA -32.16605 -46.454988 -17.87710 0.0000157
##
## [1] "horizon: 1 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 119.3 59.67 5.654 0.00844 **
## Residuals 29 306.0 10.55
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -1.063333 -4.725215 2.5985486 0.7554161
## NP-AG -4.322500 -7.597787 -1.0472132 0.0077864
## NP-EA -3.259167 -6.921049 0.4027153 0.0884050
##
## [1] "horizon: 2 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2818 1409 34.35 2.24e-08 ***
## Residuals 29 1189 41
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 2.102042 -5.116609 9.320693 0.7542359
## NP-AG 20.150130 13.693572 26.606687 0.0000000
## NP-EA 18.048088 10.829437 25.266739 0.0000029
##
## [1] "horizon: 2 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 489 244.7 0.987 0.385
## Residuals 29 7193 248.0
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -10.081275 -27.83393 7.671375 0.3528573
## NP-AG -3.567849 -19.44630 12.310604 0.8447833
## NP-EA 6.513426 -11.23922 24.266077 0.6408508
##
## [1] "horizon: 2 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 4339 2169.3 9.401 0.000713 ***
## Residuals 29 6692 230.8
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 17.85798 0.7344178 34.981535 0.0395974
## NP-AG -12.20594 -27.5217193 3.109833 0.1382314
## NP-EA -30.06392 -47.1874776 -12.940361 0.0004562
##
## [1] "horizon: 2 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 65.26 32.63 4.481 0.0202 *
## Residuals 29 211.18 7.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 3.1537500 0.1118929 6.1956071 0.0409486
## NP-AG -0.2666667 -2.9873864 2.4540530 0.9682515
## NP-EA -3.4204167 -6.4622738 -0.3785596 0.0250264
##
## [1] "horizon: 3 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 3719 1859.4 95.47 1.74e-13 ***
## Residuals 29 565 19.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 1.700825 -3.273864 6.675514 0.6789277
## NP-AG 22.906298 18.456801 27.355795 0.0000000
## NP-EA 21.205473 16.230784 26.180162 0.0000000
##
## [1] "horizon: 3 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 793.9 397.0 9.182 0.000814 ***
## Residuals 29 1253.7 43.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -10.456376 -17.867979 -3.044773 0.0043968
## NP-AG 1.807655 -4.821484 8.436794 0.7806286
## NP-EA 12.264031 4.852428 19.675634 0.0008969
##
## [1] "horizon: 3 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 5246 2623 19.01 5.31e-06 ***
## Residuals 29 4002 138
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 15.39491 2.153184 28.636629 0.0200646
## NP-AG -17.24724 -29.090998 -5.403484 0.0032894
## NP-EA -32.64215 -45.883870 -19.400425 0.0000037
##
## [1] "horizon: 3 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 219.8 109.91 7.733 0.00203 **
## Residuals 29 412.2 14.21
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 5.7125 1.462752 9.962248 0.0066880
## NP-AG -0.6175 -4.418590 3.183590 0.9153566
## NP-EA -6.3300 -10.579748 -2.080252 0.0026545
##
## [1] "horizon: 4 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2595 1297.5 34.27 2.3e-08 ***
## Residuals 29 1098 37.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 1.686342 -5.249866 8.62255 0.8209832
## NP-AG 19.226607 13.022674 25.43054 0.0000001
## NP-EA 17.540266 10.604058 24.47647 0.0000024
##
## [1] "horizon: 4 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 348 174.2 0.757 0.478
## Residuals 29 6673 230.1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -8.397966 -25.49752 8.701585 0.4552859
## NP-AG -4.500802 -19.79511 10.793501 0.7497695
## NP-EA 3.897164 -13.20239 20.996714 0.8407164
##
## [1] "horizon: 4 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 1679 839.7 3.152 0.0577 .
## Residuals 29 7727 266.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 10.479941 -7.920025 28.8799066 0.3507592
## NP-AG -8.202835 -24.660265 8.2545942 0.4449924
## NP-EA -18.682776 -37.082742 -0.2828106 0.0460211
##
## [1] "horizon: 4 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 84.6 42.31 3.618 0.0396 *
## Residuals 29 339.2 11.70
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 3.53125 -0.3238005 7.38630047 0.0775688
## NP-AG -0.40500 -3.8530620 3.04306196 0.9547470
## NP-EA -3.93625 -7.7913005 -0.08119953 0.0446205
##
## [1] "horizon: 5 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 829.9 415.0 20.38 2.97e-06 ***
## Residuals 29 590.6 20.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 2.458852 -2.628270 7.545974 0.4663475
## NP-AG 11.317272 6.767211 15.867332 0.0000032
## NP-EA 8.858420 3.771298 13.945541 0.0005024
##
## [1] "horizon: 5 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 709 354.3 1.27 0.296
## Residuals 29 8092 279.0
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -9.717918 -28.547894 9.112057 0.4205451
## NP-AG 1.947681 -14.894361 18.789723 0.9561002
## NP-EA 11.665599 -7.164376 30.495575 0.2920624
##
## [1] "horizon: 5 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 1228 614.1 2.375 0.111
## Residuals 29 7499 258.6
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 11.894953 -6.23213 30.022037 0.2532799
## NP-AG -3.797416 -20.01077 12.415940 0.8326308
## NP-EA -15.692369 -33.81945 2.434714 0.0996956
##
## [1] "horizon: 5 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 472.7 236.35 10.59 0.000352 ***
## Residuals 29 647.3 22.32
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 8.90916667 3.583777 14.234556 0.0007942
## NP-AG 0.06666667 -4.696507 4.829840 0.9993415
## NP-EA -8.84250000 -14.167889 -3.517111 0.0008633
##
## [1] "horizon: 6 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 250.2 125.09 2.332 0.115
## Residuals 29 1555.8 53.65
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -4.339840 -12.596259 3.916578 0.4076048
## NP-AG 2.879720 -4.505045 10.264486 0.6055966
## NP-EA 7.219561 -1.036858 15.475979 0.0955130
##
## [1] "horizon: 6 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 3474 1736.8 6.191 0.00577 **
## Residuals 29 8135 280.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -26.792994 -45.6727712 -7.913217 0.0041700
## NP-AG -8.790734 -25.6773197 8.095852 0.4144368
## NP-EA 18.002260 -0.8775165 36.882037 0.0639460
##
## [1] "horizon: 6 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 8629 4315 12.3 0.000136 ***
## Residuals 29 10176 351
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 41.463829 20.347735 62.57992 0.0001114
## NP-AG 9.495237 -9.391571 28.38205 0.4389583
## NP-EA -31.968592 -53.084686 -10.85250 0.0022653
##
## [1] "horizon: 6 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 127.2 63.6 3.832 0.0334 *
## Residuals 29 481.3 16.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 5.107083 0.5148253 9.699341 0.0268585
## NP-AG 2.560833 -1.5466072 6.668274 0.2877193
## NP-EA -2.546250 -7.1385081 2.046008 0.3697701
##
## [1] "horizon: 7 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2051 1025.3 2.175 0.156
## Residuals 12 5657 471.4
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -21.886480 -57.35695 13.58399 0.2650341
## NP-AG -25.245852 -64.45994 13.96823 0.2388053
## NP-EA -3.359372 -47.59882 40.88008 0.9776705
##
## [1] "horizon: 7 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2994 1496.8 9.963 0.00282 **
## Residuals 12 1803 150.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -27.442525 -47.46727 -7.417785 0.0085407
## NP-AG -29.409482 -51.54767 -7.271299 0.0104375
## NP-EA -1.966957 -26.94220 23.008283 0.9760051
##
## [1] "horizon: 7 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 9303 4651 40.89 4.39e-06 ***
## Residuals 12 1365 114
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 55.75393 38.32857 73.179293 0.0000054
## NP-AG 39.13602 19.87156 58.400479 0.0004210
## NP-EA -16.61791 -38.35116 5.115329 0.1449902
##
## [1] "horizon: 7 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 565.9 282.94 136.7 5.52e-09 ***
## Residuals 12 24.8 2.07
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_20_anova, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 13.89375 11.543461 16.244039 0.0000000
## NP-AG 9.24625 6.647908 11.844592 0.0000017
## NP-EA -4.64750 -7.578825 -1.716175 0.0030957
## `summarise()` regrouping output by 'horizon', 'location' (override with `.groups` argument)
## `summarise()` regrouping output by 'horizon', 'Treatment' (override with `.groups` argument)
#5 (loc) ANOVA and TukeyHSD test for all the combinations for 5-minutes methods
aggregate_mean_5_loc <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - location, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
return (subset_data_1)}
#ANOVA and TukeyHSD test for all the combinations for 5-minutes methods
method_5_anova_loc <- aggregate_mean_5_loc(c("location", "horizon","5wsa2000",
"5wsa250", "5wsa53", "5wsa20"),
c("5wsa2000", "5wsa250", "5wsa53", "5wsa20"),
c("8mm-2mm","2mm-250um","250um-53um", "53-20um"))
for (j in 1:4){
for (i in c("8mm-2mm","2mm-250um","250um-53um", "53-20um")){
anova_one_way <- aov(value~location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
print(paste("horizon:", j, " aggregate size: ", i))
print(summary(anova_one_way))
print(TukeyHSD(anova_one_way))}}
## [1] "horizon: 1 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 3497 1748.5 19.53 7.79e-06 ***
## Residuals 25 2238 89.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -20.837308 -32.62029 -9.054325 0.0004951
## Tribune 1-Hays -26.440519 -37.19686 -15.684177 0.0000062
## Tribune 1-Konza -5.603211 -16.35955 5.153132 0.4096972
##
## [1] "horizon: 1 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 985.1 492.6 4.684 0.0187 *
## Residuals 25 2629.3 105.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 6.573199 -6.198902 19.345299 0.4182060
## Tribune 1-Hays -7.597493 -19.256772 4.061786 0.2547961
## Tribune 1-Konza -14.170691 -25.829970 -2.511413 0.0150725
##
## [1] "horizon: 1 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 255 127.7 0.435 0.652
## Residuals 25 7334 293.4
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 3.496508 -17.83510 24.82812 0.9125334
## Tribune 1-Hays 7.235451 -12.23755 26.70846 0.6295862
## Tribune 1-Konza 3.738943 -15.73406 23.21195 0.8821366
##
## [1] "horizon: 1 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 429.1 214.57 6.859 0.00422 **
## Residuals 25 782.1 31.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -10.010523 -16.976428 -3.0446182 0.0039867
## Tribune 1-Hays -7.036667 -13.395639 -0.6776947 0.0280183
## Tribune 1-Konza 2.973856 -3.385116 9.3328283 0.4845412
##
## [1] "horizon: 2 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 2563 1281.5 7.42 0.00295 **
## Residuals 25 4318 172.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -13.263304 -29.63034 3.103734 0.1285425
## Tribune 1-Hays -23.098066 -38.03906 -8.157073 0.0020268
## Tribune 1-Konza -9.834762 -24.77576 5.106231 0.2481883
##
## [1] "horizon: 2 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 2136 1068 9.541 0.000834 ***
## Residuals 25 2799 112
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 4.97768 -8.199663 18.155023 0.6200864
## Tribune 1-Hays -14.74685 -26.776068 -2.717641 0.0141770
## Tribune 1-Konza -19.72453 -31.753748 -7.695322 0.0011227
##
## [1] "horizon: 2 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 1377 688.3 2.557 0.0976 .
## Residuals 25 6730 269.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -11.685566 -32.11933 8.748202 0.3439830
## Tribune 1-Hays 5.162007 -13.49139 23.815400 0.7718435
## Tribune 1-Konza 16.847573 -1.80582 35.500966 0.0822182
##
## [1] "horizon: 2 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 275.89 137.95 49.99 1.84e-09 ***
## Residuals 25 68.99 2.76
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.301250 -10.370119 -6.232381 0.00e+00
## Tribune 1-Hays -3.959167 -5.847777 -2.070556 6.07e-05
## Tribune 1-Konza 4.342083 2.453473 6.230694 1.68e-05
##
## [1] "horizon: 3 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 1058 528.9 3.307 0.0532 .
## Residuals 25 3998 159.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.482561 -24.23238 7.2672585 0.3862080
## Tribune 1-Hays -14.837296 -29.21485 -0.4597443 0.0421606
## Tribune 1-Konza -6.354736 -20.73229 8.0228165 0.5223906
##
## [1] "horizon: 3 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 2520 1260.1 7.418 0.00296 **
## Residuals 25 4247 169.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 6.410293 -9.821489 22.6420753 0.5937212
## Tribune 1-Hays -15.330141 -30.147662 -0.5126187 0.0415705
## Tribune 1-Konza -21.740434 -36.557956 -6.9229120 0.0033099
##
## [1] "horizon: 3 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 1268 634.2 3.255 0.0554 .
## Residuals 25 4872 194.9
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -11.426191 -28.8117014 5.959319 0.2491947
## Tribune 1-Hays 4.718618 -11.1521085 20.589345 0.7419968
## Tribune 1-Konza 16.144810 0.2740826 32.015536 0.0456171
##
## [1] "horizon: 3 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 237.28 118.64 69.03 6.6e-11 ***
## Residuals 25 42.96 1.72
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -7.657500 -9.290168 -6.024832 0.00e+00
## Tribune 1-Hays -4.459583 -5.949998 -2.969168 2.00e-07
## Tribune 1-Konza 3.197917 1.707502 4.688332 4.43e-05
##
## [1] "horizon: 4 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 847 423.6 3.321 0.0526 .
## Residuals 25 3188 127.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 9.068068 -4.996731 23.1328674 0.2618106
## Tribune 1-Hays -4.159653 -16.998999 8.6796936 0.7022484
## Tribune 1-Konza -13.227721 -26.067067 -0.3883746 0.0425540
##
## [1] "horizon: 4 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 520.8 260.38 3.012 0.0673 .
## Residuals 25 2161.0 86.44
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays 3.05121 -8.527848 14.6302674 0.7905186
## Tribune 1-Hays -6.87156 -17.441745 3.6986248 0.2563495
## Tribune 1-Konza -9.92277 -20.492955 0.6474149 0.0687285
##
## [1] "horizon: 4 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 2385 1192.4 9.961 0.000659 ***
## Residuals 25 2993 119.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -24.41496 -38.04140000 -10.7885205 0.0004266
## Tribune 1-Hays -11.96074 -24.39992127 0.4784402 0.0611397
## Tribune 1-Konza 12.45422 0.01503898 24.8934004 0.0496813
##
## [1] "horizon: 4 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 353.0 176.48 173 2.27e-15 ***
## Residuals 25 25.5 1.02
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ location, data = filter(method_5_anova_loc, horizon == j & aggregate_size == i))
##
## $location
## diff lwr upr p adj
## Konza-Hays -8.523750 -9.78156876 -7.265931 0.0000000
## Tribune 1-Hays -7.277083 -8.42530951 -6.128857 0.0000000
## Tribune 1-Konza 1.246667 0.09844049 2.394893 0.0314521
#5 (trt) ANOVA and TukeyHSD test for all the combinations for 20-minutes methods
aggregate_mean_5_trt <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - Treatment, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
return (subset_data_1)}
#ANOVA and TukeyHSD test for all the combinations for 5-minutes methods
method_5_anova_trt <- aggregate_mean_5_trt(c("Treatment", "horizon","5wsa2000",
"5wsa250", "5wsa53", "5wsa20"),
c("5wsa2000", "5wsa250", "5wsa53", "5wsa20"),
c("8mm-2mm","2mm-250um","250um-53um", "53-20um"))
for (j in 1:4){
for (i in c("8mm-2mm","2mm-250um","250um-53um", "53-20um")){
anova_one_way <- aov(value~Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
print(paste("horizon:", j, " aggregate size: ", i))
print(summary(anova_one_way))
print(TukeyHSD(anova_one_way))}}
## [1] "horizon: 1 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2193 1096.6 7.741 0.00242 **
## Residuals 25 3542 141.7
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 13.30569 -1.517590 28.12896 0.0845261
## NP-AG 21.36910 7.837358 34.90083 0.0016451
## NP-EA 8.06341 -5.468327 21.59515 0.3153047
##
## [1] "horizon: 1 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 1173 586.6 6.007 0.00741 **
## Residuals 25 2441 97.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 8.816303 -3.490631 21.12324 0.1953121
## NP-AG 15.621890 4.387248 26.85653 0.0053032
## NP-EA 6.805587 -4.429055 18.04023 0.3039559
##
## [1] "horizon: 1 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 5599 2799.6 35.16 5.42e-08 ***
## Residuals 25 1990 79.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -14.56436 -25.67689 -3.451826 0.0085936
## NP-AG -33.60375 -43.74806 -23.459441 0.0000000
## NP-EA -19.03939 -29.18370 -8.895083 0.0002474
##
## [1] "horizon: 1 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 184.1 92.05 2.24 0.127
## Residuals 25 1027.1 41.09
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 5.4900000 -2.492887 13.472887 0.2202123
## NP-AG -0.2990987 -7.586444 6.988246 0.9942558
## NP-EA -5.7890987 -13.076444 1.498246 0.1383580
##
## [1] "horizon: 2 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 3048 1524.2 9.944 0.000665 ***
## Residuals 25 3832 153.3
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 1.462911 -13.956415 16.88224 0.9697201
## NP-AG 21.786625 7.710771 35.86248 0.0020034
## NP-EA 20.323714 6.247860 34.39957 0.0038232
##
## [1] "horizon: 2 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 851 425.3 2.603 0.094 .
## Residuals 25 4084 163.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -0.9942103 -16.91295 14.92453 0.9867538
## NP-AG 10.6140179 -3.91774 25.14578 0.1839199
## NP-EA 11.6082282 -2.92353 26.13999 0.1355850
##
## [1] "horizon: 2 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 5546 2773.0 27.07 5.54e-07 ***
## Residuals 25 2561 102.4
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 8.836456 -3.767556 21.44047 0.2083212
## NP-AG -23.208687 -34.714522 -11.70285 0.0001007
## NP-EA -32.045143 -43.550978 -20.53931 0.0000008
##
## [1] "horizon: 2 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 88.92 44.46 4.342 0.0241 *
## Residuals 25 255.97 10.24
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 4.1112500 0.1261753 8.0963247 0.0422320
## NP-AG 0.2929167 -3.3449421 3.9307755 0.9780887
## NP-EA -3.8183333 -7.4561921 -0.1804745 0.0383294
##
## [1] "horizon: 3 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 3018 1508.9 18.51 1.17e-05 ***
## Residuals 25 2038 81.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 1.592593 -9.652576 12.83776 0.9338855
## NP-AG 21.739133 11.473745 32.00452 0.0000530
## NP-EA 20.146540 9.881152 30.41193 0.0001429
##
## [1] "horizon: 3 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 512 256.1 1.023 0.374
## Residuals 25 6255 250.2
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 2.946630 -16.75254 22.645797 0.9265598
## NP-AG -6.870316 -24.85311 11.112481 0.6134740
## NP-EA -9.816946 -27.79974 8.165852 0.3766800
##
## [1] "horizon: 3 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2225 1112.7 7.106 0.0036 **
## Residuals 25 3915 156.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 1.769878 -13.81479 17.354543 0.9569254
## NP-AG -17.079298 -31.30609 -2.852510 0.0164322
## NP-EA -18.849176 -33.07596 -4.622388 0.0078885
##
## [1] "horizon: 3 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 71.76 35.88 4.303 0.0248 *
## Residuals 25 208.48 8.34
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 3.9575000 0.3610273 7.5539727 0.0290002
## NP-AG 0.8258333 -2.4572820 4.1089487 0.8070349
## NP-EA -3.1316667 -6.4147820 0.1514487 0.0636064
##
## [1] "horizon: 4 aggregate size: 8mm-2mm"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 2422 1210.9 18.76 1.06e-05 ***
## Residuals 25 1614 64.6
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 0.5042713 -9.502054 10.51060 0.9913538
## NP-AG 19.0411966 9.906713 28.17568 0.0000655
## NP-EA 18.5369254 9.402442 27.67141 0.0000932
##
## [1] "horizon: 4 aggregate size: 2mm-250um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 827.9 413.9 5.582 0.0099 **
## Residuals 25 1853.9 74.2
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG -9.676279 -20.40103 1.048468 0.0826089
## NP-AG -12.969167 -22.75948 -3.178857 0.0078986
## NP-EA -3.292888 -13.08320 6.497422 0.6835137
##
## [1] "horizon: 4 aggregate size: 250um-53um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 1050 524.9 3.032 0.0662 .
## Residuals 25 4328 173.1
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 10.272730 -6.113579 26.6590388 0.2805683
## NP-AG -4.430402 -19.388987 10.5281825 0.7436685
## NP-EA -14.703132 -29.661717 0.2554525 0.0547009
##
## [1] "horizon: 4 aggregate size: 53-20um"
## Df Sum Sq Mean Sq F value Pr(>F)
## Treatment 2 71.03 35.51 2.888 0.0744 .
## Residuals 25 307.43 12.30
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 4 observations deleted due to missingness
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = value ~ Treatment, data = filter(method_5_anova_trt, horizon == j & aggregate_size == i))
##
## $Treatment
## diff lwr upr p adj
## EA-AG 4.2125 -0.1548464 8.579846 0.0601956
## NP-AG 2.1900 -1.7968235 6.176824 0.3723002
## NP-EA -2.0225 -6.0093235 1.964324 0.4283011
#MWD 20 & 5 by location
mean_se_fx_mwd_loc <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - location, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
se <- function(x, na.rm=TRUE) {
if (na.rm) x <- na.omit(x)
sqrt(var(x)/length(x))
}
subset_data_2 <- subset_data_1 %>% group_by(horizon, location, aggregate_size) %>%
summarize(mean_data = mean(value, na.rm = TRUE),
standard_error = se(value))
#Reposition location labels
subset_data_2$location <- factor(subset_data_2$location, levels = c("Tribune 1", "Hays", "Konza", "Ottawa"))
return(subset_data_2)
}
#the color palette for the locations
colsloc <- c( "Tribune 1" = "red", "Hays" = "yellow", "Konza" = "green", "Ottawa" = "deepskyblue")
method_mwd_loc <- mean_se_fx_mwd_loc(c("location", "horizon","20mwd", "5mwd"),
c("20mwd", "5mwd"),
c("20", "5"))
## `summarise()` regrouping output by 'horizon', 'location' (override with `.groups` argument)
ggplot(data=method_mwd_loc, aes(x=aggregate_size, y=mean_data, fill = location)) +
geom_bar(position=position_dodge(), stat="identity", colour = "black") +
geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
width=.2, # Width of the error bars
position=position_dodge(.9)) + ylab("Mean value") +
scale_y_continuous(limits=c(0,3)) + facet_wrap(~horizon, scales='free') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position="top",
panel.border = element_rect(colour = "black", fill=NA, size=0.5),
strip.background=element_rect(size=0.5, colour = "black"),
axis.text.x=element_text(colour="black")) + xlab("Method") +
ylab("Mean Weight Diameter (mm)") + scale_fill_manual(values = colsloc)
## Warning: Removed 16 rows containing missing values (geom_bar).
#MWD 20 & 5 by treatment
mean_se_fx_mwd_trt <- function(select_variable, aggregate_size, aggregate_size_conversion){
subset_data <- agg[, select_variable]
subset_data_1 <- gather(subset_data, aggregate_size , value, - Treatment, - horizon)
subset_data_1$aggregate_size <- factor(subset_data_1$aggregate_size,
levels = aggregate_size)
subset_data_1$aggregate_size <- plyr::mapvalues(subset_data_1$aggregate_size,
from=aggregate_size,
to=aggregate_size_conversion)
se <- function(x, na.rm=TRUE) {
if (na.rm) x <- na.omit(x)
sqrt(var(x)/length(x))
}
subset_data_2 <- subset_data_1 %>% group_by(horizon, Treatment, aggregate_size) %>%
summarize(mean_data = mean(value, na.rm = TRUE),
standard_error = se(value))
return(subset_data_2)
}
#the color palette for the Treatments
colstrt <- c( "AG" = "red", "EA" = "deepskyblue", "NP" = "green")
method_mwd_trt <- mean_se_fx_mwd_trt(c("Treatment", "horizon","20mwd", "5mwd"),
c("20mwd", "5mwd"),
c("20", "5"))
## `summarise()` regrouping output by 'horizon', 'Treatment' (override with `.groups` argument)
ggplot(data=method_mwd_trt, aes(x=aggregate_size, y=mean_data, fill = Treatment)) +
geom_bar(position=position_dodge(), stat="identity", colour = "black") +
geom_errorbar(aes(ymin=mean_data-standard_error, ymax=mean_data+standard_error),
width=.2, # Width of the error bars
position=position_dodge(.9)) + ylab("Mean value") +
scale_y_continuous(limits=c(0,3)) + facet_wrap(~horizon, scales='free') +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"),
legend.position="top",
panel.border = element_rect(colour = "black", fill=NA, size=0.5),
strip.background=element_rect(size=0.5, colour = "black"),
axis.text.x=element_text(colour="black")) + xlab("Method") +
ylab("Mean Weight Diameter (mm)") + scale_fill_manual(values = colstrt)
## Warning: Removed 9 rows containing missing values (geom_bar).
#NRCS graphs by location
## `summarise()` regrouping output by 'horizon', 'location' (override with `.groups` argument)
#NRCS graphs by treatment
## `summarise()` regrouping output by 'horizon', 'Treatment' (override with `.groups` argument)
#Density plots to see normal distribution #Pearson Correlation and Coefficient of Determination
library(tidyverse)
library(readxl)
soil <- read_excel("aggdataset.xlsx")
library(janitor)
##
## Attaching package: 'janitor'
## The following objects are masked from 'package:stats':
##
## chisq.test, fisher.test
soil <- soil %>%
clean_names()
#density plot of the aggregates (test for normal distribution)
ggplot(soil, aes(x20mwd))+
geom_density()
## Warning: Removed 1 rows containing non-finite values (stat_density).
ggplot(soil, aes(x5mwd))+
geom_density()
## Warning: Removed 96 rows containing non-finite values (stat_density).
ggplot(soil, aes(nrc_sagg))+
geom_density()
## Warning: Removed 6 rows containing non-finite values (stat_density).
#Run a pearson correlation test on 20 minute mean weight diameter and NRCS % agg
cor.test(soil$x20mwd, soil$nrc_sagg)
##
## Pearson's product-moment correlation
##
## data: soil$x20mwd and soil$nrc_sagg
## t = 18.339, df = 200, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.7340919 0.8382981
## sample estimates:
## cor
## 0.791891
#coefficient of determination (r^2)
tline<-lm(soil$nrc_sagg ~ soil$x20mwd)
summary(tline)$r.squared
## [1] 0.6270914
#Run a pearson correlation test on 5 minute mean weight diameter and NRCS % agg
cor.test(soil$x5mwd, soil$nrc_sagg)
##
## Pearson's product-moment correlation
##
## data: soil$x5mwd and soil$nrc_sagg
## t = 12.56, df = 107, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.6829747 0.8382936
## sample estimates:
## cor
## 0.7719101
#coefficient of determination (r^2)
tline<-lm(soil$nrc_sagg ~ soil$x5mwd)
summary(tline)$r.squared
## [1] 0.5958453
#Run a pearson correlation test on 20 minute mean weight diameter and 5 minute mean weight diameter
cor.test(soil$x20mwd, soil$x5mwd)
##
## Pearson's product-moment correlation
##
## data: soil$x20mwd and soil$x5mwd
## t = 11.953, df = 110, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.6578642 0.8225009
## sample estimates:
## cor
## 0.751664
#coefficient of determination (r^2)
tline<-lm(soil$x5mwd ~ soil$x20mwd)
summary(tline)$r.squared
## [1] 0.5649987
library(ggplot2)
library(readxl)
install.packages("janitor")
## Installing package into '/home/rstudio-user/R/x86_64-pc-linux-gnu-library/4.0'
## (as 'lib' is unspecified)
library(janitor)
soil <- read_excel("aggdataset.xlsx")
soil <- soil %>%
clean_names()
#20 minute Mean Weight Diameter vs NRCS Hand Method
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg))+
geom_point(size=.5)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#One graph by location
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg, color=location, shape=location))+
geom_point(size=1)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#group by location
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg))+
facet_wrap(~location)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#one graph group by treatment
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg, color=treatment, shape=treatment))+
geom_point(size=1)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#group by treatment
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg))+
facet_wrap(~treatment)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#group by horizon
soil %>%
ggplot(aes(x=x20mwd, y= nrc_sagg))+
facet_wrap(~horizon)+
labs(x="20 minute method",
y="NRCS hand method",
title="Correlation between 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 6 rows containing non-finite values (stat_smooth).
## Warning: Removed 6 rows containing missing values (geom_point).
#remove Ottawa dataset since 5MWD isnt available
soil <- soil %>%
filter(location!="Ottawa") %>%
filter(horizon!= c("5", "6", "7"))
#20 minute Mean Weight Diameter vs 5 minute Method
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
geom_point(size=.5)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#One graph by location
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=location, shape=location))+
geom_point(size=1)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#group by location
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
facet_wrap(~location)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#one graph group by treatment
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd, color=treatment, shape=treatment))+
geom_point(size=1)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#group by treatment
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
facet_wrap(~treatment)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#group by horizon
soil %>%
ggplot(aes(x=x20mwd, y= x5mwd))+
facet_wrap(~horizon)+
labs(x="20 minute method",
y="5 minute method",
title="Correlation between 20 minute Mean Weight Diameter vs 5 minute MWD") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 48 rows containing non-finite values (stat_smooth).
## Warning: Removed 48 rows containing missing values (geom_point).
#5 minute Mean Weight Diameter vs NRCS Hand Method
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg))+
geom_point(size=.5)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#One graph by location
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg, color=location, shape=location))+
geom_point(size=1)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#group by location
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg))+
facet_wrap(~location)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#one graph group by treatment
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg, color=treatment, shape=treatment))+
geom_point(size=1)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#group by treatment
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg))+
facet_wrap(~treatment)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#group by horizon
soil %>%
ggplot(aes(x=x5mwd, y= nrc_sagg))+
facet_wrap(~horizon)+
labs(x="5 minute method",
y="NRCS hand method",
title="Correlation between 5 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()+
geom_smooth(method="lm", se=FALSE, color= "black") +
geom_point(size=.5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing missing values (geom_point).
#Bland-Altman plots
library(BlandAltmanLeh)
nrcs <-as.numeric(soil$nrc_sagg, na.rm=FALSE)
n20mwd <- as.numeric(soil$x20mwd, na.rm=FALSE)
n5mwd <- as.numeric(soil$x5mwd, na.rm=FALSE)
#Bland-Altman Plots for 20 minute Mean Weight Diameter vs NRCS Hand Method
soil %>%
ggplot(aes(x=((x20mwd+nrc_sagg)/2), y= (x20mwd-nrc_sagg)))+
geom_point(size=.5)+
labs(x="20 minute method",
y="NRCS hand method",
title="Bland-Altman Plots for 20 minute Mean Weight Diameter vs NRCS Hand Method") +
theme_classic()
## Warning: Removed 4 rows containing missing values (geom_point).
bland.altman.plot(n20mwd, nrcs, xlab="Means", ylab="Differences", na.rm=FALSE)
## Warning in plot.window(...): "na.rm" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "na.rm" is not a graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "na.rm" is not a
## graphical parameter
## Warning in axis(side = side, at = at, labels = labels, ...): "na.rm" is not a
## graphical parameter
## Warning in box(...): "na.rm" is not a graphical parameter
## Warning in title(...): "na.rm" is not a graphical parameter
## NULL
#Bland-Altman Plots for 20 minute Mean Weight Diameter vs 5 minute Method
soil %>%
ggplot(aes(x=((x20mwd+x5mwd)/2), y= (x20mwd-x5mwd)))+
geom_point(size=.5)+
labs(x="Means",
y="Differences",
title="Bland-Altman Plots for 20 minute Mean Weight Diameter vs 5 minute Method") +
theme_classic()
## Warning: Removed 48 rows containing missing values (geom_point).
bland.altman.plot(n20mwd, n5mwd, xlab="Means", ylab="Differences")
## NULL
library(corrplot)
cordatapoints <- soil %>% dplyr::select(-sample_name, -location, -treatment, -startd, -endd, -horizon, -depth, -replication, -x20wsa2000, -x20wsa250, -x20wsa53, -x20wsa20, -x5wsa2000, -x5wsa250, -x5wsa53, -x5wsa20)
cless<-na.omit(cordatapoints) cless cless1 <- cor(cless, method = “pearson”) cless1 colnames(cless1) <- c(“20 minute”, “5 minute”, “NRCS”) rownames(cless1) <- c(“20 minute”, “5 minute”, “NRCS”)
corrplot(cless1, method = “square”, tl.col = “black”, type = “lower”, tl.srt = 45, tl.cex = 0.7)
library(corrr) network_plot(cless1, min_cor=0.2, colors = c(“red”, “green”))
library(ggcorrplot) ggcorrplot(cless1, p.mat = cor_pmat(c1), hc.order=TRUE, type=‘lower’, colors = c(“red”, “green”, “blue”)) library(PerformanceAnalytics) chart.Correlation(cless1, histogram=TRUE)
```