Peeper Analysis!

NOTES ABOUT DATASETS

So in summary:

DATA = all 30 calls for all males, full set of data (1886 observations)

Tdat = the temperature corrected, all 30 calls (1886 observations)

means = the temperature corrected means for each male (62 observations)

PCA = the means for the variables of interest, one for each male with the ID as the row name (not an actual variable), prepped for input into PCA observations (62 observations)

full.data = means + PC scores for each individual (62 observations)

asprcomp = results of the PCA, run with the 62 observations with the individuals

Packages Used

# for importing Raven selection files
library(Rraven)
# for graphs
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)
library(ggplot2)
library(RColorBrewer)
# for importing files
library(readr)
library(readxl)
# for linear regressions
library (lme4)
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## 
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
library(car)
## Loading required package: carData
## 
## Attaching package: 'car'
## 
## The following object is masked from 'package:dplyr':
## 
##     recode
## 
## The following object is masked from 'package:purrr':
## 
##     some
# for PCA
library (vegan)
## Loading required package: permute
## Loading required package: lattice
## This is vegan 2.6-6.1
library('factoextra')
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
# function for calculating coefficient of variation
cv <- function(x) (sd(x)/mean(x))

# function that gets mode of a character value (e.g. which word is most common)
mode_char <- function(x) unique(x)[which.max(tabulate(match(x, unique(x))))]

Data Import (taken from ‘manual data’ in 071424 file)

DATA <- read_csv("~/Desktop/UTK/Tanner Lab/Analysis/Call Analysis/Peeper Analysis/080724_data.csv")
## Rows: 1886 Columns: 32
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (11): Begin File, ID, Date.x, selec.file, Location.x, Date.y, Location.y...
## dbl (21): Begin Time (s), End Time (s), Delta Time (s), Peak Freq (Hz), Freq...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
DATA <- as.data.frame(DATA)

Temperature Correction

Function

# Remember - if you change the name of the column for body temperature, you will need to edit the name within m & the Tcorrected_matrix to accurately reflect the new column name 

Tcorr <- function(col_numbers, target_temp, data){
  num_cols <- length(col_numbers)
  Tcorrected_matrix <- matrix(NA, nrow = nrow(data), ncol = num_cols)
  
  for(i in seq_along(col_numbers)){
    m <- lm(data[,col_numbers[i]] ~ data$`Body Temp`, data)$coefficients[2] # Calculate m by doing a linear regression 
    Tcorrected_matrix[, i] <- data[,col_numbers[i]] - m * (data$`Body Temp` - target_temp) # Save a vector so I can use it outside the function 
  }
  
  avg <- apply(Tcorrected_matrix, 1, mean)
  stdev <- apply(Tcorrected_matrix, 1, sd)
  colnames(Tcorrected_matrix) <- colnames(data[, col_numbers])
  
  result <- list(avg = avg, stdev = stdev, Tcorrected_matrix = Tcorrected_matrix)

  return(result)
}
# Set Values that you want to temperature correct for
#   3 = Delta Time
#   4 = Peak Freq
#   5 = Freq 5%
#   6 = Freq 95%
#   7 = BW 90%
#   13 = ICI
#   14 = Call Period
#   15 = Call Duration
selections <- c(3:7,13:15)

# Do the temperature correction to the target temp, aka 16
result <- Tcorr(selections, target_temp = 16, data = DATA)

# Format results as a dataframe
Tdat <- as.data.frame(result$Tcorrected_matrix)

# Add information such as ID, Location, and Prevalence
Tdat<-cbind(DATA[,c(9,10,12,18,31,32)], Tdat)
#   9 = ID
#   10 = Date
#   12 = Location
#   18 = Body Temp
#   31 = Log Infection
#   32 = Prevalence

# write.csv(Tdat,"080724_temp_corrected_data.csv",row.names=FALSE)
# summarize means of these parameters by ID
means <- Tdat %>% 
  group_by(ID, Location.x, Prevalence) %>%
  summarize(Temp = mean(`Body Temp`),
            Infection = mean(`Log Infection`),
            Call_Rate_Inst = mean(Call_Rate_Inst),
            Duration = mean(`Delta Time (s)`),
            ICI = mean(ICI),
            Period = mean(Call_Period),
            Freq = mean(`Peak Freq (Hz)`),
            Freq_5 = mean(`Freq 5% (Hz)`),
            Freq_95 = mean(`Freq 95% (Hz)`),
            BW = mean(`BW 90% (Hz)`))
