xlogistic_fits {RcppDynProg} | R Documentation |
Out of sample logistic predictions (in link space).
Description
1-hold out logistic regression predections. Zero indexed.
Usage
xlogistic_fits(x, y, w, i, j)
Arguments
x |
NumericVector, expanatory variable. |
y |
NumericVector, 0/1 values to fit. |
w |
NumericVector, weights (required, positive). |
i |
integer, first index (inclusive). |
j |
integer, last index (inclusive). |
Value
vector of predictions for interval.
Examples
set.seed(5)
d <- data.frame(x = rnorm(10))
d$y <- d$x + rnorm(nrow(d))>0
weights <- runif(nrow(d))
m <- glm(y~x, data = d, family = binomial, weights = weights)
d$pred1 <- predict(m, newdata = d, type = "link")
d$pred2 <- xlogistic_fits(d$x, d$y, weights, 0, nrow(d)-1)
d <- d[order(d$x), , drop = FALSE]
print(d)
[Package RcppDynProg version 0.2.1 Index]