Learn R Programming

embryogrowth (version 9.5)

uncertainty.datalogger: Uncertainty of average temperatures obtained using temperature data logger

Description

Calculate the uncertainty of average temperature dependent on the characteristics of a data logger and sampling rate.
The temperature is supposed to be uniformaly distributed with min and max being -accuracy and +accuracy.

Usage

uncertainty.datalogger(
  max.time = 0,
  sample.rate = 0,
  accuracy = 0.5,
  resolution = 1,
  replicates = 10000,
  method = function(x) {
     2 * qnorm(0.975) * sd(x)
 }
)

Value

The function will return the uncertainty of the average temperature for the considered period as being the 95% range where the true average temperature should be.

Arguments

max.time

being the maximum time to record in minutes

sample.rate

The sample rates in minutes

accuracy

The accuracy of the data logger in °C

resolution

The resolution of the data logger in °C

replicates

The number of replicates to estimate uncertainty.

method

The fonction that will be used to return the uncertainty.

Author

Marc Girondot

Details

uncertainty.datalogger Calculate the uncertainty of the average temperature calculated using data gathered by a data logger.

References

11124embryogrowth

See Also

Other Data loggers utilities: calibrate.datalogger(), movement()

Examples

Run this code
if (FALSE) {
library(embryogrowth)
# Exemple using the hypothesis of Gaussian distribution
uncertainty.datalogger(sample.rate=30, accuracy=1, resolution=0.5, 
                method=function(x) {2*qnorm(0.975)*sd(x)})
# Example without hypothesis about distribution, using quantiles
uncertainty.datalogger(sample.rate=30, accuracy=1, resolution=0.5, 
                method=function(x) {quantile(x, probs=c(0.975))-
                                              quantile(x, probs=c(0.025))})
par(mar=c(4, 4, 1, 1))
plot(x=10:120, uncertainty.datalogger(sample.rate=10:120, 
                                      accuracy=0.5, 
                                      resolution=1), 
     las=1, bty="n", type="l", 
     xlab="Sample rate in minutes", 
     ylab=expression("Uncertainty in "*degree*"C"), 
     ylim=c(0, 0.15), xlim=c(0, 120))  
lines(x=10:120, uncertainty.datalogger(sample.rate=10:120, 
                                            accuracy=1, 
                                            resolution=0.5), col="red")
lines(x=10:120, uncertainty.datalogger(sample.rate=10:120, 
                                       accuracy=1, 
                                       resolution=1), col="blue")
lines(x=10:120, uncertainty.datalogger(sample.rate=10:120, 
                                       accuracy=0.5, 
                                       resolution=0.5), col="yellow")
legend("topleft", legend=c("Accuracy=0.5, resolution=0.5", 
                           "Accuracy=0.5, resolution=1", 
                           "Accuracy=1, resolution=0.5", 
                           "Accuracy=1, resolution=1"), lty=1, 
       col=c("yellow", "black", "red", "blue"), 
       cex=0.6)
}

Run the code above in your browser using DataLab