## `summarise()` has grouped output by 'ID', 'Location.x'. You can override using
## the `.groups` argument.
means <- ungroup(means)

PCA <- means %>% select(c('Call_Rate_Inst','Infection','Duration','ICI','Period','Freq','Freq_5','Freq_95','BW'))
PCA <- as.data.frame(PCA)
rownames(PCA) <- c(means$ID)
PCA
##           Call_Rate_Inst  Infection   Duration       ICI    Period     Freq
## PC-002-24       99.11856 0.00000000 0.11485620 0.4159175 0.5307737 2778.958
## PC-003-24       93.27851 0.00000000 0.11506323 0.4954567 0.6105199 2969.136
## PC-004-24       93.28097 1.01122566 0.07274760 0.5273652 0.6001128 3052.633
## PC-005-24      112.66131 1.24781154 0.09526409 0.3624980 0.4577621 2802.506
## PC-006-24       93.53094 2.10746436 0.10938044 0.4937315 0.6031119 2760.573
## PC-007-24      112.08975 0.00000000 0.08554868 0.3346721 0.4202208 2735.998
## PC-009-24       90.66519 0.00000000 0.08300632 0.7486980 0.8317043 3057.170
## PC-011-24       93.26021 0.00000000 0.07013678 0.5522091 0.6223459 3034.462
## PC-012-24       93.41914 1.99295030 0.11428524 0.5327199 0.6470051 2966.110
## PC-013-24       94.00108 0.78808518 0.12498101 0.4790933 0.6040744 3082.112
## PC-014-24       88.30542 0.22572425 0.10173368 0.8279341 0.9296678 2912.411
## PC-015-24       55.00993 0.00000000 0.12819319 1.3566720 1.4848652 2614.171
## PC-016-24       94.73642 4.11710418 0.09009415 0.6500828 0.7401769 3038.563
## PC-017-24       77.02704 3.14097979 0.11593405 0.6724329 0.7883669 2929.886
## PC-018-24       72.19191 1.64377324 0.11761463 0.8192702 0.9368848 2837.987
## PC-021-24       97.48803 2.09900278 0.08546817 0.6895268 0.7749950 2986.434
## PC-022-24      107.53626 0.00000000 0.10543627 0.5483155 0.6537518 2943.238
## PC-023-24       96.84656 2.91679893 0.08572996 0.6141163 0.6998462 2897.986
## PC-024-24      129.20232 1.56406237 0.06801613 0.4757993 0.5438154 2740.867
## PC-026-24       85.95546 2.56548205 0.14788470 0.7300732 0.8779579 3042.602
## PC-027-24       91.34324 1.30448816 0.08119786 0.6397035 0.7209013 3070.970
## PC-028-24       81.38372 0.03422405 0.09033929 1.5946675 1.6850068 2978.965
## PC-029-24       81.02449 2.77414302 0.08743327 0.7716322 0.8590655 2833.142
## PC-031-24       92.09099 0.91867626 0.11369319 0.5039191 0.6176123 2955.832
## PC-032-24       83.54076 1.58074221 0.11097585 0.6210163 0.7319921 2987.863
## PC-033-24       74.20209 2.15860551 0.08090265 1.0673738 1.1482764 3023.710
## PC-034-24      101.17567 3.30919395 0.06765549 0.4679472 0.5356027 2955.596
## PC-035-24      114.69197 0.00000000 0.10802874 0.5175735 0.6256022 3063.930
## PC-037-24       81.93123 0.00000000 0.10212058 0.6550640 0.7571846 3112.241
## PC-038-24       86.93791 2.07042616 0.05786094 0.7334422 0.7913032 3009.567
## PC-039-24       79.69212 1.45809975 0.07327585 0.7363420 0.8096179 2821.339
## PC-040-24       79.88803 1.99017430 0.11656882 0.9011929 1.0177617 2875.205
## PC-041-24       87.47384 1.88336533 0.11358365 0.6311551 0.7447387 2933.124
## PC-042-24       83.18329 2.67819504 0.08905771 0.6602017 0.7492594 2908.655
## PC-043-24       80.43247 0.66059021 0.10498717 0.7041099 0.8090970 2924.853
## PC-044-24       82.87392 0.98652680 0.13193663 0.7358275 0.8677641 2645.329
## PC-045-24       70.94986 0.00000000 0.10501154 0.8805625 0.9855741 3111.711
## PC-046-24      108.98721 2.39347868 0.10041262 0.4856623 0.5860750 2967.340
## PC-048-24       76.50640 0.00000000 0.13014487 0.7093154 0.8394602 2810.246
## PC-049-24       91.75212 1.25485442 0.08708028 0.6992154 0.7862957 2997.340
## PC-050-24       91.57739 0.51241875 0.09213735 0.6586429 0.7507802 2910.841
## PC-051-24      100.43043 2.60563059 0.09825555 0.6285962 0.7268517 2982.062
## PC-052-24       93.46836 1.64643029 0.09519262 0.5795097 0.6747023 2878.337
## PC-053-24       94.36872 2.93708077 0.13031383 0.5516322 0.6819460 2881.787
## PC-054-24       64.21774 0.00000000 0.12606817 0.8534210 0.9794892 2931.884
## PC-055-24      112.01995 0.00000000 0.08449082 0.5784879 0.6629787 2860.555
## PC-056-24      103.98264 0.00000000 0.08400667 0.4965200 0.5805267 3014.648
## PC-057-24       84.78786 0.34093049 0.10137326 0.7481599 0.8495332 3194.760
## PC-058-24       75.11416 0.58269820 0.12144487 0.8263826 0.9478275 2859.055
## PC-059-24       80.85100 0.00000000 0.09191964 0.9574253 1.0493449 2993.865
## PC-060-24       74.47288 0.00000000 0.11356996 0.7273135 0.8408835 2975.505
## PC-061-24       83.38411 2.93262341 0.07558315 0.7823135 0.8578967 2936.787
## PC-062-24       98.01246 0.40560536 0.08136645 0.7400791 0.8214455 2685.182
## PC-063-24       91.21193 2.54974682 0.09196537 0.6827706 0.7747360 3001.818
## PC-064-24       94.14387 2.27634805 0.07593842 0.7807737 0.8567121 3016.255
## PC-066-24       68.04705 0.33187169 0.12045986 0.8889834 1.0094432 2967.317
## PC-067-24      111.45226 0.73994320 0.07003792 0.4239957 0.4940336 3123.277
## PC-068-24       50.13436 1.25317657 0.06009018 3.3353584 3.3954486 3103.995
## PC-069-24       66.15858 2.15084881 0.08051297 1.2449657 1.3254787 2913.475
## PC-070-24       82.38668 2.02265433 0.10543627 0.7116292 0.8170655 3221.734
## PC-071-24       93.68956 0.00000000 0.06945491 0.5886231 0.6580780 3185.307
## PC-072-24       76.54006 0.00000000 0.10369326 0.8629052 0.9665985 2936.361
##             Freq_5  Freq_95       BW
## PC-002-24 2632.255 2895.673 263.4176
## PC-003-24 2875.154 3223.897 348.7425
## PC-004-24 2979.798 3149.075 169.2784
## PC-005-24 2700.438 2956.253 255.8144
## PC-006-24 2662.413 2909.456 247.0419
## PC-007-24 2631.835 2833.142 201.3069
## PC-009-24 2862.151 3168.604 306.4531
## PC-011-24 2948.822 3178.478 229.6562
## PC-012-24 2813.903 3059.617 245.7132
## PC-013-24 2881.363 3212.358 330.9954
## PC-014-24 2926.179 3080.061 153.8818
## PC-015-24 2529.597 2775.947 246.3504
## PC-016-24 2876.230 3131.672 255.4415
## PC-017-24 2797.029 3099.748 302.7194
## PC-018-24 2728.869 2982.036 253.1667
## PC-021-24 2901.626 3121.966 220.3399
## PC-022-24 2776.465 3028.025 251.5603
## PC-023-24 2806.903 2985.878 178.9755
## PC-024-24 2658.913 2838.133 179.2203
## PC-026-24 2825.668 3132.886 307.2185
## PC-027-24 2933.906 3212.817 278.9115
## PC-028-24 2914.975 3075.811 160.8360
## PC-029-24 2701.044 2971.300 270.2555
## PC-031-24 2874.128 3129.092 254.9636
## PC-032-24 2854.473 3061.277 206.8042
## PC-033-24 2926.088 3202.361 276.2734
## PC-034-24 2801.066 3054.616 253.5494
## PC-035-24 2842.080 3169.342 327.2616
## PC-037-24 2969.458 3211.321 241.8631
## PC-038-24 2896.536 3077.298 180.7626
## PC-039-24 2719.532 2949.305 229.7728
## PC-040-24 2714.933 3025.905 310.9714
## PC-041-24 2802.888 3078.672 275.7839
## PC-042-24 2800.601 2991.506 190.9066
## PC-043-24 2677.424 3001.612 324.1885
## PC-044-24 2548.504 2813.613 265.1076
## PC-045-24 2994.528 3259.838 265.3097
## PC-046-24 2824.573 3053.005 228.4325
## PC-048-24 2730.387 2987.084 256.6964
## PC-049-24 2865.026 3070.000 204.9744
## PC-050-24 2735.709 2999.201 263.4914
## PC-051-24 2859.144 3126.676 267.5319
## PC-052-24 2801.604 3021.423 219.8193
## PC-053-24 2731.974 2992.999 261.0243
## PC-054-24 2769.556 3015.736 246.1795
## PC-055-24 2709.706 2990.988 281.2814
## PC-056-24 2940.000 3241.465 301.4645
## PC-057-24 3107.341 3370.545 263.2039
## PC-058-24 2632.770 2969.857 337.0871
## PC-059-24 2921.047 3151.542 230.4954
## PC-060-24 2806.903 3138.046 331.1429
## PC-061-24 2838.648 3097.450 258.8020
## PC-062-24 2630.903 2807.411 176.5085
## PC-063-24 2915.701 3097.505 181.8039
## PC-064-24 2930.383 3122.544 192.1614
## PC-066-24 2719.089 3068.798 349.7099
## PC-067-24 3023.565 3296.362 272.7963
## PC-068-24 2960.961 3187.374 226.4122
## PC-069-24 2763.136 3007.987 244.8508
## PC-070-24 3143.965 3407.010 263.0446
## PC-071-24 3096.043 3271.382 175.3391
## PC-072-24 2857.557 3123.632 266.0749
PCA.full <- Tdat %>% select(c('Call_Rate_Inst','Log Infection','Delta Time (s)','ICI','Call_Period','Peak Freq (Hz)','Freq 5% (Hz)','Freq 95% (Hz)','BW 90% (Hz)'))
PCA.full <- as.data.frame(PCA.full)

