df_for_wald {glmglrt} | R Documentation |
Gets the degree of freedom for Wald tests involving the model
Description
This generic function is used by p_value_contrast.default
to
get the number of degrees of freedom of the t distribution that
approximates the point estimate of the contrast divided by its standard error.
Usage
df_for_wald(object, ...)
## S3 method for class 'glm'
df_for_wald(object, ...)
## Default S3 method:
df_for_wald(object, ...)
Arguments
object |
statistical model; |
... |
Unused by |
Details
This function is quite similar to df.residual
but it should return Inf when the Student's t
distribution is less appropriate than the normal distribution.
Value
A finite value or Inf for normal distribution approximation.
Methods (by class)
-
glm
: Returnsdf.residual
for linear gaussian models and Inf for all other models in order to make Wald's tests consistent with the behavior ofstats::summary.glm(object)
-
default
: Simple proxy todf.residual
but replaces NAs with Inf
See Also
Other Wald-related functions:
fixcoef()
,
p_value_contrast()
,
vcov_fixcoef()
Examples
# 10 observations, one coefficient, 9 degrees of freedom
df_for_wald(glm(I(1:10) ~ 1))
# returns Inf (non-gaussian-identity model)
df_for_wald(glm(family="poisson", c(10,20,30) ~ 1))
data(mtcars)
# returns Inf (non-gaussian-identity model)
df_for_wald(glm(family="binomial", data=mtcars, I(hp > median(hp)) ~ cyl))