R/08_regmedint_class_user_methods.R
vcov.regmedint.Rd
Extract variance estimates evaluated at a0
, a1
, m_cde
, and c_cond
.
# S3 method for regmedint
vcov(object, a0 = NULL, a1 = NULL, m_cde = NULL, c_cond = NULL, ...)
An object of the regmedint
class.
A numeric vector of length 1
A numeric vector of length 1
A numeric vector of length 1 The mediator value at which the controlled direct effect (CDE) conditional on the adjustment covariates is evaluated. If not provided, the default value supplied to the call to regmedint
will be used. Only the CDE is affected.
A numeric vector of the same length as cvar
. A set of covariate values at which the conditional natural effects are evaluated.
For compatibility with the generic. Ignored.
A numeric matrix with the diagonals populated with variance estimates. Off-diagnonals are NA since these are not estimated.
library(regmedint)
data(vv2015)
regmedint_obj <- regmedint(data = vv2015,
## Variables
yvar = "y",
avar = "x",
mvar = "m",
cvar = c("c"),
eventvar = "event",
## Values at which effects are evaluated
a0 = 0,
a1 = 1,
m_cde = 1,
c_cond = 0.5,
## Model types
mreg = "logistic",
yreg = "survAFT_weibull",
## Additional specification
interaction = TRUE,
casecontrol = FALSE)
vcov(regmedint_obj)
#> cde pnde tnie tnde pnie te
#> cde 0.08657105 NA NA NA NA NA
#> pnde NA 0.04430708 NA NA NA NA
#> tnie NA NA 0.001373526 NA NA NA
#> tnde NA NA NA 0.04498446 NA NA
#> pnie NA NA NA NA 0.0007458327 NA
#> te NA NA NA NA NA 0.04447903
#> pm NA NA NA NA NA NA
#> pm
#> cde NA
#> pnde NA
#> tnie NA
#> tnde NA
#> pnie NA
#> te NA
#> pm 0.008316736
#> attr(,"args")
#> attr(,"args")$a0
#> [1] 0
#>
#> attr(,"args")$a1
#> [1] 1
#>
#> attr(,"args")$m_cde
#> [1] 1
#>
#> attr(,"args")$c_cond
#> [1] 0.5
#>
## Evaluate at different values
vcov(regmedint_obj, m_cde = 0, c_cond = 1)
#> cde pnde tnie tnde pnie te
#> cde 0.09049915 NA NA NA NA NA
#> pnde NA 0.04416578 NA NA NA NA
#> tnie NA NA 0.001334745 NA NA NA
#> tnde NA NA NA 0.04593907 NA NA
#> pnie NA NA NA NA 0.0007330485 NA
#> te NA NA NA NA NA 0.04499562
#> pm NA NA NA NA NA NA
#> pm
#> cde NA
#> pnde NA
#> tnie NA
#> tnde NA
#> pnie NA
#> te NA
#> pm 0.007902522
#> attr(,"args")
#> attr(,"args")$a0
#> [1] 0
#>
#> attr(,"args")$a1
#> [1] 1
#>
#> attr(,"args")$m_cde
#> [1] 0
#>
#> attr(,"args")$c_cond
#> [1] 1
#>