Correlations

cormat <- cor(Tdat[ , c(7:14)])
library(reshape2)
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
melted_cormat <- melt(cormat)

 get_upper_tri <- function(cormat){
    cormat[lower.tri(cormat)]<- NA
    return(cormat)
 }
 
upper_tri <- get_upper_tri(cormat)

upper_cormat <- melt(upper_tri, na.rm = TRUE)

ggplot(data = upper_cormat, aes(Var2, Var1, fill = value))+
 geom_tile(color = "white")+
 scale_fill_gradient2(low = "blue", high = "red", mid = "white", 
   midpoint = 0, limit = c(-1,1), space = "Lab", 
   name="Pearson\nCorrelation") +
  theme_minimal()+ 
 theme(axis.text.x = element_text(angle = 45, vjust = 1, 
    size = 12, hjust = 1))+
 coord_fixed()+
  geom_text(aes(Var2, Var1, label = round(value,4)), color = "black", size = 3)

# results
# SPECTRAL: peak freq is highly correlated with freq 5% and freq 90%
# TEMPORAL: call period and ICI are almost perfectly correlated lol. both also negatively correlated with call rate (makes sense)

PCA Analysis

PCA

asprcomp <- prcomp(PCA, scale = TRUE) # regular R version
asprcomp
## Standard deviations (1, .., p=9):
## [1] 1.748515e+00 1.578360e+00 1.292927e+00 9.750958e-01 7.121061e-01
## [6] 5.193689e-01 2.283972e-01 2.019803e-06 1.302035e-15
## 
## Rotation (n x k) = (9 x 9):
##                        PC1         PC2         PC3         PC4         PC5
## Call_Rate_Inst -0.15973567  0.49951434 -0.20366198  0.14772632 -0.36823043
## Infection      -0.02008910  0.05250001 -0.26056162 -0.96015188 -0.04019168
## Duration       -0.20440912 -0.11233899  0.59581115 -0.15503606  0.55097365
## ICI             0.25188793 -0.54365384 -0.13029641  0.02735263 -0.18605409
## Period          0.24316646 -0.55278904 -0.10103071  0.01969570 -0.15940813
## Freq            0.52117722  0.20391640  0.12365738 -0.06674011  0.01580981
## Freq_5          0.52494274  0.21784487 -0.03482661  0.02165391  0.23540547
## Freq_95         0.51192503  0.21169852  0.21411375 -0.03717850 -0.01467013
## BW             -0.02150816 -0.01092504  0.66791123 -0.15750446 -0.66581608
##                         PC6          PC7           PC8           PC9
## Call_Rate_Inst -0.724182161 -0.040437846 -3.385589e-07  2.646570e-16
## Infection      -0.059034371 -0.044223883 -4.721450e-08 -1.207242e-16
## Duration       -0.511589877 -0.002757092 -1.085023e-07 -3.558077e-02
## ICI            -0.292228721 -0.026797821 -1.396718e-07 -7.088976e-01
## Period         -0.319930032 -0.027107676 -1.460326e-07  7.044134e-01
## Freq           -0.076131975  0.813019676  2.464130e-06  3.252499e-18
## Freq_5         -0.049055481 -0.393241795 -6.803203e-01  4.299564e-12
## Freq_95        -0.003952555 -0.416965529  6.868759e-01 -4.340964e-12
## BW              0.119916417 -0.073811403 -2.556675e-01  1.615747e-12
summary(asprcomp)
## Importance of components:
##                           PC1    PC2    PC3    PC4     PC5     PC6    PC7
## Standard deviation     1.7485 1.5784 1.2929 0.9751 0.71211 0.51937 0.2284
## Proportion of Variance 0.3397 0.2768 0.1857 0.1056 0.05634 0.02997 0.0058
## Cumulative Proportion  0.3397 0.6165 0.8022 0.9079 0.96423 0.99420 1.0000
##                             PC8       PC9
## Standard deviation     2.02e-06 1.302e-15
## Proportion of Variance 0.00e+00 0.000e+00
## Cumulative Proportion  1.00e+00 1.000e+00
# PC1 = Freq (+), Freq_5 (+), Freq_95(+) (33.96%)
# PC2 = Call_Rate Inst (+), ICI (-), Period (-) (62.51%)
# PC3 = Duration (+), BW (+) (79.99%)
# PC4 = Infection (-) (90.64%)
scores = scores(asprcomp)

