threshold: Classifying a Numerical Response Using a Threshold

Description Usage Arguments Value Author(s) Examples

View source: R/thresh.R

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

1
threshold(fit, t, newdata=NULL, ...)

Arguments

fit

any model with a numerical response.

t

the desired threshold value. All values above t will be labeled “1”and all values below t will be labeled “0”.

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 predict function.

Value

pred.class

if newdata is not NULL, then pred.class is a vector of predicted classes for newdata. If newdata is NULL, then pred.class is NULL.

t

the threshold.

train.class

a vector of the predicted classes of the data used in fit.

true.class

a vector of the true classes of the data used in fit.

train.error

a scalar equal to the mean(train.class != true.class).

true.high

the number of observations in class“1” using the data used in fit.

true.low

the number of observations in class “1” using the data used in fit.

false.high

the number of observations truly in class “0”, but predicted to be in class “1” using the data used in fit.

false.low

the number of observations truly in class “1”, but predicted to be in class “1” using the data used in fit.

call

the call of fit.

formula

the formula used in fit.

Author(s)

Adam Maidman

Examples

1
2
3
4
5
6
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

plaqr documentation built on May 2, 2019, 3:32 p.m.

Related to threshold in plaqr...