Project Pt 6

library (tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.4.0      ✔ purrr   1.0.1 
✔ tibble  3.1.8      ✔ dplyr   1.0.10
✔ tidyr   1.3.0      ✔ stringr 1.5.0 
✔ readr   2.1.3      ✔ forcats 0.5.2 
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
library(ggplot2)
library(lme4)
Loading required package: Matrix

Attaching package: 'Matrix'

The following objects are masked from 'package:tidyr':

    expand, pack, unpack
library(glmmTMB)
Warning in checkDepPackageVersion(dep_pkg = "TMB"): Package version inconsistency detected.
glmmTMB was built with TMB version 1.9.1
Current TMB version is 1.9.2
Please re-install glmmTMB from source or restore original 'TMB' package (see '?reinstalling' for more information)
library(effects)
Loading required package: carData
lattice theme set by effectsTheme()
See ?effectsTheme for details.
library(performance)
library(car)

Attaching package: 'car'

The following object is masked from 'package:dplyr':

    recode

The following object is masked from 'package:purrr':

    some
library(rsample)
library(data.table)

Attaching package: 'data.table'

The following objects are masked from 'package:dplyr':

    between, first, last

The following object is masked from 'package:purrr':

    transpose
library(rstatix)

Attaching package: 'rstatix'

The following object is masked from 'package:stats':

    filter
# Original code for feeding effects
behavior_23Feb23 <- read.csv("behavior_23Feb23.csv")

behavior <- behavior_23Feb23
drop_na(behavior)
  replicate microcolony date date_withyr  time temp moving feeding stationary
1        28        23A1 2/23     2/23/22 11:08   23      0       0          0
  incubating fanning total_alive observer_initials infected parent
1          2       0           2                EF        0      1
  day_of_experiment
1                 9
                                                                notes drop
1 there were 10 alive bees, something is funny about this data. Drop.    1
behavior <- behavior %>% 
  mutate(observer_initials= if_else(observer_initials=='JM','JLM',observer_initials))

1.) H0: there is no effect of infection status and temp on incubating behavior, and no interactive effect of the two on behavior

HA: there is an interactive effect of infection status and temp on incubating behavior

#Step 1: make incubating count data into props
incubatingprop = (behavior$incubating/behavior$total_alive)
behavior<- cbind(behavior,incubatingprop)

behavior$temp=as.character(behavior$temp)
behavior$infected=as.factor(behavior$infected)
#Step 2: run an ANOVA
aov1<- aov(incubatingprop~temp*infected, data=behavior)
summary(aov1)
                Df Sum Sq Mean Sq F value Pr(>F)    
temp             4  29.18   7.295  219.58 <2e-16 ***
infected         1   5.93   5.928  178.42 <2e-16 ***
temp:infected    4   3.22   0.805   24.23 <2e-16 ***
Residuals     1270  42.20   0.033                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
728 observations deleted due to missingness

According to the summary, there are significant main effects of temperature and infection status, as well as a significant interactive effect of temp and infection status on incubating behavior.

TukeyHSD(aov1)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = incubatingprop ~ temp * infected, data = behavior)

$temp
             diff        lwr         upr     p adj
30-23 -0.15987824 -0.2012131 -0.11854335 0.0000000
34-23 -0.27766899 -0.3228906 -0.23244739 0.0000000
37-23 -0.33436341 -0.3739777 -0.29474911 0.0000000
40-23 -0.41391575 -0.4584101 -0.36942139 0.0000000
34-30 -0.11779075 -0.1654707 -0.07011077 0.0000000
37-30 -0.17448518 -0.2168842 -0.13208610 0.0000000
40-30 -0.25403751 -0.3010283 -0.20704671 0.0000000
37-34 -0.05669443 -0.1028908 -0.01049810 0.0073545
40-34 -0.13624676 -0.1866903 -0.08580318 0.0000000
40-37 -0.07955234 -0.1250370 -0.03406766 0.0000195

$infected
          diff        lwr       upr p adj
1-0 -0.1306659 -0.1507389 -0.110593     0

$`temp:infected`
                 diff         lwr          upr     p adj