fviz_pca_var(asprcomp,axes = c(4, 1))

fviz_pca_var(asprcomp,axes = c(4, 2))

fviz_pca_var(asprcomp,axes = c(4, 3))

# from https://rpubs.com/esobolewska/pcr-step-by-step
pcs <- as.data.frame(scores) # same as scores

# binding PC scores with the individual data (summarized for each individual)
full.data <- cbind(means, pcs)

PC1

ggplot(data = full.data, aes(x = Infection, y = PC1))+
  geom_point()+
  theme_classic()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  labs(x = "(Log) Fungal Load",
       y = "PC1 (Spectral Components)",
       title = "Fungal Load x PC1")
## `geom_smooth()` using formula = 'y ~ x'

hist(scores[, 1])

# histogram looks normal, so use a normal regression with location as random variable

# first - regression with numerical variable load
lmodel_PC1_load <- lmer(PC1~Infection+(1|Location.x), full.data)
## boundary (singular) fit: see help('isSingular')
Anova(lmodel_PC1_load)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC1
##            Chisq Df Pr(>Chisq)
## Infection 0.0741  1     0.7854
# second - regression with categorical variable prevalence
lmodel_PC1_prevalence <-lmer(PC1~Prevalence+(1|Location.x), full.data)
## boundary (singular) fit: see help('isSingular')
Anova(lmodel_PC1_prevalence)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC1
##            Chisq Df Pr(>Chisq)
## Prevalence 7e-04  1     0.9783

