R/08_regmedint_class_user_methods.R
confint.regmedint.Rd
Construct Wald approximate confidence intervals for the quantities of interest.
# S3 method for regmedint
confint(
object,
parm = NULL,
level = 0.95,
a0 = NULL,
a1 = NULL,
m_cde = NULL,
c_cond = NULL,
...
)
An object of the regmedint
class.
For compatibility with generic. Ignored.
A numeric vector of length one. Requested confidence level. Defaults to 0.95.
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 generic.
A numeric matrix of the lower limit and upper limit.
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)
confint(regmedint_obj)
#> lower upper
#> cde -0.03560858 1.11775019
#> pnde 0.07637274 0.90148809
#> tnie -0.05439841 0.09087846
#> tnde 0.08280410 0.91420281
#> pnie -0.04485951 0.06219348
#> te 0.09381303 0.92052785
#> pm -0.13330488 0.22417743
#> 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
confint(regmedint_obj, m_cde = 0, c_cond = 1)
#> lower upper
#> cde -0.14886090 1.03037403
#> pnde 0.08040695 0.90420550
#> tnie -0.05352857 0.08968272
#> tnde 0.08167823 0.92185214
#> pnie -0.04444765 0.06168388
#> te 0.09463237 0.92613422
#> pm -0.12941682 0.21904962
#> attr(,"args")
#> attr(,"args")$a0
#> [1] 0
#>
#> attr(,"args")$a1
#> [1] 1
#>
#> attr(,"args")$m_cde
#> [1] 0
#>
#> attr(,"args")$c_cond
#> [1] 1
#>
## Change confidence level
confint(regmedint_obj, m_cde = 0, c_cond = 1, level = 0.99)
#> lower upper
#> cde -0.33413214 1.21564526
#> pnde -0.04902118 1.03363363
#> tnie -0.07602870 0.11218285
#> tnde -0.05032266 1.05385303
#> pnie -0.06112213 0.07835835
#> te -0.03600604 1.05677263
#> pm -0.18416486 0.27379767
#> attr(,"args")
#> attr(,"args")$a0
#> [1] 0
#>
#> attr(,"args")$a1
#> [1] 1
#>
#> attr(,"args")$m_cde
#> [1] 0
#>
#> attr(,"args")$c_cond
#> [1] 1
#>