I fitted the simple logistic regression model, But I want to look into the codes they computed residuals, Specifically,
fit <- glm(y~x, data=my, family=binomial(link="logit"))
fit$residuals
It is my first time trying to locate the code in the base package, I am guessing for built in packages, there is no source package where you can open up each function contained in the package as other regular packages, I tried just typing
glm
> glm
function (formula, family = gaussian, data, weights, subset,
na.action, start = NULL, etastart, mustart, offset, control = list(...),
model = TRUE, method = "glm.fit", x = FALSE, y = TRUE, contrasts = NULL,
...)
{
call <- match.call()
if (is.character(family))
family <- get(family, mode = "function", envir = parent.frame())
if (is.function(family))
family <- family()
<bytecode: 0x0000000014da21b0>
<environment: namespace:stats>
and starting from there, but I have no idea how to locate the code that I want, Could anyone give me the insight? Any advice will be appreciated!