Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Zelig/R/model-glm.R
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
33 lines (30 sloc)
1.16 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Generalized Linear Model object for inheritance across models in Zelig | |
#' | |
#' @import methods | |
#' @export Zelig-glm | |
#' @exportClass Zelig-glm | |
#' | |
#' @include model-zelig.R | |
zglm <- setRefClass("Zelig-glm", | |
contains = "Zelig", | |
fields = list(family = "character", | |
link = "character", | |
linkinv = "function")) | |
zglm$methods( | |
initialize = function() { | |
callSuper() | |
.self$fn <- quote(stats::glm) | |
.self$packageauthors <- "R Core Team" | |
.self$acceptweights <- FALSE # "Why glm refers to the number of trials as weight is a trick question to the developers' conscience." | |
} | |
) | |
zglm$methods( | |
zelig = function(formula, data, ..., weights = NULL, by = NULL, bootstrap = FALSE) { | |
.self$zelig.call <- match.call(expand.dots = TRUE) | |
.self$model.call <- .self$zelig.call | |
.self$model.call$family <- call(.self$family, .self$link) | |
callSuper(formula = formula, data = data, ..., weights = weights, by = by, bootstrap = bootstrap) | |
rse <- lapply(.self$zelig.out$z.out, (function(x) vcovHC(x, type = "HC0"))) | |
.self$test.statistics <- list(robust.se = rse) | |
} | |
) |