Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
overview-DF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DOLPHINFREE experiments
overview-DF
Commits
80811c86
Commit
80811c86
authored
Aug 1, 2022
by
Loic-Lenof
Browse files
Options
Downloads
Patches
Plain Diff
Update READMES
parent
3f66d91f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CSV_data/README.md
+39
-0
39 additions, 0 deletions
CSV_data/README.md
Stats/.Rhistory
+316
-316
316 additions, 316 deletions
Stats/.Rhistory
Stats/BBP-click-whistles_3models.R
+10
-7
10 additions, 7 deletions
Stats/BBP-click-whistles_3models.R
Stats/README.md
+39
-0
39 additions, 0 deletions
Stats/README.md
with
404 additions
and
323 deletions
CSV_data/README
-Stats
.md
→
CSV_data/README.md
+
39
−
0
View file @
80811c86
This diff is collapsed.
Click to expand it.
Stats/.Rhistory
+
316
−
316
View file @
80811c86
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
beacon
)
numb_stats_b
%>%
ggplot
(
aes
(
x
=
number
,
y
=
mean
,
group
=
1
))
+
geom_errorbar
(
aes
(
x
=
number
,
ymin
=
mean
-
ic
,
ymax
=
mean
+
ic
),
color
=
"red"
,
width
=
.1
,
show.legend
=
FALSE
)
+
geom_point
()
+
geom_line
()
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
12
))
+
ylab
(
"Number of BBPs per min"
)
+
xlab
(
"Number of dolphins in group"
)
# Clicks
# Clicks
#KW test
numb_stats_c
<-
computeStats
(
acoustic.dta
,
number
,
number_of_clicks
)
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
beacon
)
numb_stats_c
[
is.na
(
numb_stats_c
)]
<-
0
#### : Beacon plots + KW analysis (letters not shown for lisibility) ####
numb_stats_c
$
number
<-
as.factor
(
numb_stats_c
$
number
)
# Whistles
numb_stats_c
%>%
#KW test
ggplot
(
aes
(
x
=
number
,
y
=
mean
,
group
=
1
))
+
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
geom_errorbar
(
aes
(
x
=
number
,
ymin
=
mean
-
ic
,
ymax
=
mean
+
ic
),
color
=
"red"
,
width
=
.1
)
+
geom_point
()
+
geom_line
()
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
12
))
+
ylab
(
"Mean number of clicks per min"
)
+
xlab
(
"Number of echolocation clicks in group"
)
#### Nets plots + KW analysis ####
#### Nets plots + KW analysis ####
# Whistles
# Whistles
#KW test
#KW test
...
@@ -16,9 +28,9 @@ kruskalmc(acoustic.dta$whistling_time_per_dolphin, acoustic.dta$net)
...
@@ -16,9 +28,9 @@ kruskalmc(acoustic.dta$whistling_time_per_dolphin, acoustic.dta$net)
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"a"
,
"ad"
,
"bd"
,
"cd"
,
"a"
))
letter
=
c
(
"a"
,
"ad"
,
"bd"
,
"cd"
,
"a"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
whistling_time_per_dolphin
/
375
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
whistling_time_per_dolphin
/
375
),
myletters_df
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
.6
,
xname
=
"Fishing nets"
,
height
=
.6
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
...
@@ -26,14 +38,14 @@ theme(axis.text.x=element_text(size=8.5))
...
@@ -26,14 +38,14 @@ theme(axis.text.x=element_text(size=8.5))
#KW test
#KW test
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
net
)
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
net
)
# p<0.05 so post-hoc
# p<0.05 so post-hoc
kruskalmc
(
acoustic.dta
$
BBPs_per_dolphin
,
acoustic.dta
$
net
,
)
kruskalmc
(
acoustic.dta
$
BBPs_per_dolphin
,
acoustic.dta
$
net
)
# DIY : letters
# DIY : letters
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"a"
,
"a"
,
"a"
,
"a"
,
"a"
))
letter
=
c
(
"a"
,
"a"
,
"a"
,
"a"
,
"a"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
BBPs_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
BBPs_per_dolphin
),
myletters_df
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
.8
,
xname
=
"Fishing nets"
,
height
=
.8
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
...
@@ -46,14 +58,113 @@ kruskalmc(acoustic.dta$clicks_per_dolphin, acoustic.dta$net)
...
@@ -46,14 +58,113 @@ kruskalmc(acoustic.dta$clicks_per_dolphin, acoustic.dta$net)
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"ae"
,
"ad"
,
"bd"
,
"cd"
,
"e"
))
letter
=
c
(
"ae"
,
"ad"
,
"bd"
,
"cd"
,
"e"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
clicks_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
clicks_per_dolphin
),
myletters_df
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
120
,
xname
=
"Fishing nets"
,
height
=
120
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
# p<0.05 so post-hoc
#### : Beacon plots + KW analysis (letters not shown for lisibility) ####
kruskalmc
(
acoustic.dta
$
clicks_per_dolphin
,
acoustic.dta
$
net
)
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letters
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
#### : Beacon plots + KW analysis (letters not shown for lisibility) ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letters
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
beacon
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)
names
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
))
factor
(
acoustic.dta
$
beacon
)
unique
(
acoustic.dta
$
beacon
)
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
#### : Beacon plots + KW analysis (letters not shown for readability) ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
names
,
new_names
=
names
,
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
names
=
list
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
])
names
names
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
names
unlist
(
names
)
#### Beacon plots + KW analysis (letters not shown for readability) ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
unlist
(
names
),
new_names
=
unlist
(
names
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
#### Beacon plots + KW analysis (letters not shown for readability) ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
unlist
(
names
),
new_names
=
unlist
(
names
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
# BBPs
#KW test
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
BBPs_per_dolphin
),
NULL
,
beacon
,
old_names
=
unlist
(
names
),
new_names
=
unlist
(
names
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.5
,
size
=
3
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
# Clicks
#KW test
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
clicks_per_dolphin
),
NULL
,
beacon
,
old_names
=
unlist
(
names
),
unlist
(
names
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
150
,
size
=
3
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
########################################################################
########################################################################
# STATISTICS
# STATISTICS
# Author : Loic LEHNHOFF
# Author : Loic LEHNHOFF
...
@@ -71,46 +182,32 @@ library(stringr) # "gsub" function
...
@@ -71,46 +182,32 @@ library(stringr) # "gsub" function
library
(
rcompanion
)
# "fullPTable" function
library
(
rcompanion
)
# "fullPTable" function
library
(
multcompView
)
# "multcompLetters" function
library
(
multcompView
)
# "multcompLetters" function
library
(
ggplot2
)
library
(
ggplot2
)
library
(
pgirmess
)
#library(tidyquant) # geom_ma() if rolling average needed
#library(tidyquant) # geom_ma() if rolling average needed
################# DATASET IMPORTS #####################################
################# DATASET IMPORTS #####################################
folder
<-
'./../'
folder
<-
'./../'
whistles.dta
<-
read.table
(
file
=
paste0
(
folder
,
'Whistles/Evaluation/whistles_durations.csv'
),
sep
=
','
,
header
=
TRUE
)
whistles.dta
<-
whistles.dta
[
order
(
whistles.dta
$
audio_names
),]
bbp.dta
<-
read.table
(
file
=
paste0
(
folder
,
bbp.dta
<-
read.table
(
file
=
paste0
(
folder
,
'BBPs/Results/16-06-22_14h00_number_of_BBP.csv'
),
'BBPs/Results/16-06-22_14h00_number_of_BBP.csv'
),
sep
=
','
,
header
=
TRUE
)
sep
=
','
,
header
=
TRUE
)
bbp.dta
<-
bbp.dta
[
order
(
bbp.dta
$
audio_names
),]
bbp.dta
<-
bbp.dta
[
order
(
bbp.dta
$
audio_names
),]
clicks.dta
<-
read.table
(
file
=
paste0
(
folder
,
'Clicks/Results/projection_updated_number_of_clicks_02052022.csv'
),
#number_of_clicks_02052022.csv
sep
=
','
,
header
=
TRUE
)
clicks.dta
<-
clicks.dta
[
order
(
clicks.dta
$
audio_names
),]
# Merge files into 1 dataset
acoustic.dta
<-
clicks.dta
acoustic.dta
$
number_of_bbp
<-
bbp.dta
$
number_of_BBP
acoustic.dta
$
total_whistles_duration
<-
whistles.dta
$
total_whistles_duration
rm
(
whistles.dta
,
bbp.dta
,
clicks.dta
)
# suppress "T" acoustic data (other groups not tested on our variables)
# suppress "T" acoustic data (other groups not tested on our variables)
acoustic.dta
<-
acoustic.dta
[
acoustic
.dta
$
acoustic
!=
"T"
,]
bbp.dta
<-
bbp.dta
[
bbp
.dta
$
acoustic
!=
"T"
,]
# shuffle dataframe
# shuffle dataframe
acoustic.dta
<-
acoustic
.dta
[
sample
(
1
:
nrow
(
acoustic
.dta
)),
]
bbp.dta
<-
bbp
.dta
[
sample
(
1
:
nrow
(
bbp
.dta
)),
]
acoustic
.dta
$
acoustic
<-
factor
(
acoustic
.dta
$
acoustic
)
bbp
.dta
$
acoustic
<-
factor
(
bbp
.dta
$
acoustic
)
#################### DATA INSPECTION #################################
#################### DATA INSPECTION #################################
# Data description
# Data description
names
(
acoustic
.dta
)
names
(
bbp
.dta
)
# self explenatory except acoustic : correspond to the activation sequence.
# self explenatory except acoustic : correspond to the activation sequence.
# Look for obvious correlations
# Look for obvious correlations
plot
(
acoustic
.dta
)
# nothing that we can see
plot
(
bbp
.dta
)
# nothing that we can see
# Look for zero-inflation
# Look for zero-inflation
100
*
sum
(
acoustic
.dta
$
number_of_
clicks
==
0
)
/
nrow
(
acoustic
.dta
)
100
*
sum
(
bbp
.dta
$
number_of_
BBP
==
0
)
/
nrow
(
bbp
.dta
)
100
*
sum
(
acoustic.dta
$
number_of_bbp
==
0
)
/
nrow
(
acoustic
.dta
)
100
*
sum
(
bbp.dta
$
Buzz
==
0
)
/
nrow
(
bbp
.dta
)
100
*
sum
(
acoustic.dta
$
total_whistles_duration
==
0
)
/
nrow
(
acoustic
.dta
)
100
*
sum
(
bbp.dta
$
Burst.pulse
==
0
)
/
nrow
(
bbp
.dta
)
# 3.
6
%,
53.7% & 24.7% of our data are zeros. Will have to be dealt with.
#
5
3.
7
%,
60.1% & 73.6% of data are zeroes
# QUESTION: This study is aimed at understanding if dolphin's acoustic activity
# QUESTION: This study is aimed at understanding if dolphin's acoustic activity
# is influenced bytheir behavior, the emission of a pinger or a fishing net.
# is influenced bytheir behavior, the emission of a pinger or a fishing net.
# Dependent variables (Y): number_of_
clicks, number_of_bbp, total_whistles_duration.
# Dependent variables (Y): number_of_
BBP, Buzz & Burst.pulse
# Explanatory variables (X): acoustic, fishing_net, behavior, beacon, net, number.
# Explanatory variables (X): acoustic, fishing_net, behavior, beacon, net, number.
# What are the H0/ H1 hypotheses ?
# What are the H0/ H1 hypotheses ?
# H0 : No influence of any of the explanatory variables on a dependant one.
# H0 : No influence of any of the explanatory variables on a dependant one.
...
@@ -118,47 +215,47 @@ plot(acoustic.dta) # nothing that we can see
...
@@ -118,47 +215,47 @@ plot(acoustic.dta) # nothing that we can see
##################### DATA EXPLORATION ################################
##################### DATA EXPLORATION ################################
# Y Outlier detection
# Y Outlier detection
par
(
mfrow
=
c
(
2
,
3
))
par
(
mfrow
=
c
(
2
,
3
))
boxplot
(
acoustic.dta
$
total_whistles_duration
,
col
=
'red'
,
boxplot
(
bbp.dta
$
number_of_BBP
,
col
=
'red'
,
ylab
=
'
total_whistles_duration
'
)
ylab
=
'
number_of_BBP
'
)
boxplot
(
acoustic.dta
$
number_of_bbp
,
col
=
'red'
,
boxplot
(
bbp.dta
$
Buzz
,
col
=
'red'
,
ylab
=
'
number_of_bbp
'
)
ylab
=
'
Buzz
'
)
boxplot
(
acoustic.dta
$
number_of_clicks
,
col
=
'red'
,
boxplot
(
bbp.dta
$
Burst.pulse
,
col
=
'red'
,
ylab
=
'
number_of_clicks
'
)
ylab
=
'
Burst.pulse
'
)
dotchart
(
acoustic.dta
$
total_whistles_duration
,
pch
=
16
,
dotchart
(
bbp.dta
$
number_of_BBP
,
pch
=
16
,
xlab
=
'
total_whistles_duration
'
,
col
=
'red'
)
xlab
=
'
number_of_BBP
'
,
col
=
'red'
)
dotchart
(
acoustic.dta
$
number_of_bbp
,
pch
=
16
,
dotchart
(
bbp.dta
$
Buzz
,
pch
=
16
,
xlab
=
'
number_of_bbp
'
,
col
=
'red'
)
xlab
=
'
Buzz
'
,
col
=
'red'
)
dotchart
(
acoustic.dta
$
number_of_clicks
,
pch
=
16
,
dotchart
(
bbp.dta
$
Burst.pulse
,
pch
=
16
,
xlab
=
'
number_of_clicks
'
,
col
=
'red'
)
xlab
=
'
Burst.pulse
'
,
col
=
'red'
)
# Y distribution
# Y distribution
par
(
mfrow
=
c
(
2
,
3
))
par
(
mfrow
=
c
(
2
,
3
))
hist
(
acoustic.dta
$
total_whistles_duration
,
col
=
'red'
,
breaks
=
8
,
hist
(
bbp.dta
$
number_of_BBP
,
col
=
'red'
,
breaks
=
8
,
xlab
=
'
total_whistles_duration
'
,
ylab
=
'number'
)
xlab
=
'
number_of_BBP
'
,
ylab
=
'number'
)
hist
(
acoustic.dta
$
number_of_bbp
,
col
=
'red'
,
breaks
=
8
,
hist
(
bbp.dta
$
Buzz
,
col
=
'red'
,
breaks
=
8
,
xlab
=
'
number_of_bbp
'
,
ylab
=
'number'
)
xlab
=
'
Buzz
'
,
ylab
=
'number'
)
hist
(
acoustic.dta
$
number_of_clicks
,
col
=
'red'
,
breaks
=
8
,
hist
(
bbp.dta
$
Burst.pulse
,
col
=
'red'
,
breaks
=
8
,
xlab
=
'
number_of_clicks
'
,
ylab
=
'number'
)
xlab
=
'
Burst.pulse
'
,
ylab
=
'number'
)
qqnorm
(
acoustic.dta
$
total_whistles_duration
,
col
=
'red'
,
pch
=
16
)
qqnorm
(
bbp.dta
$
number_of_BBP
,
col
=
'red'
,
pch
=
16
)
qqline
(
acoustic.dta
$
total_whistles_duration
)
qqline
(
bbp.dta
$
number_of_BBP
)
qqnorm
(
acoustic.dta
$
number_of_bbp
,
col
=
'red'
,
pch
=
16
)
qqnorm
(
bbp.dta
$
Buzz
,
col
=
'red'
,
pch
=
16
)
qqline
(
acoustic.dta
$
number_of_bbp
)
qqline
(
bbp.dta
$
Buzz
)
qqnorm
(
acoustic.dta
$
number_of_clicks
,
col
=
'red'
,
pch
=
16
)
qqnorm
(
bbp.dta
$
Burst.pulse
,
col
=
'red'
,
pch
=
16
)
qqline
(
acoustic.dta
$
number_of_clicks
)
qqline
(
bbp.dta
$
Burst.pulse
)
shapiro.test
(
acoustic.dta
$
total_whistles_duration
)
shapiro.test
(
bbp.dta
$
number_of_BBP
)
shapiro.test
(
acoustic.dta
$
number_of_bbp
)
shapiro.test
(
bbp.dta
$
Buzz
)
shapiro.test
(
acoustic.dta
$
number_of_clicks
)
shapiro.test
(
bbp.dta
$
Burst.pulse
)
# p-values are significant => they do not follow normal distributions
# p-values are significant => they do not follow normal distributions
# will need
a
transformation or the use of
a
glm model
#
we
will need transformation
s
or the use of glm model
s
# X Number of individuals per level
# X Number of individuals per level
summary
(
factor
(
acoustic
.dta
$
acoustic
))
summary
(
factor
(
bbp
.dta
$
acoustic
))
summary
(
factor
(
acoustic
.dta
$
fishing_net
))
summary
(
factor
(
bbp
.dta
$
fishing_net
))
summary
(
factor
(
acoustic
.dta
$
behavior
))
summary
(
factor
(
bbp
.dta
$
behavior
))
summary
(
factor
(
acoustic
.dta
$
beacon
))
summary
(
factor
(
bbp
.dta
$
beacon
))
summary
(
factor
(
acoustic
.dta
$
net
))
summary
(
factor
(
bbp
.dta
$
net
))
table
(
factor
(
acoustic
.dta
$
acoustic
),
factor
(
acoustic
.dta
$
fishing_net
))
table
(
factor
(
bbp
.dta
$
acoustic
),
factor
(
bbp
.dta
$
fishing_net
))
table
(
factor
(
acoustic
.dta
$
acoustic
),
factor
(
acoustic
.dta
$
behavior
))
table
(
factor
(
bbp
.dta
$
acoustic
),
factor
(
bbp
.dta
$
behavior
))
table
(
factor
(
acoustic
.dta
$
behavior
),
factor
(
acoustic
.dta
$
acoustic
))
table
(
factor
(
bbp
.dta
$
behavior
),
factor
(
bbp
.dta
$
acoustic
))
ftable
(
factor
(
acoustic
.dta
$
fishing_net
),
factor
(
acoustic
.dta
$
behavior
),
factor
(
acoustic
.dta
$
acoustic
))
ftable
(
factor
(
bbp
.dta
$
fishing_net
),
factor
(
bbp
.dta
$
behavior
),
factor
(
bbp
.dta
$
acoustic
))
# => unbalanced, no big deal but will need more work (no orthogonality):
# => unbalanced, no big deal but will need more work (no orthogonality):
# Effects can depend on the order of the variables
# Effects can depend on the order of the variables
# => Beacon and net have modalities with <10 individuals => analysis impossible
# => Beacon and net have modalities with <10 individuals => analysis impossible
...
@@ -176,54 +273,45 @@ ftable(factor(acoustic.dta$fishing_net), factor(acoustic.dta$behavior), factor(a
...
@@ -176,54 +273,45 @@ ftable(factor(acoustic.dta$fishing_net), factor(acoustic.dta$behavior), factor(a
# (using kruskall-Wallis non-parametric test)
# (using kruskall-Wallis non-parametric test)
# fishing_net, behavior and acoustic where tested with their interactions.
# fishing_net, behavior and acoustic where tested with their interactions.
# If a variable is it in a model, it is because it had no significant effect.
# If a variable is it in a model, it is because it had no significant effect.
par
(
mfrow
=
c
(
1
,
1
))
### Model for whistles
# Residual hypotheses not verified for LM
# Overdipsersion when using GLM (negative binomial)
# Using ZINB:
zero.whi
<-
zeroinfl
(
total_whistles_duration
~
acoustic
+
fishing_net
+
behavior
+
offset
(
log
(
number
)),
data
=
acoustic.dta
,
dist
=
'negbin'
)
nb.whi
<-
glm.nb
(
total_whistles_duration
~
acoustic
+
fishing_net
+
behavior
+
offset
(
log
(
number
)),
data
=
acoustic.dta
)
# comparison ZINB VS NB model
vuong
(
zero.whi
,
nb.whi
)
#(if p-value<0.05 then first model in comparison is better)
mod.whi
<-
zero.whi
# => zeroinflated model is indeed better suited
car
::
Anova
(
mod.whi
,
type
=
3
)
shapiro.test
(
residuals
(
mod.whi
))
# H0 : normality -> not rejected if p>0.05
dwtest
(
mod.whi
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
bptest
(
mod.whi
)
# H0 -> homoscedasticity if p<0.05
# No normality but we do not need it
### Model for BBP
### Model for BBP
# No normality of residuals for LM
# No normality of residuals for LM
# overdispersion with GLM quasipoisson
# overdispersion with GLM quasipoisson
#try with glm NB:
#try with glm NB:
mod.bbp
<-
glm.nb
(
number_of_
bbp
~
acoustic
+
fishing_net
+
behavior
mod.bbp
<-
glm.nb
(
number_of_
BBP
~
acoustic
+
fishing_net
+
behavior
+
offset
(
log
(
number
)),
+
offset
(
log
(
number
)),
data
=
acoustic
.dta
)
data
=
bbp
.dta
)
car
::
Anova
(
mod.bbp
,
type
=
3
)
car
::
Anova
(
mod.bbp
,
type
=
3
)
dwtest
(
mod.bbp
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
dwtest
(
mod.bbp
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
bptest
(
mod.bbp
)
# H0 -> homoscedasticity if p<0.05
bptest
(
mod.bbp
)
# H0 -> homoscedasticity if p<0.05
# Normality not needed in GLM, hypotheses verified !
# Normality not needed in GLM, hypotheses verified !
mod.bbp
$
deviance
/
mod.bbp
$
df.residual
mod.bbp
$
deviance
/
mod.bbp
$
df.residual
# slight underdispersion, not improved with ZINB so we keep this
# slight underdispersion
### Model for clicks
### Model for Buzzes
# Using NB model:
# No normality of residuals for LM
mod.cli
<-
glm.nb
(
number_of_clicks
~
acoustic
+
fishing_net
+
acoustic
:
fishing_net
+
offset
(
log
(
number
)),
# overdispersion with GLM quasipoisson
data
=
acoustic.dta
)
# underdispersion with glm NB
car
::
Anova
(
mod.cli
,
type
=
3
)
# Try with ZINB:
shapiro.test
(
residuals
(
mod.cli
))
# H0 : normality -> cannot be rejected if p > 0.05
mod.buzz
<-
glm.nb
(
Buzz
~
behavior
+
fishing_net
+
acoustic
dwtest
(
mod.cli
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
+
offset
(
log
(
number
)),
bptest
(
mod.cli
)
# H0 -> homoscedasticity if p<0.05
data
=
bbp.dta
)
# Normality not needed in GLM, hypotheses verified !
car
::
Anova
(
mod.buzz
,
type
=
3
)
mod.cli
$
deviance
/
mod.cli
$
df.residual
dwtest
(
mod.buzz
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
# slight overdispersion. (ZINB does not clearly improve results so we keep this)
bptest
(
mod.buzz
)
# H0 -> homoscedasticity if p<0.05
# FYI1: Comparison of combination of explanatory variables between models
mod.buzz
$
df.null
/
mod.buzz
$
df.residual
# were compared based on BIC criterion.
# No overdispersion
# The model with the lowest BIC was kept (and is the one shown)
### Model for Burst-pulses
# FYI2: log(number of dolphin per group) does have an effect on data but we have
# No normality of residuals for LM
# no interest in investigating it, that is why we use it as an offset.
# overdispersion with quasipoisson
# underdispersion with NB
# ZINB is working :
mod.burst.pulse
<-
zeroinfl
(
Burst.pulse
~
fishing_net
+
acoustic
+
behavior
+
offset
(
log
(
number
)),
dist
=
"negbin"
,
data
=
bbp.dta
)
car
::
Anova
(
mod.burst.pulse
,
type
=
3
)
dwtest
(
mod.burst.pulse
)
# H0 -> independent if p>0.05 (autocorrelation if p<0.05)
bptest
(
mod.burst.pulse
)
# H0 -> homoscedasticity if p<0.05
mod.burst.pulse
$
df.null
/
mod.burst.pulse
$
df.residual
# -> Overdispersion of != 1
# no overdispersion
##################### Boxplots and comparisons #####################
##################### Boxplots and comparisons #####################
### Functions to compute stats
### Functions to compute stats
computeLetters
<-
function
(
temp
,
category
)
{
computeLetters
<-
function
(
temp
,
category
)
{
...
@@ -251,10 +339,10 @@ height, xname="", colours="black", legend_title="", legend_labs="",ytitle=""){
...
@@ -251,10 +339,10 @@ height, xname="", colours="black", legend_title="", legend_labs="",ytitle=""){
if
(
!
is.null
(
signif
)){
colnames
(
signif
)[
1
]
<-
"use"
}
if
(
!
is.null
(
signif
)){
colnames
(
signif
)[
1
]
<-
"use"
}
dta
%>%
dta
%>%
mutate
(
use
=
fct_relevel
({{
category
}},
old_names
))
%>%
mutate
(
use
=
fct_relevel
({{
category
}},
old_names
))
%>%
ggplot
(
aes
(
x
=
use
,
y
=
mean
,
group
=
{{
fill
}},
fill
=
{{
fill
}},
color
=
{{
fill
}}))
+
ggplot
(
aes
(
x
=
use
,
y
=
mean
,
group
=
{{
fill
}},
fill
=
{{
fill
}},
color
=
{{
fill
}}
,
na.rm
=
TRUE
))
+
{
if
(
length
(
colours
)
==
1
)
geom_point
(
color
=
colours
,
position
=
position_dodge
(
.5
))}
+
{
if
(
length
(
colours
)
==
1
)
geom_point
(
color
=
colours
,
position
=
position_dodge
(
.5
))}
+
{
if
(
length
(
colours
)
=
=
2
)
geom_point
(
position
=
position_dodge
(
.5
),
show.legend
=
FALSE
)}
+
{
if
(
length
(
colours
)
>
=
2
)
geom_point
(
position
=
position_dodge
(
.5
),
show.legend
=
FALSE
)}
+
{
if
(
length
(
colours
)
=
=
2
)
scale_color_manual
(
values
=
colours
,
name
=
legend_title
,
labels
=
legend_labs
)}
+
{
if
(
length
(
colours
)
>
=
2
)
scale_color_manual
(
values
=
colours
,
name
=
legend_title
,
labels
=
legend_labs
)}
+
scale_x_discrete
(
breaks
=
old_names
,
scale_x_discrete
(
breaks
=
old_names
,
labels
=
new_names
)
+
labels
=
new_names
)
+
ylab
(
ytitle
)
+
ylab
(
ytitle
)
+
...
@@ -266,247 +354,159 @@ geom_errorbar(aes(x=use, ymin=mean-ic, ymax=mean+ic), position=position_dodge(.5
...
@@ -266,247 +354,159 @@ geom_errorbar(aes(x=use, ymin=mean-ic, ymax=mean+ic), position=position_dodge(.5
}
}
####Introducing variables averaged per dolphins ####
####Introducing variables averaged per dolphins ####
# since we introduced an offset, variables can be divided by the number of dolphins
# since we introduced an offset, variables can be divided by the number of dolphins
acoustic.dta
$
whistling_time_per_dolphin
<-
acoustic.dta
$
total_whistles_duration
/
acoustic.dta
$
number
bbp.dta
$
BBPs_per_dolphin
<-
bbp.dta
$
number_of_BBP
/
bbp.dta
$
number
acoustic.dta
$
BBPs_per_dolphin
<-
acoustic.dta
$
number_of_bbp
/
acoustic.dta
$
number
bbp.dta
$
Buzz_per_dolphin
<-
bbp.dta
$
Buzz
/
bbp.dta
$
number
acoustic.dta
$
clicks_per_dolphin
<-
acoustic.dta
$
number_of_clicks
/
acoustic.dta
$
number
bbp.dta
$
Burst.pulse_per_dolphin
<-
bbp.dta
$
Burst.pulse
/
bbp.dta
$
number
#### Fishing net ####
#### Fishing nets plots ####
# whistles
par
(
mfrow
=
c
(
3
,
1
))
table
<-
cld
(
emmeans
(
mod.whi
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
# BBPs
table
<-
cld
(
emmeans
(
mod.bbp
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
letter
=
trimws
(
table
$
.group
))
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
whistling_time_per_dolphin
/
375
),
# 375 bins = 1 sec
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
BBPs_per_dolphin
),
myletters_df
,
fishing_net
,
myletters_df
,
fishing_net
,
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
xname
=
"Presence/Asence of fishing net"
,
height
=
.
5
,
xname
=
"Presence/Asence of fishing net"
,
height
=
.
6
,
ytitle
=
"Mean
whistling time
per dolphin per min"
)
ytitle
=
"Mean
number of BBP
per dolphin per min"
)
# B
BP
# B
uzz
table
<-
cld
(
emmeans
(
mod.b
bp
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
table
<-
cld
(
emmeans
(
mod.b
uzz
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
letter
=
trimws
(
table
$
.group
))
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
B
BPs
_per_dolphin
),
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
B
uzz
_per_dolphin
),
myletters_df
,
fishing_net
,
myletters_df
,
fishing_net
,
ytitle
=
"Mean number of Buzzes per dolphin per min"
,
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
xname
=
"Presence/Asence of fishing net"
,
height
=
.6
,
xname
=
"Presence/Asence of fishing net"
,
height
=
.45
)
ytitle
=
"Mean number of BBPs per dolphin per min"
)
# Burst-pulse
# Clicks
table
<-
cld
(
emmeans
(
mod.burst.pulse
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
table
<-
cld
(
emmeans
(
mod.cli
,
pairwise
~
fishing_net
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
myletters_df
<-
data.frame
(
fishing_net
=
table
$
fishing_net
,
letter
=
trimws
(
table
$
.group
))
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
clicks
_per_dolphin
),
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
Burst.pulse
_per_dolphin
),
myletters_df
,
fishing_net
,
myletters_df
,
fishing_net
,
ytitle
=
"Mean number of Burst-pulses per dolphin per min"
,
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
old_names
=
c
(
"SSF"
,
"F"
),
new_names
=
c
(
"Absent"
,
"Present"
),
xname
=
"Presence/Asence of fishing net"
,
height
=
100
,
xname
=
"Presence/Asence of fishing net"
,
height
=
.18
,
)
ytitle
=
"Mean number of clicks per dolphin per min"
)
#### Acoustic plots ####
#### Acoustic plots ####
# Whistles
# BBPs
table
<-
cld
(
emmeans
(
mod.whi
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
table
<-
cld
(
emmeans
(
mod.bbp
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
letter
=
trimws
(
table
$
.group
))
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
barPlot
(
computeStats
(
acoustic.dta
,
acoustic
,
whistling_time_per_dolphin
/
375
),
letter
=
trimws
(
table
$
.group
))
myletters_df
,
acoustic
,
height
=
0.65
,
ytitle
=
"Mean whistling time per dolphin per min"
,
barPlot
(
computeStats
(
bbp.dta
,
acoustic
,
BBPs_per_dolphin
),
myletters_df
,
acoustic
,
height
=
.9
,
ytitle
=
"Mean number of BBPs per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
)
xname
=
"Activation sequence"
)
# BBPs
# Buzz
table
<-
cld
(
emmeans
(
mod.bbp
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
table
<-
cld
(
emmeans
(
mod.buzz
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
letter
=
trimws
(
table
$
.group
))
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
barPlot
(
computeStats
(
acoustic.dta
,
acoustic
,
BBPs_per_dolphin
),
letter
=
trimws
(
table
$
.group
))
myletters_df
<-
data.frame
(
acoustic
=
c
(
"AP"
,
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
),
letter
=
c
(
"a"
,
"a"
,
"a"
,
"a"
,
"a"
))
myletters_df
,
acoustic
,
height
=
1.2
,
ytitle
=
"Mean number of BBPs per dolphin per min"
,
#error, no acoustic in model:
myletters_df
<-
data.frame
(
acoustic
=
c
(
"AP"
,
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
),
letter
=
c
(
"a"
,
"a"
,
"a"
,
"a"
,
"a"
))
barPlot
(
computeStats
(
bbp.dta
,
acoustic
,
Buzz_per_dolphin
),
myletters_df
,
acoustic
,
height
=
0.45
,
ytitle
=
"Mean number of Buzzes per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
)
xname
=
"Activation sequence"
)
# Clicks
# Burst-pulse
table
<-
cld
(
emmeans
(
mod.cli
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
table
<-
cld
(
emmeans
(
mod.burst.pulse
,
pairwise
~
acoustic
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
letter
=
trimws
(
table
$
.group
))
myletters_df
<-
data.frame
(
acoustic
=
table
$
acoustic
,
barPlot
(
computeStats
(
acoustic.dta
,
acoustic
,
clicks_per_dolphin
),
letter
=
trimws
(
table
$
.group
))
myletters_df
,
acoustic
,
height
=
155
,
ytitle
=
"Mean number of clicks per dolphin per min"
,
barPlot
(
computeStats
(
bbp.dta
,
acoustic
,
Burst.pulse_per_dolphin
),
myletters_df
,
acoustic
,
height
=
0.5
,
ytitle
=
"Mean number of Burst-pulses per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
)
xname
=
"Activation sequence"
)
#### Interaction fishing_net:acoustic plots ####
#### Behaviour plots ####
# Whistles
# BBPs
letters_df
<-
computeLetters
(
emmeans
(
mod.whi
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
table
<-
cld
(
emmeans
(
mod.bbp
,
pairwise
~
behavior
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
behavior
,
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
BBPs_per_dolphin
),
myletters_df
,
behavior
,
height
=
1.2
,
ytitle
=
"Mean number of BBPs per dolphin per min"
,
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
xname
=
"Behaviours of dolphins"
)
# Buzz
table
<-
cld
(
emmeans
(
mod.buzz
,
pairwise
~
behavior
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
behavior
,
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
Buzz_per_dolphin
),
myletters_df
,
behavior
,
height
=
1
,
ytitle
=
"Mean number of Buzzes per dolphin per min"
,
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
xname
=
"Behaviours of dolphins"
)
# Burst-pulse
table
<-
cld
(
emmeans
(
mod.burst.pulse
,
pairwise
~
behavior
,
adjust
=
"tukey"
),
Letters
=
letters
)
myletters_df
<-
data.frame
(
acoustic
=
table
$
behavior
,
letter
=
trimws
(
table
$
.group
))
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
Burst.pulse_per_dolphin
),
myletters_df
,
behavior
,
height
=
0.4
,
ytitle
=
"Mean number of Burst-pulses per dolphin per min"
,
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
xname
=
"Behaviours of dolphins"
)
#### Interaction : acoustic:fishing_net plots ####
# BBP
letters_df
<-
computeLetters
(
emmeans
(
mod.bbp
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"fishing_net"
)
"fishing_net"
)
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.
whi
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.
bbp
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"acoustic"
)
$
acoustic
"acoustic"
)
$
acoustic
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
whistling_time
_per_dolphin
/
375
,
two
=
acoustic
),
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
BBPs
_per_dolphin
,
two
=
acoustic
),
NULL
,
acoustic
,
fill
=
fishing_net
,
NULL
,
acoustic
,
fill
=
fishing_net
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean
whistling time
per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean
number of BBPs
per dolphin per min"
,
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
,
height
=
c
(
.95
,
.95
,
.95
,
1
,
.95
,
1
,
.95
,
1
,
1
,
1
),
xname
=
"Activation sequence"
,
height
=
c
(
1.6
),
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
# B
BPs
# B
uzz
letters_df
<-
computeLetters
(
emmeans
(
mod.b
bp
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
letters_df
<-
computeLetters
(
emmeans
(
mod.b
uzz
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"fishing_net"
)
"fishing_net"
)
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.b
bp
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.b
uzz
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"acoustic"
)
$
acoustic
"acoustic"
)
$
acoustic
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
B
BPs
_per_dolphin
,
two
=
acoustic
),
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
B
uzz
_per_dolphin
,
two
=
acoustic
),
NULL
,
acoustic
,
fill
=
fishing_net
,
NULL
,
acoustic
,
fill
=
fishing_net
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of B
BP
s per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of B
uzze
s per dolphin per min"
,
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
,
height
=
c
(
1.65
,
1.65
,
1.72
,
1.65
,
1.72
,
1.65
,
1.65
,
1.72
,
1.72
,
1.72
),
xname
=
"Activation sequence"
,
height
=
c
(
0.77
,
0.77
,
0.8
,
0.77
,
0.77
,
0.8
,
0.77
,
0.8
,
0.8
,
0.8
),
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
#
Clicks
#
Burst-pulse
letters_df
<-
computeLetters
(
emmeans
(
mod.
cli
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
letters_df
<-
computeLetters
(
emmeans
(
mod.
burst.pulse
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"fishing_net"
)
"fishing_net"
)
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.
cli
,
pairwise
~
fishing_net
:
acoustic
,
adjust
=
"tukey"
),
letters_df
$
acoustic
<-
computeLetters
(
emmeans
(
mod.
burst.pulse
,
pairwise
~
acoustic
:
fishing_net
,
adjust
=
"tukey"
),
"acoustic"
)
$
acoustic
"acoustic"
)
$
acoustic
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
<-
letters_df
[,
c
(
"acoustic"
,
"fishing_net"
,
"letter"
)]
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
letters_df
$
letter
<-
gsub
(
" "
,
""
,
letters_df
$
letter
)
barPlot
(
computeStats
(
acoustic
.dta
,
fishing_net
,
clicks
_per_dolphin
,
two
=
acoustic
),
barPlot
(
computeStats
(
bbp
.dta
,
fishing_net
,
Burst.pulse
_per_dolphin
,
two
=
acoustic
),
NULL
,
acoustic
,
fill
=
fishing_net
,
NULL
,
acoustic
,
fill
=
fishing_net
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of
click
s per dolphin per min"
,
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of
Burst-pulse
s per dolphin per min"
,
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
xname
=
"Activation sequence"
,
height
=
c
(
180
,
180
,
187
,
187
,
180
,
187
,
180
,
180
,
187
,
187
),
xname
=
"Activation sequence"
,
height
=
c
(
0.9
,
0.85
,
0.9
,
0.9
,
0.85
,
0.9
,
0.85
,
0.9
,
0.85
,
0.85
),
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
colours
=
c
(
"#E69F00"
,
"#999999"
),
size
=
5
,
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
legend_title
=
"Fishing net"
,
legend_labs
=
c
(
"Present"
,
"Absent"
))
#### Behaviour plots ####
#### Interaction : acoustic:behavior plots ####
# Whistles
# BBP
table
<-
cld
(
emmeans
(
mod.whi
,
pairwise
~
behavior
,
adjust
=
"tukey"
),
Letters
=
letters
)
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
BBPs_per_dolphin
,
two
=
acoustic
),
myletters_df
<-
data.frame
(
behavior
=
table
$
behavior
,
letter
=
trimws
(
table
$
.group
))
NULL
,
acoustic
,
fill
=
behavior
,
barPlot
(
computeStats
(
acoustic.dta
,
behavior
,
whistling_time_per_dolphin
/
375
),
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of BBPs per dolphin per min"
,
myletters_df
,
behavior
,
height
=
0.75
,
ytitle
=
"Mean whistling time per dolphin per min"
,
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
xname
=
"Activation sequence"
,
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
colours
=
c
(
"#E69F00"
,
"#55c041"
,
"#FF3814"
),
size
=
5
,
xname
=
"Behaviours of dolphins"
)
legend_title
=
"Behaviour"
,
legend_labs
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
))
# BBPs
# Buzz
# real effect measured in model
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
Buzz_per_dolphin
,
two
=
acoustic
),
table
<-
cld
(
emmeans
(
mod.bbp
,
pairwise
~
behavior
,
adjust
=
"tukey"
),
Letters
=
letters
)
NULL
,
acoustic
,
fill
=
behavior
,
myletters_df
<-
data.frame
(
acoustic
=
table
$
behavior
,
letter
=
trimws
(
table
$
.group
))
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of Buzzes per dolphin per min"
,
barPlot
(
computeStats
(
acoustic.dta
,
behavior
,
BBPs_per_dolphin
),
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
myletters_df
,
behavior
,
height
=
1.2
,
ytitle
=
"Mean number of BBPs per dolphin per min"
,
xname
=
"Activation sequence"
,
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
colours
=
c
(
"#E69F00"
,
"#55c041"
,
"#FF3814"
),
size
=
5
,
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
legend_title
=
"Behaviour"
,
legend_labs
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
))
xname
=
"Behaviours of dolphins"
)
# Burst-pulse
# Clicks
barPlot
(
computeStats
(
bbp.dta
,
behavior
,
Burst.pulse_per_dolphin
,
two
=
acoustic
),
# no significant effect in click statistical model so all the same letters
NULL
,
acoustic
,
fill
=
behavior
,
myletters_df
<-
data.frame
(
behavior
=
unique
(
acoustic.dta
$
behavior
),
old_names
=
c
(
"AV"
,
"AV+D"
,
"D"
,
"D+AP"
,
"AP"
),
ytitle
=
"Mean number of Burst-pulses per dolphin per min"
,
letter
=
rep
(
"a"
,
length
(
unique
(
acoustic.dta
$
behavior
))))
new_names
=
c
(
"BEF"
,
"BEF+DUR"
,
"DUR"
,
"DUR+AFT"
,
"AFT"
),
barPlot
(
computeStats
(
acoustic.dta
,
behavior
,
clicks_per_dolphin
),
xname
=
"Activation sequence"
,
myletters_df
,
colours
=
c
(
"#E69F00"
,
"#55c041"
,
"#FF3814"
),
size
=
5
,
behavior
,
old_names
=
c
(
"CHAS"
,
"DEPL"
,
"SOCI"
),
legend_title
=
"Behaviour"
,
legend_labs
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
))
new_names
=
c
(
"Foraging"
,
"Travelling"
,
"Socialising"
),
xname
=
"Behaviours of dolphins"
,
height
=
150
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
#### Nets plots + KW analysis ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
net
)
# p<0.05 so post-hoc
kruskalmc
(
acoustic.dta
$
whistling_time_per_dolphin
,
acoustic.dta
$
net
)
# DIY : letters
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"a"
,
"ad"
,
"bd"
,
"cd"
,
"a"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
whistling_time_per_dolphin
/
375
),
myletters_df
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"Gill net"
,
"Long gill net"
),
xname
=
"Fishing nets"
,
height
=
.6
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
# BBPs
#KW test
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
net
)
# p<0.05 so post-hoc
kruskalmc
(
acoustic.dta
$
BBPs_per_dolphin
,
acoustic.dta
$
net
,)
# DIY : letters
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"a"
,
"a"
,
"a"
,
"a"
,
"a"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
BBPs_per_dolphin
),
myletters_df
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"Gill net"
,
"Long gill net"
),
xname
=
"Fishing nets"
,
height
=
.8
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
# Clicks
#KW test
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
net
)
# p<0.05 so post-hoc
kruskalmc
(
acoustic.dta
$
clicks_per_dolphin
,
acoustic.dta
$
net
)
# DIY : letters
myletters_df
<-
data.frame
(
net
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
letter
=
c
(
"ae"
,
"ad"
,
"bd"
,
"cd"
,
"e"
))
barPlot
(
computeStats
(
acoustic.dta
,
net
,
clicks_per_dolphin
),
myletters_df
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"Gill net"
,
"Long gill net"
),
xname
=
"Fishing nets"
,
height
=
120
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
#### : Beacon plots + KW analysis (letters not shown for lisibility) ####
# Whistles
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letters
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
# NC stands for "Unknown". Corresponding to categories where the beacon was not turned on yet ('BEF')
# BBPs
#KW test
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
beacon
)
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
BBPs_per_dolphin
),
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letters
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.5
,
size
=
3
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
# NC stands for "Unknown". Corresponding to categories where the beacon was not turned on yet ('BEF')
# Clicks
#KW test
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
beacon
)
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
clicks_per_dolphin
),
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letters
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
150
,
size
=
3
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
scale_x_discrete
(
guide
=
guide_axis
(
n.dodge
=
2
))
# NC stands for "Unknown". Corresponding to categories where the beacon was not turned on yet ('BEF')
#### WHY NOT: Number plots ####
# Whistles
numb_stats_w
<-
computeStats
(
acoustic.dta
,
number
,
total_whistles_duration
/
375
)
numb_stats_w
[
is.na
(
numb_stats_w
)]
<-
0
numb_stats_w
$
number
<-
as.factor
(
numb_stats_w
$
number
)
numb_stats_w
%>%
ggplot
(
aes
(
x
=
number
,
y
=
mean
,
group
=
1
))
+
geom_errorbar
(
aes
(
x
=
number
,
ymin
=
mean
-
ic
,
ymax
=
mean
+
ic
),
color
=
"red"
,
width
=
.1
,
show.legend
=
FALSE
)
+
geom_point
()
+
geom_line
()
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
12
))
+
ylab
(
"Mean whistling time per min"
)
+
xlab
(
"Number of dolphins in group"
)
# BBPs
numb_stats_b
<-
computeStats
(
acoustic.dta
,
number
,
number_of_bbp
)
numb_stats_b
[
is.na
(
numb_stats_b
)]
<-
0
numb_stats_b
$
number
<-
as.factor
(
numb_stats_b
$
number
)
numb_stats_b
%>%
ggplot
(
aes
(
x
=
number
,
y
=
mean
,
group
=
1
))
+
geom_errorbar
(
aes
(
x
=
number
,
ymin
=
mean
-
ic
,
ymax
=
mean
+
ic
),
color
=
"red"
,
width
=
.1
,
show.legend
=
FALSE
)
+
geom_point
()
+
geom_line
()
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
12
))
+
ylab
(
"Number of BBPs per min"
)
+
xlab
(
"Number of dolphins in group"
)
# Clicks
numb_stats_c
<-
computeStats
(
acoustic.dta
,
number
,
number_of_clicks
)
numb_stats_c
[
is.na
(
numb_stats_c
)]
<-
0
numb_stats_c
$
number
<-
as.factor
(
numb_stats_c
$
number
)
numb_stats_c
%>%
ggplot
(
aes
(
x
=
number
,
y
=
mean
,
group
=
1
))
+
geom_errorbar
(
aes
(
x
=
number
,
ymin
=
mean
-
ic
,
ymax
=
mean
+
ic
),
color
=
"red"
,
width
=
.1
)
+
geom_point
()
+
geom_line
()
+
theme_classic
()
+
theme
(
text
=
element_text
(
size
=
12
))
+
ylab
(
"Mean number of clicks per min"
)
+
xlab
(
"Number of echolocation clicks in group"
)
This diff is collapsed.
Click to expand it.
Stats/BBP-click-whistles_3models.R
+
10
−
7
View file @
80811c86
...
@@ -399,7 +399,7 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
...
@@ -399,7 +399,7 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
barPlot
(
computeStats
(
acoustic.dta
,
net
,
whistling_time_per_dolphin
/
375
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
whistling_time_per_dolphin
/
375
),
NULL
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
.6
,
xname
=
"Fishing nets"
,
height
=
.6
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
...
@@ -415,7 +415,7 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
...
@@ -415,7 +415,7 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
barPlot
(
computeStats
(
acoustic.dta
,
net
,
BBPs_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
BBPs_per_dolphin
),
NULL
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
.8
,
xname
=
"Fishing nets"
,
height
=
.8
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
...
@@ -431,19 +431,20 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
...
@@ -431,19 +431,20 @@ myletters_df <- data.frame(net=c("SSF", "chalut_blanc", "chalut_vert", "tremail"
barPlot
(
computeStats
(
acoustic.dta
,
net
,
clicks_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
net
,
clicks_per_dolphin
),
NULL
,
NULL
,
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
net
,
old_names
=
c
(
"SSF"
,
"chalut_blanc"
,
"chalut_vert"
,
"tremail"
,
"grand_filet"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
G
ill net"
,
"Long gill net"
),
new_names
=
c
(
"Absent"
,
"Nylon trawl net"
,
"PE trawl net"
,
"
Nylon g
ill net"
,
"Long
nylon
gill net"
),
xname
=
"Fishing nets"
,
height
=
120
,
xname
=
"Fishing nets"
,
height
=
120
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
theme
(
axis.text.x
=
element_text
(
size
=
8.5
))
####
:
Beacon plots + KW analysis (letters not shown for
lisi
bility) ####
#### Beacon plots + KW analysis (letters not shown for
reada
bility) ####
# Whistles
# Whistles
#KW test
#KW test
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
kruskal.test
(
acoustic.dta
$
whistling_time_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
),
NULL
,
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letter
s
),
beacon
,
old_names
=
unlist
(
names
),
new_names
=
unlist
(
name
s
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.9
,
size
=
3
,
ytitle
=
"Mean whistling time per dolphin per min"
)
+
ytitle
=
"Mean whistling time per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
...
@@ -453,9 +454,10 @@ barPlot(computeStats(acoustic.dta, beacon, whistling_time_per_dolphin/375),
...
@@ -453,9 +454,10 @@ barPlot(computeStats(acoustic.dta, beacon, whistling_time_per_dolphin/375),
# BBPs
# BBPs
#KW test
#KW test
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
beacon
)
kruskal.test
(
acoustic.dta
$
BBPs_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
BBPs_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
BBPs_per_dolphin
),
NULL
,
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letter
s
),
beacon
,
old_names
=
unlist
(
names
),
new_names
=
unlist
(
name
s
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.5
,
size
=
3
,
xname
=
"Signals from bio-inspired beacon"
,
height
=
0.5
,
size
=
3
,
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
ytitle
=
"Mean number of BBPs per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
...
@@ -465,9 +467,10 @@ barPlot(computeStats(acoustic.dta, beacon, BBPs_per_dolphin),
...
@@ -465,9 +467,10 @@ barPlot(computeStats(acoustic.dta, beacon, BBPs_per_dolphin),
# Clicks
# Clicks
#KW test
#KW test
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
beacon
)
kruskal.test
(
acoustic.dta
$
clicks_per_dolphin
~
acoustic.dta
$
beacon
)
names
=
computeStats
(
acoustic.dta
,
beacon
,
whistling_time_per_dolphin
/
375
)[
"beacon"
]
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
clicks_per_dolphin
),
barPlot
(
computeStats
(
acoustic.dta
,
beacon
,
clicks_per_dolphin
),
NULL
,
NULL
,
beacon
,
old_names
=
names
(
letters
$
Letters
),
new_names
=
names
(
letters
$
Letter
s
),
beacon
,
old_names
=
unlist
(
names
),
unlist
(
name
s
),
xname
=
"Signals from bio-inspired beacon"
,
height
=
150
,
size
=
3
,
xname
=
"Signals from bio-inspired beacon"
,
height
=
150
,
size
=
3
,
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
ytitle
=
"Mean number of clicks per dolphin per min"
)
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
theme
(
axis.text.x
=
element_text
(
size
=
8
))
+
...
...
This diff is collapsed.
Click to expand it.
Stats/README
-Stats
.md
→
Stats/README.md
+
39
−
0
View file @
80811c86
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment