plotMO2fdis: Produce a histogram of the frequency distribution of oxygen...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plotMO2fdis.R

Description

Produce a histogram of the frequency distribution of oxygen uptake values for an animal and show the normal distributions that were fitted to these data. The user can then add lines representing different estimates of Standard Metabolic Rate.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plotMO2fdis(
  X,
  g = 1:4,
  Breaks = 100,
  mo2lab = expression(M[O[2]]),
  Border.col = grey(0.5),
  Bar.col = grey(0.92),
  ColNormdis = "blue",
  ...
)

Arguments

X

A vector or data frame column representing multiple measurements of oxygen uptake (MO2) for a single animal. Values that are untrustworthy (poor R2) or that were recorded when the animal could not have been at SMR (such as early after it was placed in the respirometer, or soon after it was fed) should have been removed from X.

g

Range of normal distribution mixtures to try fit to the data, default to 1–4.

Breaks

The number of possible bars on the histogram.

mo2lab

Label for the X axis, which is the range of observed MO2 values. The default is minimalist, the user can use makeO2lab to produce a more sophisticated label prior to calling plotMO2fdis.

Border.col

The colour of the border around the bars.

Bar.col

The colour used to fill the bars.

ColNormdis

The colour of the line tracking the normal distributions fitted to the data.

...

Other possible parameters for hist.

Details

Uses hist to produce the histogram of the frequency distribution, mclustBIC to fit a mixture of normal distribution to these data and calculate the line showing these distributions.

Value

A plot as well as the mean of each normal distribution.

Author(s)

Denis Chabot, Maurice-Lamontagne Institute, DFO, Canada.

References

Chabot, D., Steffensen, J. F. and Farrell, A. P. (2016) The determination of the standard metabolic rate in fishes. Journal of Fish Biology 88, 81-121.

See Also

calcSMR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
mo2 = c(rnorm(25, 150, 5), rnorm(50, 90, 3), rnorm(100, 50, 2))
plotMO2fdis(mo2)

# with real data, Greenland halibut
# remove a 10-h acclimation period, as recommended in Chabot et al. (2016)
# also remove the last 11 h, when DO was decreasing to calculate O2crit.
# there were no low R2s that required removal
data(GrHalO2crit)
smrData = subset(GrHalO2crit, DateTime >= DateTime[1] + 10*60*60 &
                 DateTime <= DateTime[nrow(GrHalO2crit)] - 11*60*60)
plotMO2fdis(smrData$MO2)
# show some estimates of SMR as vertical lines
smr = calcSMR(smrData$MO2)
abline(v=smr$mlnd, col="black")
abline(v=smr$quant[4], col="blue")
abline(v=smr$low10pc, col="red")
legend("topright", c("MLND", "q_0.2", "low10pc"), lty=1,
       col=c("black","blue","red"), bty="n", y.intersp=1.2)
# note that the CV of MLND is huge and the MLND is likely to overestimate SMR,
#    the quantile with p==0.2 is preferable.

# with real data, cod
data("codSDA")
# The fish was disturbed once for a sham-feeding, and 25.65 h later, it was fed.
# Some data after sham-feeding and all data post-feeding need to be excluded
#    when calculating SMR
# There are 2 time variables, one in POSIXct and one in hours, with zero at time of feeding.
# Tine in hours is used to filter undesired periods
start = -97.22  # first MO2
sham = -25.65   # time of sham-feeding
acclim = 24     # nb of hours to exclude because of handling stress, this fish took a long time to calm down
sham.acclim = 10  # nb of hours after sham-feeding with elevated MO2
minR2 = 0.96

smr.data = subset(codSDA, r2 > minR2 &
                  ((Logtime_hr >= (start + acclim) & Logtime_hr < sham ) |
                  (Logtime_hr >= (sham + sham.acclim) & Logtime_hr < 0))
                  )
dim(smr.data)
plotMO2fdis(smr.data$MO2)
# show some estimates of SMR as vertical lines
smr = calcSMR(smr.data$MO2)
abline(v=smr$mlnd, col="black")
abline(v=smr$quant[4], col="blue")
abline(v=smr$low10pc, col="red")
legend("topright", c("MLND", "q_0.2", "low10pc"), lty=1, col=c("black","blue","red"), bty="n", y.intersp=1.2)
# note that the CV of MLND is small and the MLND is a good estimate of SMR.
smr$CVmlnd

denis-chabot/fishMO2 documentation built on July 16, 2020, 1:53 a.m.