30:0-23:0 -0.18373961 -0.24342261 -0.124056604 0.0000000
34:0-23:0 -0.36644385 -0.44926100 -0.283626703 0.0000000
37:0-23:0 -0.40547760 -0.46355719 -0.347398004 0.0000000
40:0-23:0 -0.50677743 -0.58959458 -0.423960285 0.0000000
23:1-23:0 -0.25804682 -0.32264051 -0.193453137 0.0000000
30:1-23:0 -0.42667980 -0.50227080 -0.351088792 0.0000000
34:1-23:0 -0.38590119 -0.45142019 -0.320382182 0.0000000
37:1-23:0 -0.49169105 -0.56091891 -0.422463184 0.0000000
40:1-23:0 -0.51974283 -0.58375831 -0.455727344 0.0000000
34:0-30:0 -0.18270424 -0.26715946 -0.098249021 0.0000000
37:0-30:0 -0.22173799 -0.28213040 -0.161345575 0.0000000
40:0-30:0 -0.32303782 -0.40749305 -0.238582603 0.0000000
23:1-30:0 -0.07430721 -0.14098816 -0.007626267 0.0154972
30:1-30:0 -0.24294019 -0.32032239 -0.165557991 0.0000000
34:1-30:0 -0.20216158 -0.26973927 -0.134583886 0.0000000
37:1-30:0 -0.30795144 -0.37913080 -0.236772077 0.0000000
40:1-30:0 -0.33600322 -0.40212422 -0.269882220 0.0000000
37:0-34:0 -0.03903375 -0.12236359  0.044296095 0.8983498
40:0-34:0 -0.14033358 -0.24245754 -0.038209621 0.0006042
23:1-34:0  0.10839703  0.02040289  0.196391162 0.0039292
30:1-34:0 -0.06023595 -0.15659270  0.036120804 0.6124732
34:1-34:0 -0.01945734 -0.10813295  0.069218271 0.9995417
37:1-34:0 -0.12524720 -0.21669730 -0.033797099 0.0006440
40:1-34:0 -0.15329898 -0.24086955 -0.065728403 0.0000016
40:0-37:0 -0.10129983 -0.18462968 -0.017969993 0.0047947
23:1-37:0  0.14743078  0.08218105  0.212680502 0.0000000
30:1-37:0 -0.02120220 -0.09735457  0.054950165 0.9969761
34:1-37:0  0.01957641 -0.04658946  0.085742283 0.9952058
37:1-37:0 -0.08621345 -0.15605384 -0.016373062 0.0038062
40:1-37:0 -0.11426523 -0.17894262 -0.049587840 0.0000012
23:1-40:0  0.24873061  0.16073648  0.336724743 0.0000000
30:1-40:0  0.08009763 -0.01625912  0.176454385 0.2025862
34:1-40:0  0.12087624  0.03220064  0.209551852 0.0007040
37:1-40:0  0.01508638 -0.07636371  0.106536483 0.9999576
40:1-40:0 -0.01296539 -0.10053597  0.074605179 0.9999832
30:1-23:1 -0.16863298 -0.24986282 -0.087403130 0.0000000
34:1-23:1 -0.12785437 -0.19980593 -0.055902800 0.0000010
37:1-23:1 -0.23364423 -0.30898867 -0.158299784 0.0000000
40:1-23:1 -0.26169600 -0.33228120 -0.191110810 0.0000000
34:1-30:1  0.04077861 -0.04118897  0.122746189 0.8593736
37:1-30:1 -0.06501125 -0.14997266  0.019950159 0.3115546
40:1-30:1 -0.09306303 -0.17383385 -0.012292206 0.0101452
37:1-34:1 -0.10578986 -0.18192908 -0.029650640 0.0004878
40:1-34:1 -0.13384164 -0.20527458 -0.062408694 0.0000002
40:1-37:1 -0.02805178 -0.10290111  0.046797554 0.9742279
check_model(aov1)
Variable `Component` is not in your data frame :/

behavior_meanincubating<- behavior %>%
group_by(temp,infected) %>%
drop_na(incubatingprop) %>%
summarize(meaninc = mean(incubatingprop), sd=sd(incubatingprop),n=n(),se=sd/sqrt(n))
`summarise()` has grouped output by 'temp'. You can override using the
`.groups` argument.
behavior_meanincubating
# A tibble: 10 × 6
# Groups:   temp [5]
   temp  infected meaninc     sd     n      se
   <chr> <fct>      <dbl>  <dbl> <int>   <dbl>
 1 23    0        0.527   0.286    203 0.0201 
 2 23    1        0.268   0.257    132 0.0223 
 3 30    0        0.343   0.220    174 0.0167 
 4 30    1        0.0999  0.107     82 0.0118 
 5 34    0        0.160   0.154     64 0.0193 
 6 34    1        0.141   0.131    126 0.0117 
 7 37    0        0.121   0.130    193 0.00938
 8 37    1        0.0349  0.0604   106 0.00587
 9 40    0        0.0198  0.0702    64 0.00877
