zero_vcov: Zero-out entries of non-focal entries of variance-covariance...

View source: R/effectsfuns.R

zero_vcovR Documentation

Zero-out entries of non-focal entries of variance-covariance matrix.

Description

Transforms entries of variance-covariance of the coefficients corresponding to the non-focal variables to zero.

Usage

zero_vcov(m, focal_vars, complete)

Arguments

focal_vars

a character vector specifying the variable(s) appearing on the right side of the formula of the fitted model. The entries of this variable with be non-zero.

complete

logical indicating if the full variance-covariance matrix should be returned.

mod

fitted model object or a full variance-covariance matrix with terms appearing the same way they appear in the coefficients.

Value

a variance-covariance matrix of the estimated parameters with non-zero entry corresponding to the focal variable.

Examples

set.seed(4567)
x <- rnorm(100, 3, 5)
y <- 0.4 + 0.7*x + rnorm(100)
df <- data.frame(y = y, x = x)
m1 <- lm(y ~ x, df)
print(zero_vcov(m1, "x"))


mac-theobio/effects documentation built on July 6, 2023, 4:19 a.m.