PC2

ggplot(data = full.data, aes(x = Infection, y = PC2))+
  geom_point()+
  theme_classic()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  labs(x = "(Log) Fungal Load",
       y = "PC2 (Temporal Components)",
       title = "Fungal Load x PC2")
## `geom_smooth()` using formula = 'y ~ x'

hist(scores[, 2])

# first - regression with numerical variable load
lmodel_PC2_load <- lmer(PC2~Infection+(1|Location.x), full.data)
## boundary (singular) fit: see help('isSingular')
Anova(lmodel_PC2_load)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC2
##            Chisq Df Pr(>Chisq)
## Infection 0.4148  1     0.5195
# second - regression with categorical variable prevalence
lmodel_PC2_prevalence <-lmer(PC2~Prevalence+(1|Location.x), full.data)
## boundary (singular) fit: see help('isSingular')
Anova(lmodel_PC2_prevalence)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC2
##             Chisq Df Pr(>Chisq)
## Prevalence 0.1287  1     0.7197

PC3

ggplot(data = full.data, aes(x = Infection, y = PC3))+
  geom_point()+
  theme_classic()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  labs(x = "(Log) Fungal Load",
       y = "PC3 (Bandwidth & Duration Components)",
       title = "Fungal Load x PC3")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(data = full.data, aes(x = Infection, y = PC3, color = Prevalence))+
  geom_point()+
  theme_classic()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  labs(x = "(Log) Fungal Load",
       y = "PC3 (Bandwidth & Duration Components)",
       title = "Fungal Load x PC3")
