Description Usage Arguments Value References See Also Examples
Obtains predicted class labels and posterior probabilities from a locally fitted logistic regression model.
1 | predict.dalr(object, newdata = NULL, ...)
|
object |
An object of class |
newdata |
Optionally, a |
... |
Further arguments to be passed from or to other methods, especially to |
A list
with components:
class |
The predicted class labels (a |
posterior |
Matrix of class posterior probabilities. |
Hand, D. J., Vinciotti, V. (2003), Local versus global models for classification problems: Fitting models where it matters, The American Statistician, 57(2) 124–130.
dalr
, predict.glm
, glm
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # generate data set:
x1 <- runif(500, min = 0, max = 1)
x2 <- runif(500, min = 0, max = 1)
x <- data.frame(x1 = x1, x2 = x2)
prob <- x$x2/(x$x1 + x$x2)
y <- as.factor(sapply(prob, function(x) sample(0:1, size = 1,
prob = c(1-x,x))))
x <- data.frame(x, y = y)
# fit dalr on training set and predict on test set:
train <- sample(500, 300)
fit <- dalr(y ~ ., data = x, thr = 0.3, wf = "rectangular", bw = 100,
subset = train)
pred <- predict(fit, newdata = x[-train,])
mean(y[-train] != pred$class)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.