logistic_fits: In sample logistic predictions (in link space).

View source: R/RcppExports.R

logistic_fitsR Documentation

In sample logistic predictions (in link space).

Description

logistic regression predictions. Zero indexed.

Usage

logistic_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 <- logistic_fits(d$x, d$y, weights, 0, nrow(d)-1)
d <- d[order(d$x), , drop = FALSE]
print(d)


RcppDynProg documentation built on Aug. 20, 2023, 9:07 a.m.