## `geom_smooth()` using formula = 'y ~ x'

hist(scores[, 3])

# first - regression with numerical variable load
lmodel_PC3_load <- lmer(PC3~Infection+(1|Location.x), full.data)
Anova(lmodel_PC3_load)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC3
##           Chisq Df Pr(>Chisq)   
## Infection 7.397  1   0.006533 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# second - regression with categorical variable prevalence
lmodel_PC3_prevalence <-lmer(PC3~Prevalence+(1|Location.x), full.data)
summary(lmodel_PC3_prevalence)
## Linear mixed model fit by REML ['lmerMod']
## Formula: PC3 ~ Prevalence + (1 | Location.x)
##    Data: full.data
## 
## REML criterion at convergence: 198.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.9860 -0.7376 -0.1095  0.5607  2.0127 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  Location.x (Intercept) 0.2643   0.5141  
##  Residual               1.3917   1.1797  
## Number of obs: 62, groups:  Location.x, 2
## 
## Fixed effects:
##                   Estimate Std. Error t value
## (Intercept)         0.6368     0.4577   1.391
## PrevalencePresent  -0.8821     0.3301  -2.672
## 
## Correlation of Fixed Effects:
##             (Intr)
## PrvlncPrsnt -0.512
Anova(lmodel_PC3_prevalence)
## Analysis of Deviance Table (Type II Wald chisquare tests)
## 
## Response: PC3
##             Chisq Df Pr(>Chisq)   
## Prevalence 7.1389  1   0.007543 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(full.data,aes(x=Prevalence,y=PC3))+
  geom_boxplot(outlier.shape = NA)+
  geom_jitter(position=position_jitter(0.1))+
  theme_classic()

ggplot(full.data,aes(x=Prevalence,y=PC3))+
  facet_wrap(~Location.x,strip.position="bottom")+
  geom_boxplot(outlier.shape = NA)+
  geom_jitter(position=position_jitter(0.1))+
  theme_classic()

ggplot(Tdat, aes(`Delta Time (s)`, `BW 90% (Hz)`, color = ID))+
  geom_point()+
  theme_classic()+
  theme(legend.position = "none")

ggplot(Tdat, aes(`Delta Time (s)`, `BW 90% (Hz)`, color = ID))+
  theme_classic()+
  theme(legend.position = "none")+
    geom_smooth(method = 'lm',
              se = FALSE)
## `geom_smooth()` using formula = 'y ~ x'

ggplot(Tdat, aes(`Delta Time (s)`, `BW 90% (Hz)`, group = ID, color = Location.x))+
  theme_classic()+
  theme(legend.position = "none")+
    geom_smooth(method = 'lm',
              se = FALSE)
## `geom_smooth()` using formula = 'y ~ x'

ggplot(full.data,aes(x =Infection,y = Duration))+
  theme_classic()+
  geom_point()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  scale_color_brewer(palette = "Set2")
## `geom_smooth()` using formula = 'y ~ x'

ggplot(full.data,aes(x =Infection,y = BW))+
  theme_classic()+
  geom_point()+
  geom_smooth(method = 'lm',
              se = FALSE)+
  scale_color_brewer(palette = "Set2")
## `geom_smooth()` using formula = 'y ~ x'