Tidy summarizes information about the components of a model. A model component might be a single term in a regression, a single hypothesis, a cluster, or a class. Exactly what tidy considers to be a model component varies across models but is usually self-evident. If a model has several distinct types of components, you will need to specify which components to return.
# S3 method for geeglm
tidy(x, conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE, ...)
A geeglm
object returned from a call to geepack::geeglm()
.
Logical indicating whether or not to include a confidence
interval in the tidied output. Defaults to FALSE
.
The confidence level to use for the confidence interval
if conf.int = TRUE
. Must be strictly greater than 0 and less than 1.
Defaults to 0.95, which corresponds to a 95 percent confidence interval.
Logical indicating whether or not to exponentiate the
the coefficient estimates. This is typical for logistic and multinomial
regressions, but a bad idea if there is no log or logit link. Defaults
to FALSE
.
Additional arguments. Not used. Needed to match generic
signature only. Cautionary note: Misspelled arguments will be
absorbed in ...
, where they will be ignored. If the misspelled
argument has a default value, the default value will be used.
For example, if you pass conf.lvel = 0.9
, all computation will
proceed using conf.level = 0.95
. Additionally, if you pass
newdata = my_tibble
to an augment()
method that does not
accept a newdata
argument, it will use the default value for
the data
argument.
If conf.int = TRUE
, the confidence interval is computed with
the an internal confint.geeglm()
function.
If you have missing values in your model data, you may need to
refit the model with na.action = na.exclude
or deal with the
missingness in the data beforehand.
A tibble::tibble()
with columns:
Upper bound on the confidence interval for the estimate.
Lower bound on the confidence interval for the estimate.
The estimated value of the regression term.
The two-sided p-value associated with the observed statistic.
The value of a T-statistic to use in a hypothesis that the regression term is non-zero.
The standard error of the regression term.
The name of the regression term.
# feel free to ignore the following line—it allows {broom} to supply
# examples without requiring the model-supplying package to be installed.
if (requireNamespace("geepack", quietly = TRUE)) {
# load modeling library
library(geepack)
# load data
data(state)
ds <- data.frame(state.region, state.x77)
# fit model
geefit <- geeglm(Income ~ Frost + Murder,
id = state.region,
data = ds, family = gaussian,
corstr = "exchangeable"
)
# summarize model fit with tidiers
tidy(geefit)
tidy(geefit, conf.int = TRUE)
}
#> $fct
#> function(dose, parm)
#> {
#> parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE)
#> parmMat[, notFixed] <- parm
#> fd(dose, parmMat[, 1], parmMat[, 2], parmMat[, 3], parmMat[, 4], parmMat[, 5])
#> }
#> <bytecode: 0x55a5f6839b08>
#> <environment: 0x55a61e3e5f68>
#>
#> $ssfct
#> function(dframe)
#> {
#> x <- dframe[, 1]
#> y <- dframe[, 2]
#>
#> ## Finding initial values for c and d parameters
#> cdVal <- findcd(x, y)
#> if (useFixed) {} # not implemented at the moment
#>
#> ## Finding initial values for b, e, and f parameters
#> if (logg)
#> {
#> bVal <- 0.75 * sd(log(x[y > quantile(y, .75)]))
#> } else {
#> bVal <- 0.75 * sd(x[y > quantile(y, .75)])
#> }
#> befVal <- c(bVal, x[which.max(y)], 1)
#> # befVal <- c(sd(x), mean(x), 1)
#>
#> return(c(befVal[1], cdVal, befVal[2:3])[is.na(fixed)])
#> }
#> <bytecode: 0x55a61b2151a0>
#> <environment: 0x55a618e5d398>
#>
#> $names
#> [1] "b" "c" "d" "e" "f"
#>
#> $deriv1
#> function(dose, parm)
#> {
#> parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE)
#> parmMat[, notFixed] <- parm
#> attr(fd(dose, parmMat[, 1], parmMat[, 2], parmMat[, 3], parmMat[, 4], parmMat[, 5]), "gradient")[, notFixed]
#> }
#> <bytecode: 0x55a5f6843a28>
#> <environment: 0x55a61e3e5f68>
#>
#> $deriv2
#> NULL
#>
#> $derivx
#> function(dose, parm)
#> {
#> parmMat <- matrix(parmVec, nrow(parm), numParm, byrow = TRUE)
#> parmMat[, notFixed] <- parm
#>
#> dFct <- function (dose, b, c, d, e, f)
#> {
#> .expr1 <- d - c
#> .expr4 <- (dose - e)/b
#> .expr5 <- .expr4^2
#> .expr6 <- sqrt(.expr5)
#> .expr9 <- exp(-0.5 * .expr6^f)
#> .value <- c + .expr1 * .expr9
#> .grad <- array(0, c(length(.value), 1L), list(NULL, c("dose")))
#> .grad[, "dose"] <- -(.expr1 * (.expr9 * (0.5 * (.expr6^(f - 1) * (f * (0.5 * (2 * (1/b * .expr4) * .expr5^-0.5)))))))
#> attr(.value, "gradient") <- .grad
#> .value
#> }
#> attr(dFct(dose, parmMat[, 1], parmMat[, 2], parmMat[, 3], parmMat[, 4], parmMat[, 5]), "gradient")
#> }
#> <bytecode: 0x55a5f684b2f0>
#> <environment: 0x55a61e3e5f68>
#>
#> $edfct
#> function(parm, respl, reference, type, ...)
#> {
#> parmVec[notFixed] <- parm
#> # if (type == "absolute")
#> # {
#> # p <- 100*((parmVec[3] - respl)/(parmVec[3] - parmVec[2]))
#> # } else {
#> # p <- respl
#> # }
#> # if ( (parmVec[1] < 0) && (reference == "control") )
#> # {
#> # p <- 100 - p
#> # }
#> p <- absToRel(parmVec, abs(respl), type)
#>
#> ## Reversing p
#> if (identical(type, "absolute"))
#> {
#> p <- 100 - p
#> }
#> if (identical(type, "relative") && (parmVec[1] < 0) && (reference == "control"))
#> {
#> p <- 100 - p
#> }
#>
#> pProp <- 1 - (100-p) / 100
#>
#> ## deriv(~b*(-2*22)^(1 / f)+e, c("b", "c", "d", "e", "f"), function(b,c,d,e,f){})
#> ## using "22" insted of log(pProp)
#> EDfct <- function (b, c, d, e, f)
#> {
#> # .expr2 <- -2 * 22
#> .expr2 <- -2 * log(pProp)
#> .expr4 <- sign(respl) * .expr2^(1/f)
#> .value <- b * .expr4 + e
#> .grad <- array(0, c(length(.value), 5L), list(NULL, c("b", "c", "d", "e", "f")))
#> .grad[, "b"] <- .expr4
#> .grad[, "c"] <- 0
#> .grad[, "d"] <- 0
#> .grad[, "e"] <- 1
#> .grad[, "f"] <- -(b * (.expr4 * (log(.expr2) * (1/f^2))))
#> attr(.value, "gradient") <- .grad
#> .value
#> }
#> EDp <- EDfct(parmVec[1], parmVec[2], parmVec[3], parmVec[4], parmVec[5])
#> EDder <- attr(EDfct(parmVec[1], parmVec[2], parmVec[3], parmVec[4], parmVec[5]), "gradient")
#> return(list(EDp, EDder[notFixed]))
#> }
#> <bytecode: 0x55a5f68662c0>
#> <environment: 0x55a61e3e5f68>
#>
#> $name
#> [1] "family"
#>
#> $text
#> [1] "Gaussian"
#>
#> $noParm
#> [1] 5
#>
#> $lowerAs
#> function(parm)
#> {
#> parmVec[indexVec] <- parm
#> parmVec[parmNo]
#> }
#> <bytecode: 0x55a5f6d3c458>
#> <environment: 0x55a618e5bd80>
#>
#> $upperAs
#> function(parm)
#> {
#> parmVec[indexVec] <- parm
#> parmVec[parmNo]
#> }
#> <bytecode: 0x55a5f6d3c458>
#> <environment: 0x55a618e5bae0>
#>
#> $monoton
#> [1] NA
#>
#> $fixed
#> [1] NA NA NA NA NA
#>
#> attr(,"class")
#> [1] "gaussian"
#> Error in glm(formula = Income ~ Frost + Murder, family = gaussian, data = ds): 'family' not recognized