Calculate Reference Interval and Corresponding Confidence Interval
Source:R/referenceInterval.R
refInterval.Rd
This function is used to establish the reference interval for target population with parametric, non-parametric and robust methods that follows the CLSI-EP28A3 and NMPA guideline. In additional, it also provides the corresponding confidence interval for lower/upper reference limit if needed. Given that outliers should be identified beforehand, Tukey and Dixon methods can be applied depending on distribution of the data.
Usage
refInterval(
x,
out_method = c("doxin", "tukey"),
out_rm = FALSE,
RI_method = c("parametric", "nonparametric", "robust"),
CI_method = c("parametric", "nonparametric", "boot"),
refLevel = 0.95,
bootCI = c("perc", "norm", "basic", "stud", "bca"),
confLevel = 0.9,
rng.seed = NULL,
tol = 1e-06,
R = 10000
)
Arguments
- x
(
numeric
)
numeric measurements from target population.- out_method
(
string
)
string specifying the which outlier detection to use.- out_rm
(
logical
)
whether the outliers is removed or not.- RI_method
(
string
)
string specifying the which method for computing reference interval to use. Default isparametric
, options can benonparametric
androbust
.- CI_method
(
string
)
string specifying the which method for computing confidence interval of reference limit(lower or upper) to use. Default isparametric
, options can benonparametric
andboot
.- refLevel
(
numeric
)
reference range/interval, usual is 0.95.- bootCI
(
string
)
string specifying the which bootstrap confidence interval fromboot.ci()
function inboot
package. Default isperc
(bootstrap percentile), options can benorm
(normal approximation),boot
(basic bootstrap),stud
(studentized bootstrap) andbca
(adjusted bootstrap percentile).- confLevel
(
numeric
)
significance level for the confidence interval of reference limit.- rng.seed
(
integer
)
number of the random number generator seed for bootstrap sampling. If set to NULL currently in the R session used RNG setting will be used.- tol
(
numeric
)
tolerance for when the iterative process can be stopped in robust method.- R
(
integer
)
number of bootstrap replicates, is used inboot()
function.
Note
There are some conditions of use to be aware of:
If parametric method is used to calculate reference interval, confidence interval should be the same method as well.
If non-parametric method is used to calculate the reference interval and the sample size is up to 120 observations, the non-parametric is suggested for confidence interval. Otherwise if the sample size is below to 120, the bootstrap method is the better choice. Beside the non-parametric method for confidence interval only allows the
refLevel=0.95
andconfLevel=0.9
arguments, if not the bootstrap methods will be used automatically.If robust method is used to calculate the reference interval, the method for confidence interval must be bootstrap.
Examples
data("calcium")
x <- calcium$Value
refInterval(x, RI_method = "parametric", CI_method = "parametric")
#>
#> Reference Interval Method: parametric, Confidence Interval Method: parametric
#>
#> Call: refInterval(x = x, RI_method = "parametric", CI_method = "parametric")
#>
#> N = 240
#> Outliers: NULL
#> Reference Interval: 9.05, 10.32
#> RefLower Confidence Interval: 8.9926, 9.1100
#> Refupper Confidence Interval: 10.2584, 10.3757
refInterval(x, RI_method = "nonparametric", CI_method = "nonparametric")
#>
#> Reference Interval Method: nonparametric, Confidence Interval Method: nonparametric
#>
#> Call: refInterval(x = x, RI_method = "nonparametric", CI_method = "nonparametric")
#>
#> N = 240
#> Outliers: NULL
#> Reference Interval: 9.10, 10.30
#> RefLower Confidence Interval: 8.9000, 9.2000
#> Refupper Confidence Interval: 10.3000, 10.4000
refInterval(x, RI_method = "robust", CI_method = "boot", R = 1000)
#> Bootstrape process could take a short while.
#>
#> Reference Interval Method: robust, Confidence Interval Method: boot
#>
#> Call: refInterval(x = x, RI_method = "robust", CI_method = "boot",
#> R = 1000)
#>
#> N = 240
#> Outliers: NULL
#> Reference Interval: 9.04, 10.32
#> RefLower Confidence Interval: 8.9777, 9.0979
#> Refupper Confidence Interval: 10.2568, 10.3751