.residuals | R Documentation |
Calculates residuals from observed outcome and predicted values (Gaussian family) or predicted probabilities (binomial family). Called by '.exp.multiple' and '.iso.multiple'.
.residuals(y, y_hat, family)
y |
response: vector of length |
y_hat |
predicted values or probabilities (see family):
vector of length |
family |
character
"gaussian" ( |
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.