threshold {plaqr} | R Documentation |
Classifying a Numerical Response Using a Threshold
Description
Classification of a numerical response into a “high” class and “low” class using a threshold. This function can be used with any model that has a numerical outcome and allows for prediction using the predict
function.
Usage
threshold(fit, t, newdata=NULL, ...)
Arguments
fit |
any model with a numerical response. |
t |
the desired threshold value. All values above |
newdata |
an optional data frame in which to look for variables with which to predict. If omitted, no prediction is done. |
... |
additional argument(s) for methods in the |
Value
pred.class |
if |
t |
the threshold. |
train.class |
a vector of the predicted classes of the data used in |
true.class |
a vector of the true classes of the data used in |
train.error |
a scalar equal to the |
true.high |
the number of observations in class“1” using the data used in |
true.low |
the number of observations in class “1” using the data used in |
false.high |
the number of observations truly in class “0”, but predicted to be in class “1” using the data used in |
false.low |
the number of observations truly in class “1”, but predicted to be in class “1” using the data used in |
call |
the |
formula |
the formula used in |
Author(s)
Adam Maidman
Examples
data(simData)
fit <- plaqr(y~.,~z1+z2,data=simData)
testdata <- .5*simData[4,2:6]
trh <- threshold(fit, t=9, newdata=testdata)
trh$pred.class
trh