10 40    1        0.00680 0.0257   136 0.00221
pd<- position_dodge(width=0.2)

ggplot(data=behavior_meanincubating, aes(x=temp, y=meaninc, color=infected)) +
  geom_point(position=pd) +
  geom_errorbar(data=behavior_meanincubating, aes(x=temp, ymin=meaninc-se,ymax=meaninc+se),size=0.5,position=pd) +
  theme_bw() + 
  labs(x="Temperature", y="Average Bees Incubating", color="Infected") +
  scale_color_manual(labels=c("No","Yes"), values=c("red","blue"))
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.

2.) H0: there is no difference in mean fanning behavior based on observer

HA: there is a difference in mean fanning behavior based on observer

fanningprop = (behavior$fanning/behavior$total_alive)
behavior<- cbind(behavior,fanningprop)

aov2<- aov(fanningprop~observer_initials, data=behavior)
summary(aov2)
                    Df Sum Sq Mean Sq F value Pr(>F)   
observer_initials   12   1.53 0.12762   2.723 0.0012 **
Residuals         1267  59.38 0.04687                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
728 observations deleted due to missingness
TukeyHSD(aov2)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = fanningprop ~ observer_initials, data = behavior)

$observer_initials
                 diff          lwr          upr     p adj
DC-AS    0.0314177380 -0.054291021  0.117126498 0.9921733
EF-AS    0.0083038258 -0.095885687  0.112493338 1.0000000
EM-AS    0.0138482424 -0.083137337  0.110833822 0.9999996
JLM-AS   0.0288634071 -0.094405948  0.152132763 0.9999064
JVW-AS   0.0517680419 -0.124711367  0.228247451 0.9990442
MC-AS    0.1516636142  0.009868840  0.293458388 0.0236174
MF-AS    0.0630386688 -0.016584431  0.142661769 0.2945225
MF -AS  -0.1042887668 -0.825584486  0.617006953 0.9999996
ML-AS    0.0665745966 -0.006684549  0.139833742 0.1191698
TS-AS    0.0132515558 -0.076943706  0.103446817 0.9999995
TS -AS   0.0068223443 -0.714473375  0.728118064 1.0000000
WR-AS   -0.0917887668 -0.282156853  0.098579319 0.9299462
EF-DC   -0.0231139122 -0.124397822  0.078169998 0.9999289
EM-DC   -0.0175694956 -0.111426720  0.076287729 0.9999918
JLM-DC  -0.0025543309 -0.123377797  0.118269135 1.0000000
JVW-DC   0.0203503039 -0.154429437  0.195130045 1.0000000
MC-DC    0.1202458761 -0.019427793  0.259919546 0.1777143
MF-DC    0.0316209307 -0.044160426  0.107402287 0.9764866
MF -DC  -0.1357065048 -0.856588250  0.585175241 0.9999913
ML-DC    0.0351568585 -0.033907447  0.104221164 0.8988831
TS-DC   -0.0181661822 -0.104988767  0.068656402 0.9999722
TS -DC  -0.0245953937 -0.745477139  0.696286352 1.0000000
WR-DC   -0.1232065048 -0.312000001  0.065586991 0.6163589
EM-EF    0.0055444166 -0.105444959  0.116533793 1.0000000
JLM-EF   0.0205595813 -0.114005544  0.155124707 0.9999992
JVW-EF   0.0434642161 -0.141082311  0.228010744 0.9999005
MC-EF    0.1433597884 -0.008357702  0.295077279 0.0858509
MF-EF    0.0547348430 -0.041453915  0.150923600 0.8020542
MF -EF  -0.1125925926 -0.835904389  0.610719203 0.9999990
ML-EF    0.0582707708 -0.032720115  0.149261657 0.6458014
TS-EF    0.0049477300 -0.100159949  0.110055409 1.0000000
TS -EF  -0.0014814815 -0.724793277  0.721830314 1.0000000
WR-EF   -0.1000925926 -0.297962366  0.097777181 0.9029741
JLM-EM   0.0150151647 -0.114052729  0.144083058 1.0000000
JVW-EM   0.0379197995 -0.142657522  0.218497121 0.9999711
MC-EM    0.1378153718 -0.009048324  0.284679067 0.0912299
MF-EM    0.0491904264 -0.039144307  0.137525160 0.8246743
MF -EM  -0.1181370092 -0.840446294  0.604172275 0.9999982
ML-EM    0.0527263542 -0.029918001  0.135370709 0.6515640
TS-EM   -0.0005966866 -0.098567970  0.097374596 1.0000000
TS -EM  -0.0070258981 -0.729335182  0.715283386 1.0000000
WR-EM   -0.1056370092 -0.299810116  0.088536097 0.8469319
JVW-JLM  0.0229046348 -0.173047656  0.218856926 1.0000000
MC-JLM   0.1228002070 -0.042602563  0.288202978 0.3995005
MF-JLM   0.0341752616 -0.082410143  0.150760666 0.9990507
MF -JLM -0.1331521739 -0.859457780  0.593153432 0.9999935
ML-JLM   0.0377111895 -0.074624116  0.150046495 0.9964890
TS-JLM  -0.0156118513 -0.139658229  0.108434526 0.9999999
TS -JLM -0.0220410628 -0.748346669  0.704264543 1.0000000
WR-JLM  -0.1206521739 -0.329200314  0.087895966 0.7834429
MC-JVW   0.0998955723 -0.108209508  0.308000652 0.9320970
MF-JVW   0.0112706269 -0.160606668  0.183147921 1.0000000
MF -JVW -0.1560568087 -0.893260635  0.581147018 0.9999684
ML-JVW   0.0148065547 -0.154216724  0.183829833 1.0000000
TS-JVW  -0.0385164861 -0.215539512  0.138506539 0.9999575
TS -JVW -0.0449456976 -0.782149524  0.692258129 1.0000000
WR-JVW  -0.1435568087 -0.387364057  0.100250440 0.7624167
MF-MC   -0.0886249454 -0.224649136  0.047399246 0.6189374
MF -MC  -0.2559523810 -0.985630569  0.473725807 0.9947340
ML-MC   -0.0850890176 -0.217488583  0.047310548 0.6403665
TS-MC   -0.1384120584 -0.280882854  0.004058738 0.0665287
TS -MC  -0.1448412698 -0.874519458  0.584836918 0.9999844
WR-MC   -0.2434523810 -0.463458632 -0.023446129 0.0154049
MF -MF  -0.1673274356 -0.887510980  0.552856109 0.9999139
ML-MF    0.0035359278 -0.057813277  0.064885133 1.0000000
TS-MF   -0.0497871130 -0.130607951  0.031033725 0.7028837
TS -MF  -0.0562163245 -0.776399869  0.663967220 1.0000000
WR-MF   -0.1548274356 -0.340937163  0.031282292 0.2219726
ML-MF    0.1708633634 -0.548644386  0.890371113 0.9998913
TS-MF    0.1175403226 -0.603888596  0.838969241 0.9999983
TS -MF   0.1111111111 -0.905054237  1.127276459 1.0000000
WR-MF    0.0125000000 -0.728151408  0.753151408 1.0000000
TS-ML   -0.0533230408 -0.127882226  0.021236144 0.4633815
TS -ML  -0.0597522523 -0.779260002  0.659755498 1.0000000
WR-ML   -0.1583633634 -0.341840596  0.025113870 0.1746091
TS -TS  -0.0064292115 -0.727858130  0.714999707 1.0000000
WR-TS   -0.1050403226 -0.295912473  0.085831828 0.8362401
WR-TS   -0.0986111111 -0.839262519  0.642040297 0.9999998
check_model(aov2)

