This is a generic S3 function that gets the variance-covariance matrix of fixed effects of a statistical model, implemented on a wide range of models and that can be extended to new models.
vcov_fixcoef(model, ...)# S3 method for default
vcov_fixcoef(model, ...)
# S3 method for survreg
vcov_fixcoef(model, ...)
a fitted statistical model
argument unused by p_value_contrast.default
but that may be useful to some specializations.
default
: default implementation, simple proxy of vcov(model)
survreg
: implementation for survreg, removing the extra column for Scale
It must return variance-covariance for fixed effects of a model, not random effects nor scale parameters.
The rownames
and colnames
of the returned matrix
must be consistent with names
of fixcoef(object)
.
The functions vcov_fixcoef
and fixcoef
would be pointless if the behavior of
vcov
and coef
were not inconsistent from package to package.
fixcoef
and vcov_fixcoef
, together with df_for_wald
are used by p_value_contrast.default
Other Wald-related functions:
df_for_wald()
,
fixcoef()
,
p_value_contrast()
# NOT RUN {
data(mtcars)
mod = lm(data=mtcars, hp ~ cyl+wt)
est = fixcoef(mod) # get estimates
SE = sqrt(diag(vcov_fixcoef(mod))) # get standard errors of estimates
z = est/SE # get z-score of estimates
df = df_for_wald(mod) # degrees of freedom
pvalues = 2*pt(-abs(z), df=df) # get two-sided P-values
# }
Run the code above in your browser using DataLab