diff --git a/articles/mcradds.html b/articles/mcradds.html index 04364ca..bb285fb 100644 --- a/articles/mcradds.html +++ b/articles/mcradds.html @@ -147,7 +147,7 @@

Common IVD Trials Analyses
 data("qualData")
 data("platelet")
-# data(creatinine, package = "mcr")
+data(creatinine, package = "mcr")
 data("calcium")
 data("ldlroc")
 data("PDL1RP")
@@ -382,19 +382,51 @@ 

Estimating Regression coefficientmcreg, getCoefficients and calcBias. If you would like to utilize the entire functions in mcr package, just adding the specific package name in -front of each of them, like mcr::calcBias(), so that it +front of each of them, like mcr::calcBias(), so that it looks the function is called from mcr package.

-

Please to be noted that the mcr package is not available -in CRAN, so the mcreg or mcreg2 function can -not be used temporarily.

 # Deming regression
-fit <- mcreg(
+fit <- mcreg(
   x = platelet$Comparative, y = platelet$Candidate,
   error.ratio = 1, method.reg = "Deming", method.ci = "jackknife"
 )
-printSummary(fit)
-getCoefficients(fit)
+#> Jackknife based calculation of standard error and confidence intervals according to Linnet's method. +printSummary(fit) +#> +#> +#> ------------------------------------------ +#> +#> Reference method: Method1 +#> Test method: Method2 +#> Number of data points: 120 +#> +#> ------------------------------------------ +#> +#> The confidence intervals are calculated with jackknife (Linnet's) method. +#> Confidence level: 95% +#> Error ratio: 1 +#> +#> ------------------------------------------ +#> +#> DEMING REGRESSION FIT: +#> +#> EST SE LCI UCI +#> Intercept 4.335885 1.568968372 1.2289002 7.442869 +#> Slope 1.012951 0.009308835 0.9945175 1.031386 +#> +#> +#> ------------------------------------------ +#> +#> JACKKNIFE SUMMARY +#> +#> EST Jack.Mean Bias Jack.SE +#> Intercept 4.335885 4.336377 4.918148e-04 1.568968372 +#> Slope 1.012951 1.012950 -1.876312e-06 0.009308835 +#> NULL +getCoefficients(fit) +#> EST SE LCI UCI +#> Intercept 4.335885 1.568968372 1.2289002 7.442869 +#> Slope 1.012951 0.009308835 0.9945175 1.031386

Estimating Bias in Medical Decision Level @@ -405,15 +437,16 @@

Estimating Bias in Medical De assay is 30, obviously this is a make-up number. Then you can use the fit object above to estimate the bias using calcBias function.

-

Please to be noted that the mcr package is not available -in CRAN, so the calcBias function can not be used -temporarily.

 # absolute bias.
-calcBias(fit, x.levels = c(30))
+calcBias(fit, x.levels = c(30))
+#>    Level     Bias       SE      LCI      UCI
+#> X1    30 4.724429 1.378232 1.995155 7.453704
 
 # proportional bias.
-calcBias(fit, x.levels = c(30), type = "proportional")
+calcBias(fit, x.levels = c(30), type = "proportional") +#> Level Prop.bias(%) SE LCI UCI +#> X1 30 15.7481 4.594106 6.650517 24.84568

@@ -515,13 +548,31 @@

Detecting Outliers#> 4 10 16.4 10.8 # 4E approach -ba2 <- blandAltman(x = platelet$Comparative, y = platelet$Candidate) +ba2 <- blandAltman(x = creatinine$serum.crea, y = creatinine$plasma.crea) out2 <- getOutlier(ba2, method = "4E") -#> No outlier is detected. out2$stat -#> NULL +#> obs abs abs_limit_lr abs_limit_ur rel rel_limit_lr rel_limit_ur +#> 4 4 0.49 -0.2988882 0.3142586 0.4644550 -0.2748149 0.2734674 +#> 51 51 -0.31 -0.2988882 0.3142586 -0.3054187 -0.2748149 0.2734674 +#> 96 96 0.39 -0.2988882 0.3142586 0.3466667 -0.2748149 0.2734674 +#> 97 97 0.44 -0.2988882 0.3142586 0.3859649 -0.2748149 0.2734674 +#> 106 106 0.36 -0.2988882 0.3142586 0.3302752 -0.2748149 0.2734674 +#> 108 108 0.32 -0.2988882 0.3142586 0.3333333 -0.2748149 0.2734674 +#> Outlier +#> 4 TRUE +#> 51 TRUE +#> 96 TRUE +#> 97 TRUE +#> 106 TRUE +#> 108 TRUE out2$outmat -#> NULL

+#> sid x y +#> 1 4 0.81 1.30 +#> 2 51 1.17 0.86 +#> 3 96 0.93 1.32 +#> 4 97 0.92 1.36 +#> 5 106 0.91 1.27 +#> 6 108 0.80 1.12

In addition, mcradds also provides outlier methods for evaluating Reference Range, such as ‘Tukey’ and ‘Dixon’ that have been wrapped in refInterval() function.

@@ -563,7 +614,7 @@

Hypothesis of Pearson and SpearmanspearmanTest(x, y, h0 = 0.5, alternative = "greater") #> $stat #> cor lowerci upperci Z pval -#> 0.6000000 -0.1150442 0.9824561 0.3243526 0.3728355 +#> 0.6000000 -0.1478261 0.9656153 0.3243526 0.3728355 #> #> $method #> [1] "Spearman's correlation" @@ -621,8 +672,8 @@

Establishing Reference Range/Inter #> N = 240 #> Outliers: NULL #> Reference Interval: 9.04, 10.32 -#> RefLower Confidence Interval: 8.9798, 9.0975 -#> Refupper Confidence Interval: 10.2585, 10.3767 +#> RefLower Confidence Interval: 8.9799, 9.0977 +#> Refupper Confidence Interval: 10.2575, 10.3755

The first two methods are also accepted by NMPA guideline, but the robust method is not recommended by NMPA because if you want to establish a reference interval for your assay, you must collect the at @@ -949,17 +1000,15 @@

Bland-Altman plotRegression plot

To generate the regression plot, you should create the object from -mcreg() function and then call autoplot +mcreg() function and then call autoplot straightforward.

-

Please to be noted that the mcr package is not available -in CRAN, so the mcreg or mcreg2 function can -not be used temporarily.

-fit <- mcreg2(
+fit <- mcreg(
   x = platelet$Comparative, y = platelet$Candidate,
   method.reg = "PaBa", method.ci = "bootstrap"
 )
 autoplot(fit)
+

More arguments can be used as shown below.

 autoplot(
@@ -972,6 +1021,7 @@ 

Regression plot x.title = "Reference", y.title = "Test" )

+

@@ -1017,31 +1067,32 @@

Session Info#> [1] gld_2.6.6 gtable_0.3.4 xfun_0.40 #> [4] bslib_0.5.1 ggplot2_3.4.3 lattice_0.21-8 #> [7] numDeriv_2016.8-1.1 vctrs_0.6.3 tools_4.3.1 -#> [10] generics_0.1.3 tibble_3.2.1 proxy_0.4-27 -#> [13] fansi_1.0.5 pkgconfig_2.0.3 Matrix_1.5-4.1 -#> [16] data.table_1.14.8 checkmate_2.2.0 desc_1.4.2 -#> [19] readxl_1.4.3 lifecycle_1.0.3 rootSolve_1.8.2.4 -#> [22] farver_2.1.1 compiler_4.3.1 stringr_1.5.0 -#> [25] textshaping_0.3.7 Exact_3.2 munsell_0.5.0 -#> [28] htmltools_0.5.6.1 DescTools_0.99.50 class_7.3-22 -#> [31] sass_0.4.7 yaml_2.3.7 nloptr_2.0.3 -#> [34] pillar_1.9.0 pkgdown_2.0.7 jquerylib_0.1.4 -#> [37] MASS_7.3-60 cachem_1.0.8 boot_1.3-28.1 -#> [40] nlme_3.1-162 tidyselect_1.2.0 digest_0.6.33 -#> [43] mvtnorm_1.2-3 stringi_1.7.12 dplyr_1.1.3 -#> [46] purrr_1.0.2 labeling_0.4.3 splines_4.3.1 -#> [49] rprojroot_2.0.3 fastmap_1.1.1 grid_4.3.1 -#> [52] colorspace_2.1-0 lmom_3.0 expm_0.999-7 -#> [55] cli_3.6.1 magrittr_2.0.3 utf8_1.2.3 -#> [58] VCA_1.4.5 e1071_1.7-13 withr_2.5.1 -#> [61] scales_1.2.1 backports_1.4.1 rmarkdown_2.25 -#> [64] httr_1.4.7 lme4_1.1-34 cellranger_1.1.0 -#> [67] ragg_1.2.6 memoise_2.0.1 evaluate_0.22 -#> [70] knitr_1.44 rlang_1.1.1 Rcpp_1.0.11 -#> [73] glue_1.6.2 renv_0.15.5 pROC_1.18.4 -#> [76] minqa_1.2.6 rstudioapi_0.15.0 jsonlite_1.8.7 -#> [79] plyr_1.8.9 R6_2.5.1 systemfonts_1.0.5 -#> [82] fs_1.6.3 +#> [10] generics_0.1.3 parallel_4.3.1 tibble_3.2.1 +#> [13] proxy_0.4-27 fansi_1.0.5 pkgconfig_2.0.3 +#> [16] Matrix_1.5-4.1 data.table_1.14.8 checkmate_2.2.0 +#> [19] desc_1.4.2 readxl_1.4.3 lifecycle_1.0.3 +#> [22] rootSolve_1.8.2.4 farver_2.1.1 compiler_4.3.1 +#> [25] stringr_1.5.0 textshaping_0.3.7 Exact_3.2 +#> [28] munsell_0.5.0 htmltools_0.5.6.1 DescTools_0.99.50 +#> [31] class_7.3-22 sass_0.4.7 yaml_2.3.7 +#> [34] nloptr_2.0.3 pillar_1.9.0 pkgdown_2.0.7 +#> [37] jquerylib_0.1.4 robslopes_1.1.3 MASS_7.3-60 +#> [40] cachem_1.0.8 boot_1.3-28.1 nlme_3.1-162 +#> [43] mcr_1.3.3 tidyselect_1.2.0 digest_0.6.33 +#> [46] mvtnorm_1.2-3 stringi_1.7.12 dplyr_1.1.3 +#> [49] purrr_1.0.2 labeling_0.4.3 splines_4.3.1 +#> [52] rprojroot_2.0.3 fastmap_1.1.1 grid_4.3.1 +#> [55] colorspace_2.1-0 lmom_3.0 expm_0.999-7 +#> [58] cli_3.6.1 magrittr_2.0.3 utf8_1.2.3 +#> [61] VCA_1.4.5 e1071_1.7-13 withr_2.5.1 +#> [64] scales_1.2.1 backports_1.4.1 httr_1.4.7 +#> [67] rmarkdown_2.25 lme4_1.1-34 cellranger_1.1.0 +#> [70] ragg_1.2.6 memoise_2.0.1 evaluate_0.22 +#> [73] knitr_1.44 rlang_1.1.1 Rcpp_1.0.11 +#> [76] glue_1.6.2 renv_0.15.5 pROC_1.18.4 +#> [79] minqa_1.2.6 rstudioapi_0.15.0 jsonlite_1.8.7 +#> [82] plyr_1.8.9 R6_2.5.1 systemfonts_1.0.5 +#> [85] fs_1.6.3

diff --git a/articles/mcradds_files/figure-html/unnamed-chunk-33-1.png b/articles/mcradds_files/figure-html/unnamed-chunk-33-1.png new file mode 100644 index 0000000..42ace42 Binary files /dev/null and b/articles/mcradds_files/figure-html/unnamed-chunk-33-1.png differ diff --git a/articles/mcradds_files/figure-html/unnamed-chunk-34-1.png b/articles/mcradds_files/figure-html/unnamed-chunk-34-1.png new file mode 100644 index 0000000..dde42e8 Binary files /dev/null and b/articles/mcradds_files/figure-html/unnamed-chunk-34-1.png differ diff --git a/pkgdown.yml b/pkgdown.yml index 6c2f046..8e7c2c7 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -3,7 +3,7 @@ pkgdown: 2.0.7 pkgdown_sha: ~ articles: mcradds: mcradds.html -last_built: 2023-10-12T06:27Z +last_built: 2023-10-12T09:43Z urls: reference: https://kaigu1990.github.io/mcradds/reference article: https://kaigu1990.github.io/mcradds/articles diff --git a/reference/Rplot003.png b/reference/Rplot003.png index fb6df2a..186353b 100644 Binary files a/reference/Rplot003.png and b/reference/Rplot003.png differ diff --git a/reference/Rplot007.png b/reference/Rplot007.png new file mode 100644 index 0000000..e1b3e18 Binary files /dev/null and b/reference/Rplot007.png differ diff --git a/reference/Rplot008.png b/reference/Rplot008.png new file mode 100644 index 0000000..bdc4c0d Binary files /dev/null and b/reference/Rplot008.png differ diff --git a/reference/autoplot-3.png b/reference/autoplot-3.png index f517c59..6d4d183 100644 Binary files a/reference/autoplot-3.png and b/reference/autoplot-3.png differ diff --git a/reference/autoplot-7.png b/reference/autoplot-7.png new file mode 100644 index 0000000..b978b93 Binary files /dev/null and b/reference/autoplot-7.png differ diff --git a/reference/autoplot-8.png b/reference/autoplot-8.png new file mode 100644 index 0000000..28e0714 Binary files /dev/null and b/reference/autoplot-8.png differ diff --git a/reference/autoplot.html b/reference/autoplot.html index e00db28..378d07a 100644 --- a/reference/autoplot.html +++ b/reference/autoplot.html @@ -88,6 +88,28 @@

Usage x.title = NULL, y.title = NULL, main.title = NULL +) + +# S4 method for MCResult +autoplot( + object, + color = "black", + fill = "lightgray", + size = 1.5, + shape = 21, + jitter = FALSE, + identity = TRUE, + identity.params = list(col = "gray", linetype = "dashed"), + reg = TRUE, + reg.params = list(col = "blue", linetype = "solid"), + equal.axis = FALSE, + legend.title = TRUE, + legend.digits = 2, + x.nbreak = NULL, + y.nbreak = NULL, + x.title = NULL, + y.title = NULL, + main.title = NULL ) @@ -95,7 +117,7 @@

Usage

Arguments

object

(BAsummary, MCResult)
input, depending on which function -you have done, blandAltman() or mcreg().

+you have done, blandAltman() or mcreg().

...
@@ -166,6 +188,35 @@

Arguments + + +
reg
+

(logical)
whether to add regression line where the slope and +intercept are obtained from
mcr::mcreg() function, default is TRUE.

+ + +
equal.axis
+

(logical)
whether to adjust the ranges of x-axis and y-axis +are identical. If equal.axis = TRUE, x-axis will be equal to y-axis.

+ + +
legend.title
+

(logical)
whether to present the title in the legend.

+ + +
legend.digits
+

(integer)
the number of digits after the decimal point +in the legend.

+

Value

@@ -181,7 +232,8 @@

Note

See also

-

h_difference() to see the type details.

+

h_difference() to see the type details.

+

mcr::mcreg() to see the regression parameters.

@@ -231,6 +283,24 @@

Examples y.title = "Reference - Test" ) +# Using the default arguments for regression plot +data("platelet") +fit <- mcreg( + x = platelet$Comparative, y = platelet$Candidate, + method.reg = "Deming", method.ci = "jackknife" +) +#> Jackknife based calculation of standard error and confidence intervals according to Linnet's method. +autoplot(fit) + + +# Only present the regression line and alter the color and shape. +autoplot(fit, + identity = FALSE, + reg.params = list(col = "grey", linetype = "dashed"), + legend.title = FALSE, + legend.digits = 4 +) +