Created
March 9, 2015 12:57
-
-
Save johnDorian/bcda961fc5d2404c5dcf to your computer and use it in GitHub Desktop.
QSU - Fdom conversions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## The limits of the instrument (milivolts) and the sensor (QSU) | |
mv_conv <- data.frame(mv_limits = c(10.85, 4965),qsu_limits = c(0,200)) | |
## Plot the raw data to get an idea of what is hapenning | |
plot(qsu_limits~mv_limits, mv_conv, xlab="mV (datalogger)", | |
ylab = "Sensor limits (QSU)") | |
## Fit a model of the relationship | |
mv_conv_mod <- lm(qsu_limits~mv_limits, mv_conv) | |
## Add the trend model to the plot | |
abline(mv_conv_mod) | |
## An example to estimate the mV (Should be close to 100 QSU.) | |
predict(mv_conv_mod, data.frame(mv_limits = 2500)) | |
## To correct for the sensor offset. | |
qsu.df <- data.frame(measured_conc = c(6.9, 130), | |
stand_conc = c(15, 150)) | |
## Fit a model to the ratio between the measured QSU and the factry QSU | |
qsu_offset_conv <- lm(stand_conc~measured_conc, qsu.df) | |
## convert the measured QSU to the factory QSU | |
predict(qsu_offset_conv, data.frame(measured_conc= 6.9)) | |
## Combining them together. | |
qsu_measured <- predict(mv_conv_mod, data.frame(mv_limits = 10:4965)) | |
plot(predict(qsu_offset_conv, data.frame(measured_conc= qsu_measured))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment