Description Usage Arguments Details Value Examples
This internal function checks if the data introduced for building the curve is correct or not. It shows if there are some missing marker or response values and whether there are less or more than two levels at the response vector, D. It also splits the data into two groups: controls and cases, depending on the corresponding value in the response vector.
1 |
X |
vector of (bio)marker values. It should be numeric. |
D |
vector of response values. It should contain at least two different levels. |
The code will not run and an error will be showed in these cases:
X
or D
is missing,
X
or D
is NULL or full of NA's,
X
is not a numeric vector,
D
has less than two different values, and/or
X
and D
have different lengths.
If the response vector has more than two different levels, only the two first ones are considered as controls and cases, respectively.
If the user does not agree with the codification, it can be changed modifying the order of the levels using the factor
function; for instance, factor(D, levels=c("1","0"))
.
If the marker and response vectors are correct a list with the following fields is returned:
levels |
levels in |
controls |
marker values for controls. |
cases |
marker values for cases. |
n0 |
number of controls. |
n1 |
number of cases. |
X |
marker values corresponding to controls and cases (in this order). |
D |
response vector consisting of |
1 2 3 4 5 6 7 8 9 10 | # Basic example with full information
set.seed(123)
X <- c(rnorm(45), rnorm(30,2,1.5))
D <- c(rep(0,45), rep(1,30))
checkROC(X,D)
# Example with some missing values and more than two levels
X <- replace(c(rnorm(25), rnorm(30,2,1.5), rnorm(20,-3,1)), seq(1,75,5), NA)
D <- replace(c(rep(0,25), rep(1,30), rep(2,20)), seq(1,75,11), NA)
checkROC(X,D)
|
$levels
[1] "0" "1"
$controls
[1] -0.56047565 -0.23017749 1.55870831 0.07050839 0.12928774 1.71506499
[7] 0.46091621 -1.26506123 -0.68685285 -0.44566197 1.22408180 0.35981383
[13] 0.40077145 0.11068272 -0.55584113 1.78691314 0.49785048 -1.96661716
[19] 0.70135590 -0.47279141 -1.06782371 -0.21797491 -1.02600445 -0.72889123
[25] -0.62503927 -1.68669331 0.83778704 0.15337312 -1.13813694 1.25381492
[31] 0.42646422 -0.29507148 0.89512566 0.87813349 0.82158108 0.68864025
[37] 0.55391765 -0.06191171 -0.30596266 -0.38047100 -0.69470698 -0.20791728
[43] -1.26539635 2.16895597 1.20796200
$cases
[1] 0.3153371 1.3956727 1.3000170 3.1699477 1.8749464 2.3799778
[7] 1.9571799 1.9356943 4.0529034 1.6613435 4.2747059 -0.3231292
[13] 2.8769206 2.1857814 2.3239124 2.5694592 1.2465148 1.5001889
[19] 0.4721369 0.3923132 2.4552930 2.6723147 2.0795063 3.3834012
[25] 5.0751270 1.2634533 -1.4637533 3.5086078 0.9361989 0.9679871
$n0
[1] 45
$n1
[1] 30
$X
[1] -0.56047565 -0.23017749 1.55870831 0.07050839 0.12928774 1.71506499
[7] 0.46091621 -1.26506123 -0.68685285 -0.44566197 1.22408180 0.35981383
[13] 0.40077145 0.11068272 -0.55584113 1.78691314 0.49785048 -1.96661716
[19] 0.70135590 -0.47279141 -1.06782371 -0.21797491 -1.02600445 -0.72889123
[25] -0.62503927 -1.68669331 0.83778704 0.15337312 -1.13813694 1.25381492
[31] 0.42646422 -0.29507148 0.89512566 0.87813349 0.82158108 0.68864025
[37] 0.55391765 -0.06191171 -0.30596266 -0.38047100 -0.69470698 -0.20791728
[43] -1.26539635 2.16895597 1.20796200 0.31533713 1.39567275 1.30001697
[49] 3.16994768 1.87494640 2.37997777 1.95717987 1.93569431 4.05290343
[55] 1.66134352 4.27470591 -0.32312921 2.87692062 2.18578137 2.32391235
[61] 2.56945922 1.24651482 1.50018892 0.47213693 0.39231316 2.45529296
[67] 2.67231467 2.07950634 3.38340120 5.07512703 1.26345325 -1.46375331
[73] 3.50860779 0.93619886 0.96798708
$D
[1] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
[20] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0"
[39] "0" "0" "0" "0" "0" "0" "0" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
[58] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
$levels
[1] "0" "1" "2"
$controls
[1] -0.2847730 -1.2207177 0.1813035 -0.1388914 0.3852804 -0.3706600
[7] 0.6443765 -0.2204866 0.4351815 -0.3259316 1.1488076 0.5483970
[13] 0.2387317 -0.6279061 1.3606524 2.1873330 -0.2357004 -1.0264209
$cases
[1] 2.3853256 1.6299622 1.4786861 0.5725721 0.8226433 -0.5019129
[7] 3.3784949 2.9119465 -0.4268241 1.9166571 2.7791108 2.1585143
[13] 1.0389410 0.7254435 0.5787881 1.2641638 1.6158617 4.7657930
[19] 2.3530799 2.1169413 0.5572150 1.8930379
$n0
[1] 18
$n1
[1] 22
$X
[1] -0.2847730 -1.2207177 0.1813035 -0.1388914 0.3852804 -0.3706600
[7] 0.6443765 -0.2204866 0.4351815 -0.3259316 1.1488076 0.5483970
[13] 0.2387317 -0.6279061 1.3606524 2.1873330 -0.2357004 -1.0264209
[19] 2.3853256 1.6299622 1.4786861 0.5725721 0.8226433 -0.5019129
[25] 3.3784949 2.9119465 -0.4268241 1.9166571 2.7791108 2.1585143
[31] 1.0389410 0.7254435 0.5787881 1.2641638 1.6158617 4.7657930
[37] 2.3530799 2.1169413 0.5572150 1.8930379
$D
[1] "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "1"
[20] "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1" "1"
[39] "1" "1"
Warning messages:
1: In checkROC(X, D) :
Some of marker values are NA. They have been removed.
2: In checkROC(X, D) :
Some of response values are NA. They have been removed.
3: In checkROC(X, D) :
There are more than two levels in response vector. Only two are considered.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.