# Homogeneity of variance assumption is not met 
leveneTest(fanningprop~observer_initials,data=behavior)
Warning in leveneTest.default(y = y, group = group, ...): group coerced to
factor.
Levene's Test for Homogeneity of Variance (center = median)
        Df F value   Pr(>F)   
group   12  2.3842 0.004828 **
      1267                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
behavior_meanfan<- behavior %>%
group_by(observer_initials) %>%
  drop_na(fanningprop) %>%
summarize(meanfan = mean(fanningprop), sd=sd(fanningprop),n=n(),se=sd/sqrt(n))

behavior_meanfan<- behavior_meanfan[-c(9,12),]

behavior_meanfan
# A tibble: 11 × 5
   observer_initials meanfan     sd     n      se
   <chr>               <dbl>  <dbl> <int>   <dbl>
 1 AS                 0.104  0.199    130 0.0175 
 2 DC                 0.136  0.214    153 0.0173 
 3 EF                 0.113  0.211     75 0.0243 
 4 EM                 0.118  0.148     95 0.0152 
 5 JLM                0.133  0.215     46 0.0317 
 6 JVW                0.156  0.259     19 0.0594 
 7 MC                 0.256  0.470     32 0.0831 
 8 MF                 0.167  0.281    218 0.0190 
 9 ML                 0.171  0.165    370 0.00857
