This function predicts STPD correction factor using linear model with predictor variables: baro for barometric pressure and temp_c for temperature in celsius. The data that linear model was fitted can be found in a data frame btps_df.

get_STPD_factor(
  baro,
  temp_c,
  interval = c("none", "confidence", "prediction"),
  level = 0.95,
  ...
)

Arguments

baro

(Numeric) Barometric pressure (in mmHg) at the collection site.

temp_c

(Numeric) Temperature in celsius at the collection site.

interval

Type of interval calculation: "None" returns estimated STPD correction factor; "confidence" and "prediction" return confidence interval and prediction interval, respectively.

level

Tolerance/confidence level.

...

passed to predict.lm()

Value

A numeric vector (invisibly) or matrix (if interval = "confidence" or "prediction").

Examples

# Estimated STPD factor
get_STPD_factor(baro = 761, temp_c = 29)
#> STPD correction factor = 0.866 (761 mmHg, 29 degree celcius) 
get_STPD_factor(baro = 761:762, temp_c = 29:30) # Vectorized
#> STPD correction factor = 0.866 (761 mmHg, 29 degree celcius) 
#> STPD correction factor = 0.862 (762 mmHg, 30 degree celcius) 

# Estimated STPD factor value with confidence Interval
get_STPD_factor(baro = 761:762, temp_c = 29:30, interval = "c")
#>         fit       lwr       upr
#> 1 0.8655197 0.8654131 0.8656262
#> 2 0.8620375 0.8619218 0.8621532