#' @export
sigma.lmoola <- function (object, use.fallback = TRUE, mle = TRUE, ...) {
temp <- object
class(temp) <- "lm"
NN <- nobs(temp, use.fallback = use.fallback)
if (mle) {
PP <- 0
} else {
PP <- sum(!is.na(coef(temp)))
}
return(sqrt(deviance(temp, ...) / (NN - PP)))
}
#' @export
vcov.lmoola <- function(object, mle = TRUE, ...) {
temp <- object
class(temp) <- "lm"
if (mle) {
sigmahat <- sigma(object)
NN <- nobs(temp, use.fallback = TRUE)
PP <- sum(!is.na(coef(temp)))
var_sigmahat <- 2 * (NN - PP) * sigma ^ 2 / NN
} else {
sigmahat <- sigma(temp)
vcov_mat <- vcov(temp)
var_sigmahat <- 2 * sigma ^ 2
}
}
# I need logLikVec.lm()
# Use coef.lmoola() and vcov.lmoola()
# This distinguishes between the full MLE (sigma also) and sigma estimated
# via the usual moment estimator.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.