xlogistic_fits | R Documentation |
1-hold out logistic regression predections. Zero indexed.
xlogistic_fits(x, y, w, i, j)
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). |
vector of predictions for interval.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.