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.
Usage
# S3 method for geeglm
tidy(x, conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE, ...)
Arguments
- x
A
geeglm
object returned from a call togeepack::geeglm()
.- conf.int
Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to
FALSE
.- conf.level
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.- exponentiate
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 passconf.lvel = 0.9
, all computation will proceed usingconf.level = 0.95
. Two exceptions here are:
Details
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.
Value
A tibble::tibble()
with columns:
- conf.high
Upper bound on the confidence interval for the estimate.
- conf.low
Lower bound on the confidence interval for the estimate.
- estimate
The estimated value of the regression term.
- p.value
The two-sided p-value associated with the observed statistic.
- statistic
The value of a T-statistic to use in a hypothesis that the regression term is non-zero.
- std.error
The standard error of the regression term.
- term
The name of the regression term.
Examples
# 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"
)
#> $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: 0x55e23e706478>
#> <environment: 0x55e24e6f80a0>
#>
#> $ssfct
#> function (dframe)
#> {
#> x <- dframe[, 1]
#> y <- dframe[, 2]
#> cdVal <- findcd(x, y)
#> if (useFixed) {
#> }
#> if (logg) {
#> bVal <- 0.75 * sd(log(x[y > quantile(y, 0.75)]))
#> }
#> else {
#> bVal <- 0.75 * sd(x[y > quantile(y, 0.75)])
#> }
#> befVal <- c(bVal, x[which.max(y)], 1)
#> return(c(befVal[1], cdVal, befVal[2:3])[is.na(fixed)])
#> }
#> <bytecode: 0x55e2489927a8>
#> <environment: 0x55e24e6f8ca8>
#>
#> $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: 0x55e23e703950>
#> <environment: 0x55e24e6f80a0>
#>
#> $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: 0x55e23e701d40>
#> <environment: 0x55e24e6f80a0>
#>
#> $edfct
#> function (parm, respl, reference, type, ...)
#> {
#> parmVec[notFixed] <- parm
#> p <- absToRel(parmVec, abs(respl), type)
#> if (identical(type, "absolute")) {
#> p <- 100 - p
#> }
#> if (identical(type, "relative") && (parmVec[1] < 0) && (reference ==
#> "control")) {
#> p <- 100 - p
#> }
#> pProp <- 1 - (100 - p)/100
#> EDfct <- function(b, c, d, e, f) {
#> .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: 0x55e23e6f8b78>
#> <environment: 0x55e24e6f80a0>
#>
#> $name
#> [1] "family"
#>
#> $text
#> [1] "Gaussian"
#>
#> $noParm
#> [1] 5
#>
#> $lowerAs
#> function (parm)
#> {
#> parmVec[indexVec] <- parm
#> parmVec[parmNo]
#> }
#> <bytecode: 0x55e23be053c0>
#> <environment: 0x55e2580f7488>
#>
#> $upperAs
#> function (parm)
#> {
#> parmVec[indexVec] <- parm
#> parmVec[parmNo]
#> }
#> <bytecode: 0x55e23be053c0>
#> <environment: 0x55e2580f76f0>
#>
#> $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
# summarize model fit with tidiers
tidy(geefit)
#> Error in eval(expr, envir, enclos): object 'geefit' not found
tidy(geefit, conf.int = TRUE)
#> Error in eval(expr, envir, enclos): object 'geefit' not found