我拟合了简单的逻辑回归模型, 但我想查看他们计算残差的代码, 具体来说,
fit <- glm(y~x, data=my, family=binomial(link="logit"))
fit$residuals
这是我第一次尝试在基础软件包中找到代码,我猜测内置软件包,没有源代码包可以打开包中包含的每个函数作为其他常规软件包,我试过了打字
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>
从那里开始,但我不知道如何找到我想要的代码, 任何人都可以给我洞察力吗?任何建议将不胜感激!