Flight Trials Winter 2020 Dataset was conducted from 2/17/2020 - 3/10/2020. Soapberry bugs were flight tested twice for multiple hours in the flight mill and observed from 8 AM to (5-8 PM) each day. No morphological covariates were included for thorax width or body length (just looked at sex, host, and sym_dist). For wing length and beak length, sex, host, sym_dist, and thorax width were all included.
Comparing Models:
rm(list=ls())
output_col = FALSE # Recommend changing this to TRUE if working in Base R or RStudio, and FALSE if generating an html
source("src/clean_flight_data.R") # Script that loads and cleans up the data
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
source("src/regression_output.R") # A script that cleans up regression outputs and prints in color or black and white
source("src/center_flight_data.R")
data <- read_flight_data("data/all_flight_data-Winter2020.csv")
data_all <- data[[1]]
data_tested <- data[[2]]
data_tested <- data_tested[data_tested$trial_type=="T1",] # only the unique values pulled for those tested
data_tested <- center_data(data_tested)
data_all <- data_all %>%
filter(trial_type != "T2")
data_all <- center_data(data_all)
## female mass: 0.07601786 +/- 0.02655709 mg , N = 112
## male mass: 0.03819355 +/- 0.008538548 mg , N = 217
##
## female thorax: 3.407807 +/- 0.2804414 mm , N = 114
## female body: 12.43193 +/- 1.028742 mm , N = 114
## female wing: 8.852544 +/- 0.8780195 mm , N = 114
## male thorax: 3.002627 +/- 0.2105483 mm , N = 217
## male body: 11.03424 +/- 0.7220576 mm , N = 217
## male wing: 7.973871 +/- 0.607644 mm , N = 217
Experimental Set-Up Effects
## lm thorax_c ~ days_from_start_c data_tested
## AIC: 158.4562
## (Intercept) coeff: 3.13e-05 Pr(>|t|): 0.9985159
## days_from_start_c coeff: -0.0017848 Pr(>|t|): 0.6919392
## lm thorax_c ~ min_from_IncStart_c data_tested
## AIC: 158.4356
## (Intercept) coeff: -2.25e-05 Pr(>|t|): 0.9989305
## min_from_IncStart_c coeff: 5.06e-05 Pr(>|t|): 0.6735841
Thorax
data<-data.frame(R=data_tested$thorax_c,
A=data_tested$host_c,
B=data_tested$sex_c,
C=data_tested$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## AICs -27.67795 -27.46982 -26.61224 -26.0188 -25.77966 -24.845 -24.62301
## models 11 15 7 14 17 12 13
## probs 0.2589189 0.2333292 0.1519661 0.1129491 0.1002202 0.06280524 0.05620722
##
## m11 R ~ A * B + C
## m15 R ~ A * B + B * C
## m7 R ~ A + B + C
## m14 R ~ A * B + A * C
## m17 R ~ A * B + A * C + B * C
## m12 R ~ A * C + B
## m13 R ~ B * C + A
anova(m7, m11, test="Chisq") # Adding A*B marginally improves fit
## Analysis of Variance Table
##
## Model 1: R ~ A + B + C
## Model 2: R ~ A * B + C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 327 17.351
## 2 326 17.191 1 0.15996 0.08157 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(m7, m12, test="Chisq") # Adding A*C does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A + B + C
## Model 2: R ~ A * C + B
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 327 17.351
## 2 326 17.338 1 0.012197 0.632
best.fit.thorax <- lm(thorax_c ~ host_c * sex_c + sym_dist, data=data_tested)
tidy_regression(best.fit.thorax, is_color=output_col)
## lm thorax_c ~ host_c * sex_c + sym_dist data_tested
## AIC: -27.67795
## (Intercept) coeff: -0.0250319 Pr(>|t|): 0.2826246
## host_c coeff: -0.0783603 Pr(>|t|): 6.564207e-05 *
## sex_c coeff: 0.2207735 Pr(>|t|): 1.960769e-37 *
## sym_dist coeff: 0.0685935 Pr(>|t|): 2.373496e-05 *
## host_c:sex_c coeff: 0.0263292 Pr(>|t|): 0.0825086 .
negative effect of host plant where if from GRT then smaller thorax length
strong positive effect of sex where if Female then larger thorax length
positive effect of sym_dist where if farther from Homestead, then longer thorax length
positive marginal effect of host*sex where if Female and from GRT then larger body
Body Length
data<-data.frame(R=data_tested$body_c,
A=data_tested$host_c,
B=data_tested$sex_c,
C=data_tested$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4]
## AICs 816.9584 817.3166 818.9235 819.2932
## models 15 11 17 14
## probs 0.3582014 0.299463 0.1340989 0.1114676
##
## m15 R ~ A * B + B * C
## m11 R ~ A * B + C
## m17 R ~ A * B + A * C + B * C
## m14 R ~ A * B + A * C
anova(m11, m15, test="Chisq") # Adding B*C does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A * B + C
## Model 2: R ~ A * B + B * C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 326 220.79
## 2 325 219.22 1 1.5674 0.1274
best.fit.body <- lm(body_c ~ host_c * sex_c + sym_dist, data=data_tested)
tidy_regression(best.fit.body, is_color=output_col)
## lm body_c ~ host_c * sex_c + sym_dist data_tested
## AIC: 817.3166
## (Intercept) coeff: -0.016613 Pr(>|t|): 0.8421509
## host_c coeff: -0.1714697 Pr(>|t|): 0.01405374 *
## sex_c coeff: 0.7761622 Pr(>|t|): 2.282348e-36 *
## sym_dist coeff: 0.2043044 Pr(>|t|): 0.0004196875 *
## host_c:sex_c coeff: 0.1291922 Pr(>|t|): 0.01766764 *
negative effect of host where if from GRT then smaller body
strong positve effect of sex, where if Female then larger body
positve effect of sym_dist where if farther from Homestead, then larger body
positive host*sex interaction where if Female and from GRT then larger body
Wing Length
data<-data.frame(R=data_tested$wing_c,
A=data_tested$host_c,
B=data_tested$sex_c,
C=data_tested$sym_dist,
D=data_tested$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 4-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6]
## AICs 306.1317 306.428 306.6083 306.6488 307.4299 307.5497
## models 99 108 76 96 100 109
## probs 0.1118604 0.09645636 0.08814306 0.08637674 0.05844998 0.05505182
##
## m99 R ~ A * B + A * D + B * D + C * D
## m108 R ~ A * B + A * C + A * D + B * D + C * D
## m76 R ~ A * B + B * D + C * D
## m96 R ~ A * B + A * C + B * D + C * D
## m100 R ~ A * B + B * C + B * D + C * D
## m109 R ~ A * B + A * C + B * C + B * D + C * D
best.fit.wing <- lm(wing_c ~ host_c * sex_c + host_c * thorax_c + sex_c * thorax_c + sym_dist * thorax_c, data=data_tested)
tidy_regression(best.fit.wing, is_color=output_col)
## lm wing_c ~ host_c * sex_c + host_c * thorax_c + sex_c * thorax_c + sym_dist * thorax_c data_tested
## AIC: 306.1317
## (Intercept) coeff: -0.0348724 Pr(>|t|): 0.4547398
## host_c coeff: 0.092583 Pr(>|t|): 0.006464633 *
## sex_c coeff: -0.0152052 Pr(>|t|): 0.6725461
## thorax_c coeff: 2.5464596 Pr(>|t|): 2.164448e-56 *
## sym_dist coeff: 0.0206994 Pr(>|t|): 0.4858951
## host_c:sex_c coeff: 0.1311589 Pr(>|t|): 0.000256224 *
## host_c:thorax_c coeff: -0.1833557 Pr(>|t|): 0.120909
## sex_c:thorax_c coeff: 0.1850893 Pr(>|t|): 0.04228329 *
## thorax_c:sym_dist coeff: -0.1833091 Pr(>|t|): 0.02884297 *
positive effect of host where if from GRT then have longer wings
no effect of sex
strong positive effect of thorax where the longer the thorax, the longer the wings
no effect of sym_dist
positive effect of host*sex where if Female and from GRT then have longer wings
no effect of host*thorax
positive effect of sex*thorax where if F and have longer thorax, then have longer wings
negative effect of sex*sym_dist where if F and farther from Homestead, then have shorter wings
Beak Length
data<-data.frame(R=data_tested$beak_c,
A=data_tested$host_c,
B=data_tested$sex_c,
C=data_tested$sym_dist,
D=data_tested$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 4-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6]
## AICs 414.4381 415.5398 415.7138 415.7691 416.1122 416.2193
## models 80 94 64 101 69 104
## probs 0.1404375 0.08095413 0.07421142 0.07218718 0.06080795 0.0576363
##
## m80 R ~ A * C + B * C + B * D
## m94 R ~ A * B + A * C + B * C + B * D
## m64 R ~ B * C + B * D + A
## m101 R ~ A * C + A * D + B * C + B * D
## m69 R ~ A * B + A * C + B * D
## m104 R ~ A * C + B * C + B * D + C * D
best.fit.beak <- lm(beak_c ~ host_c * sym_dist + sex_c * sym_dist + sex_c * thorax_c, data=data_tested)
tidy_regression(best.fit.beak, is_color=output_col)
## lm beak_c ~ host_c * sym_dist + sex_c * sym_dist + sex_c * thorax_c data_tested
## AIC: 414.4381
## (Intercept) coeff: 0.1509651 Pr(>|t|): 0.02942437 *
## host_c coeff: -0.2947804 Pr(>|t|): 3.550766e-06 *
## sym_dist coeff: -0.3250069 Pr(>|t|): 0.01613185 *
## sex_c coeff: 0.5868878 Pr(>|t|): 1.672782e-38 *
## thorax_c coeff: 1.4540962 Pr(>|t|): 1.51571e-33 *
## host_c:sym_dist coeff: 0.2397829 Pr(>|t|): 0.07401853 .
## sym_dist:sex_c coeff: -0.0785539 Pr(>|t|): 0.003777402 *
## sex_c:thorax_c coeff: 0.3247085 Pr(>|t|): 0.002339399 *
negative effect of host where if from GRT then have shorter beak
negative effect of sym_dist where if farther from Homestead then have shorter beak
positive effect of beak length where if Female then have longer beak
strong positive effect of thorax where the longer the thorax the longer the beak
maringal positive effect of host*sym_dist where if from GRT and farther from Homeasted then have longer beak
negative effect of sym_dist*sex where if farther from Homestead and Female then have shorter beak
positive effect of sex*thorax where if Female and have larger thorax then have longer beak
par(mfrow=c(2,3))
plot(thorax_c ~ host_c, data=data_tested, main="data_tested")
plot(thorax_c ~ sym_dist, data=data_tested, main="data_tested")
plot(thorax_c ~ sex_c, data=data_tested, main="data_tested")
plot(thorax_c ~ host_c, data=data_all, main="data_all")
plot(thorax_c ~ sym_dist, data=data_all, main="data_all")
plot(thorax_c ~ sex_c, data=data_all, main="data_all")
gf_point(thorax_c ~ sym_dist, col=~host_c, alpha=~sex_c, data=data_tested)
## Warning: Removed 1 rows containing missing values (geom_point).
gf_point(thorax_c ~ sym_dist, col=~host_c, alpha=~sex_c, data=data_all)
## Warning: Removed 1 rows containing missing values (geom_point).
Comparing Models:
rm(list=ls())
output_col = FALSE
source("src/clean_flight_data.R")
source("src/regression_output.R")
source("src/center_flight_data.R")
data <- read_flight_data("data/all_flight_data-Winter2020.csv")
data_all <- data[[1]]
data_tested <- data[[2]]
data_tested <- data_tested[data_tested$trial_type=="T1",] # only the unique values pulled for those tested
data_tested <- center_data(data_tested)
data_all <- data_all %>%
filter(trial_type != "T2")
data_all <- center_data(data_all)
data_fem <- data_tested[data_tested$sex=="F",]
data_fem <- center_data(data_fem)
Thorax
data<-data.frame(R=data_fem$thorax_c,
A=data_fem$host_c,
B=data_fem$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 2-FF.R")
## [,1] [,2] [,3] [,4] [,5]
## AICs 36.63652 38.38463 38.53525 39.73296 40.26302
## models 5 2 1 3 4
## probs 0.4587178 0.1914025 0.1775173 0.09753509 0.07482726
##
## m0 R ~ 1
## m2 R ~ B
## m1 R ~ A
## m3 R ~ A + B
## m4 R ~ A * B
anova(m0, m2, test="Chisq") # Adding B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ 1
## Model 2: R ~ B
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 113 8.8872
## 2 112 8.8675 1 0.019615 0.6187
anova(m0, m1, test="Chisq") # Adding A does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ 1
## Model 2: R ~ A
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 113 8.8872
## 2 112 8.8793 1 0.0078909 0.7524
best.fem.thorax <- lm(thorax_c ~ 1, data=data_fem)
tidy_regression(best.fem.thorax, is_color=output_col)
## lm thorax_c ~ 1 data_fem
## AIC: 36.63652
Body
data<-data.frame(R=data_fem$body_c,
A=data_fem$host_c,
B=data_fem$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 2-FF.R")
## [,1] [,2] [,3] [,4] [,5]
## AICs 332.9743 334.2789 334.353 336.16 337.232
## models 5 2 1 3 4
## probs 0.4264291 0.2221005 0.2140254 0.0867104 0.05073456
##
## m0 R ~ 1
## m2 R ~ B
## m1 R ~ A
## m3 R ~ A + B
## m4 R ~ A * B
anova(m0, m2, test="Chisq") # Adding B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ 1
## Model 2: R ~ B
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 113 119.59
## 2 112 118.86 1 0.72724 0.4078
anova(m0, m1, test="Chisq") # Adding A does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ 1
## Model 2: R ~ A
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 113 119.59
## 2 112 118.94 1 0.64998 0.434
best.fem.body <- lm(body_c ~ 1, data=data_fem)
tidy_regression(best.fem.body, is_color=output_col)
## lm body_c ~ 1 data_fem
## AIC: 332.9743
Wing
data<-data.frame(R=data_fem$wing_c,
A=data_fem$host_c,
B=data_fem$sym_dist,
C=data_fem$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6]
## AICs 122.5499 123.1531 123.3897 123.7941 123.9545 125.7873
## models 13 16 15 9 17 12
## probs 0.2621683 0.1939108 0.1722771 0.1407359 0.1298907 0.05194943
##
## m13 R ~ B * C + A
## m16 R ~ A * C + B * C
## m15 R ~ A * B + B * C
## m9 R ~ A * C
## m17 R ~ A * B + A * C + B * C
## m12 R ~ A * C + B
anova(m13, m16, test="Chisq") # Adding A*C does not inprove fit
## Analysis of Variance Table
##
## Model 1: R ~ B * C + A
## Model 2: R ~ A * C + B * C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 109 17.603
## 2 108 17.388 1 0.21437 0.2485
best.fem.wing <- lm(wing_c ~ sym_dist * thorax_c + host_c, data=data_fem)
tidy_regression(best.fem.wing, is_color=output_col)
## lm wing_c ~ sym_dist * thorax_c + host_c data_fem
## AIC: 122.5499
## (Intercept) coeff: 0.0928076 Pr(>|t|): 0.1686994
## sym_dist coeff: -0.0104522 Pr(>|t|): 0.84811
## thorax_c coeff: 3.0148292 Pr(>|t|): 3.331782e-36 *
## host_c coeff: 0.1753504 Pr(>|t|): 0.001611579 *
## sym_dist:thorax_c coeff: -0.4960521 Pr(>|t|): 0.00129979 *
Beak
data<-data.frame(R=data_fem$beak_c,
A=data_fem$host_c,
B=data_fem$sym_dist,
C=data_fem$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## AICs 206.5514 207.4772 208.0697 208.4803 208.5324 209.4175 209.4651
## models 7 11 5 12 13 14 15
## probs 0.2643134 0.1663704 0.123713 0.1007537 0.09816086 0.0630586 0.06157561
## [,8]
## AICs 209.6709
## models 9
## probs 0.05555451
##
## m7 R ~ A + B + C
## m11 R ~ A * B + C
## m5 R ~ A + C
## m12 R ~ A * C + B
## m13 R ~ B * C + A
## m14 R ~ A * B + A * C
## m15 R ~ A * B + B * C
## m9 R ~ A * C
anova(m5, m7, test="Chisq") # Adding B marginally improves fit
## Analysis of Variance Table
##
## Model 1: R ~ A + C
## Model 2: R ~ A + B + C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 111 38.603
## 2 110 37.429 1 1.1732 0.06334 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(m7, m11, test="Chisq") # Adding A*B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A + B + C
## Model 2: R ~ A * B + C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 110 37.429
## 2 109 37.078 1 0.35102 0.3097
best.fem.beak <- lm(beak_c ~ host_c + sym_dist + thorax_c, data=data_fem)
tidy_regression(best.fem.beak, is_color=output_col)
## lm beak_c ~ host_c + sym_dist + thorax_c data_fem
## AIC: 206.5514
## (Intercept) coeff: -0.0163994 Pr(>|t|): 0.8663534
## host_c coeff: -0.2515625 Pr(>|t|): 0.001805485 *
## sym_dist coeff: -0.1461557 Pr(>|t|): 0.06601068 .
## thorax_c coeff: 1.7887314 Pr(>|t|): 4.376265e-15 *
plot(thorax ~ host_c, data=data_fem)
plot(thorax ~ sym_dist, data=data_fem)
gf_point(thorax_c ~ sym_dist, col=~host_c, data=data_fem)
Comparing Models:
rm(list=ls())
output_col = FALSE #
source("src/clean_flight_data.R")
source("src/regression_output.R")
source("src/center_flight_data.R")
data <- read_flight_data("data/all_flight_data-Winter2020.csv")
data_all <- data[[1]]
data_tested <- data[[2]]
data_tested <- data_tested[data_tested$trial_type=="T1",] # only the unique values pulled for those tested
data_tested <- center_data(data_tested)
data_all <- data_all %>%
filter(trial_type != "T2")
data_all <- center_data(data_all)
data_male <- data_tested[data_tested$sex=="M",]
data_male <- center_data(data_male)
Thorax
data<-data.frame(R=data_male$thorax_c,
A=data_male$host_c,
B=data_male$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 2-FF.R")
## [,1] [,2]
## AICs -84.89103 -83.09815
## models 3 4
## probs 0.7102106 0.2897795
##
## m3 R ~ A + B
## m4 R ~ A * B
anova(m3, m4, test="Chisq") # Adding A*B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A + B
## Model 2: R ~ A * B
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 214 8.2809
## 2 213 8.2730 1 0.0079 0.652
best.male.thorax <- lm(thorax_c ~ host_c + sym_dist, data=data_male)
tidy_regression(best.male.thorax, is_color=output_col)
## lm thorax_c ~ host_c + sym_dist data_male
## AIC: -84.89103
## (Intercept) coeff: -0.1226273 Pr(>|t|): 2.470022e-06 *
## host_c coeff: -0.1165509 Pr(>|t|): 9.16691e-08 *
## sym_dist coeff: 0.0814443 Pr(>|t|): 8.039094e-07 *
Body
data<-data.frame(R=data_male$body_c,
A=data_male$host_c,
B=data_male$sym_dist)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 2-FF.R")
## [,1] [,2]
## AICs 456.7576 456.9809
## models 3 4
## probs 0.5278341 0.4720733
##
## m3 R ~ A + B
## m4 R ~ A * B
anova(m3, m4, test="Chisq") # Adding A*B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A + B
## Model 2: R ~ A * B
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 214 100.487
## 2 213 99.668 1 0.81939 0.1857
best.male.body <- lm(body_c ~ host_c + sym_dist, data=data_male)
tidy_regression(best.male.body, is_color=output_col)
## lm body_c ~ host_c + sym_dist data_male
## AIC: 456.7576
## (Intercept) coeff: -0.378671 Pr(>|t|): 2.687442e-05 *
## host_c coeff: -0.3494076 Pr(>|t|): 3.542455e-06 *
## sym_dist coeff: 0.2571158 Pr(>|t|): 6.989072e-06 *
Wing
data<-data.frame(R=data_male$wing_c,
A=data_male$host_c,
B=data_male$sym_dist,
C=data_male$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## AICs 180.6435 181.7512 181.8753 182.0554 183.1313 183.6794 183.8068
## models 3 5 6 10 9 7 13
## probs 0.2553376 0.1467521 0.1379246 0.126048 0.07360286 0.05596131 0.05250854
##
## m3 R ~ C
## m5 R ~ A + C
## m6 R ~ B + C
## m10 R ~ B * C
## m9 R ~ A * C
## m7 R ~ A + B + C
## m13 R ~ B * C + A
anova(m3, m5, test="Chisq") # Adding A does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ C
## Model 2: R ~ A + C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 215 28.413
## 2 214 28.296 1 0.11659 0.3477
anova(m3, m6, test="Chisq") # Adding B does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ C
## Model 2: R ~ B + C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 215 28.413
## 2 214 28.312 1 0.10041 0.3837
best.male.wing <- lm(wing_c ~ thorax_c, data=data_male)
tidy_regression(best.male.wing, is_color=output_col)
## lm wing_c ~ thorax_c data_male
## AIC: 180.6435
## thorax_c coeff: 2.3155573 Pr(>|t|): 4.402143e-50 *
Beak
data<-data.frame(R=data_male$beak_c,
A=data_male$host_c,
B=data_male$sym_dist,
C=data_male$thorax_c)
source("src/compare_models.R")
model_comparisonsAIC("src/generic models-gaussian glmer 3-FF.R")
## [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## AICs 174.2321 174.9236 175.3261 176.0944 176.126 176.4698 176.9163
## models 5 11 7 9 15 13 14
## probs 0.2397016 0.1696295 0.138711 0.09446799 0.09298346 0.07829792 0.0626344
## [,8]
## AICs 177.3206
## models 12
## probs 0.05117045
##
## m5 R ~ A + C
## m11 R ~ A * B + C
## m7 R ~ A + B + C
## m9 R ~ A * C
## m15 R ~ A * B + B * C
## m13 R ~ B * C + A
## m14 R ~ A * B + A * C
## m12 R ~ A * C + B
anova(m5, m9, test="Chisq") # adding A*C does not improve fit
## Analysis of Variance Table
##
## Model 1: R ~ A + C
## Model 2: R ~ A * C
## Res.Df RSS Df Sum of Sq Pr(>Chi)
## 1 214 27.332
## 2 213 27.315 1 0.017343 0.7131
best.male.beak <- lm(wing_c ~ host_c + thorax_c, data=data_male)
tidy_regression(best.male.beak, is_color=output_col)
## lm wing_c ~ host_c + thorax_c data_male
## AIC: 181.7512
## (Intercept) coeff: 0.0120708 Pr(>|t|): 0.6649306
## host_c coeff: 0.0264581 Pr(>|t|): 0.34877
## thorax_c coeff: 2.3352031 Pr(>|t|): 1.492895e-49 *
plot(thorax ~ host_c, data=data_male)
plot(thorax ~ sym_dist, data=data_male)
gf_point(thorax_c ~ sym_dist, col=~host_c, data=data_male)
## Warning: Removed 1 rows containing missing values (geom_point).