10 TS                 0.118  0.193    124 0.0174 
11 WR                 0.0125 0.0342    16 0.00854
behavior_meanfan$n=as.factor(behavior_meanfan$n)

ggplot(data=behavior_meanfan, aes(x=observer_initials, y=meanfan,color=n)) +
  geom_point(position=pd) +
  geom_errorbar(data=behavior_meanfan, aes(x=observer_initials, ymin=meanfan-se,ymax=meanfan+se),size=0.5,position=pd) +
  theme_bw() + 
  labs(x="Observer", y="Average Bees Fanning") 

3.) H0: there is no effect of infection status and temp on feeding behavior, and no interactive effect of the two on behavior

HA: there is an interactive effect of infection status and temp on feeding behavior

feedingprop = (behavior$feeding/behavior$total_alive)
behavior<- cbind(behavior,feedingprop)

aov3<- aov(feedingprop~temp*infected, data=behavior)
summary(aov3)
                Df Sum Sq Mean Sq F value  Pr(>F)    
temp             4 29.070   7.267 544.745 < 2e-16 ***
infected         1  0.078   0.078   5.873 0.01552 *  
temp:infected    4  0.179   0.045   3.357 0.00961 ** 
Residuals     1270 16.943   0.013                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
728 observations deleted due to missingness
TukeyHSD(aov3)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = feedingprop ~ temp * infected, data = behavior)

$temp
             diff          lwr        upr     p adj
30-23 -0.01124301 -0.037435630 0.01494960 0.7671130
34-23  0.03504866  0.006393161 0.06370416 0.0076455
37-23  0.15094378  0.125841446 0.17604612 0.0000000
40-23  0.42403613  0.395841458 0.45223080 0.0000000
34-30  0.04629167  0.016078372 0.07650497 0.0002937
37-30  0.16218680  0.135319842 0.18905375 0.0000000
40-30  0.43527914  0.405502551 0.46505573 0.0000000
37-34  0.11589512  0.086621966 0.14516828 0.0000000
40-34  0.38898747  0.357022959 0.42095198 0.0000000
40-37  0.27309234  0.244270139 0.30191455 0.0000000

$infected
          diff         lwr        upr    p adj
1-0 0.01502172 0.002302145 0.02774129 0.020667

$`temp:infected`
                  diff          lwr         upr     p adj
