.residuals {transreg} | R Documentation |
Calculate residuals
Description
Calculates residuals from observed outcome
and predicted values (Gaussian family)
or predicted probabilities (binomial family).
Called by .exp.multiple
and .iso.multiple
.
Usage
.residuals(y, y_hat, family)
Arguments
y |
response: vector of length |
y_hat |
predicted values or probabilities (see family):
vector of length |
family |
character
"gaussian" ( |
Examples
n <- 100
p <- 5
X <- matrix(stats::rnorm(n*p),nrow=n,ncol=p)
#y <- stats::rbinom(n,size=1,prob=0.5)
y <- stats::rnorm(n)
glm <- glm(y~X,family="gaussian")
res <- residuals.glm(glm)
y_hat <- predict(glm,type="response")
all.equal(res,y-y_hat)
[Package transreg version 1.0.2 Index]