30:0-23:0 -0.012440378 -0.050259617  0.02537886 0.9895660
34:0-23:0  0.043185947 -0.009292669  0.09566456 0.2147083
37:0-23:0  0.141861600  0.105058393  0.17866481 0.0000000
40:0-23:0  0.378664618  0.326186002  0.43114323 0.0000000
23:1-23:0  0.001539009 -0.039391973  0.04246999 1.0000000
30:1-23:0 -0.006809062 -0.054708701  0.04109058 0.9999882
34:1-23:0  0.031829871 -0.009687458  0.07334720 0.3088037
37:1-23:0  0.169190762  0.125323247  0.21305828 0.0000000
40:1-23:0  0.446279216  0.405714622  0.48684381 0.0000000
34:0-30:0  0.055626326  0.002109713  0.10914294 0.0340380
37:0-30:0  0.154301979  0.116033209  0.19257075 0.0000000
40:0-30:0  0.391104996  0.337588384  0.44462161 0.0000000
23:1-30:0  0.013979387 -0.028274228  0.05623300 0.9891264
30:1-30:0  0.005631316 -0.043403345  0.05466598 0.9999982
34:1-30:0  0.044270250  0.001448394  0.08709211 0.0359936
37:1-30:0  0.181631141  0.136527021  0.22673526 0.0000000
40:1-30:0  0.458719594  0.416820801  0.50061839 0.0000000
37:0-34:0  0.098675653  0.045872158  0.15147915 0.0000002
40:0-34:0  0.335478671  0.270765935  0.40019141 0.0000000
23:1-34:0 -0.041646938 -0.097406048  0.01411217 0.3466184
30:1-34:0 -0.049995009 -0.111053247  0.01106323 0.2208696
34:1-34:0 -0.011356076 -0.067547015  0.04483486 0.9997668
37:1-34:0  0.126004815  0.068055769  0.18395386 0.0000000
40:1-34:0  0.403093269  0.347602555  0.45858398 0.0000000
40:0-37:0  0.236803018  0.183999522  0.28960651 0.0000000
23:1-37:0 -0.140322591 -0.181669287 -0.09897590 0.0000000
30:1-37:0 -0.148670663 -0.196926018 -0.10041531 0.0000000
34:1-37:0 -0.110031729 -0.151958958 -0.06810450 0.0000000
37:1-37:0  0.027329162 -0.016926491  0.07158482 0.6294695
40:1-37:0  0.304417615  0.263433592  0.34540164 0.0000000
23:1-40:0 -0.377125609 -0.432884719 -0.32136650 0.0000000
30:1-40:0 -0.385473680 -0.446531918 -0.32441544 0.0000000
34:1-40:0 -0.346834747 -0.403025686 -0.29064381 0.0000000
37:1-40:0 -0.209473855 -0.267422901 -0.15152481 0.0000000
40:1-40:0  0.067614598  0.012123885  0.12310531 0.0046317
30:1-23:1 -0.008348071 -0.059820866  0.04312472 0.9999634
34:1-23:1  0.030290862 -0.015302578  0.07588430 0.5237805
37:1-23:1  0.167651753  0.119908355  0.21539515 0.0000000
40:1-23:1  0.444740207  0.400012593  0.48946782 0.0000000
34:1-30:1  0.038638933 -0.013301338  0.09057921 0.3525499
37:1-30:1  0.175999825  0.122162457  0.22983719 0.0000000
40:1-30:1  0.453088278  0.401906353  0.50427020 0.0000000
37:1-34:1  0.137360891  0.089113866  0.18560792 0.0000000
40:1-34:1  0.414449345  0.369184538  0.45971415 0.0000000
40:1-37:1  0.277088453  0.229658790  0.32451812 0.0000000
check_model(aov3)
Variable `Component` is not in your data frame :/

behavior_meanfeed<- behavior %>%
group_by(temp,infected) %>%
drop_na(feedingprop) %>%
summarize(meanfeed = mean(feedingprop), sd=sd(feedingprop),n=n(),se=sd/sqrt(n))
`summarise()` has grouped output by 'temp'. You can override using the
`.groups` argument.
behavior_meanfeed
# A tibble: 10 × 6
# Groups:   temp [5]
   temp  infected meanfeed     sd     n      se
   <chr> <fct>       <dbl>  <dbl> <int>   <dbl>
 1 23    0          0.0374 0.0629   203 0.00442
 2 23    1          0.0390 0.0645   132 0.00561
 3 30    0          0.0250 0.0516   174 0.00391
 4 30    1          0.0306 0.0575    82 0.00635
 5 34    0          0.0806 0.0944    64 0.0118 
 6 34    1          0.0692 0.0934   126 0.00832
 7 37    0          0.179  0.152    193 0.0109 
 8 37    1          0.207  0.136    106 0.0132 
 9 40    0          0.416  0.180     64 0.0225 
10 40    1          0.484  0.189    136 0.0162 
ggplot(data=behavior_meanfeed, aes(x=temp, y=meanfeed, color=infected)) +
  geom_point(position=pd) +
  geom_errorbar(data=behavior_meanfeed, aes(x=temp, ymin=meanfeed-se,ymax=meanfeed+se),size=0.5,position=pd) +
  theme_bw() + 
  labs(x="Temperature", y="Average Bees Feeding", color="Infected") +
  scale_color_manual(labels=c("No","Yes"), values=c("red","blue"))