Print the mreg_fit
, yreg_fit
, and the mediation analysis effect estimates.
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.
A named list of argument to be passed to the method for the mreg_fit
object.
A named list of argument to be passed to the method for the mreg_fit
object.
For compatibility with the generic. Ignored.
Invisibly return the regmedint
class object as is.
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)
## Implicit printing
regmedint_obj
#> ### Mediator model
#>
#> Call: glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Coefficients:
#> (Intercept) x c
#> -0.3545 0.3842 0.2694
#>
#> Degrees of Freedom: 99 Total (i.e. Null); 97 Residual
#> Null Deviance: 138.6
#> Residual Deviance: 136.1 AIC: 142.1
#> ### Outcome model
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#>
#> Coefficients:
#> (Intercept) x m c x:m
#> -1.04244118 0.44075656 0.09053705 -0.06689165 0.10031424
#>
#> Scale= 0.9658808
#>
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.177
#> n= 100
#> ### Mediation analysis
#> cde pnde tnie tnde pnie te
#> 0.541070807 0.488930417 0.018240025 0.498503455 0.008666987 0.507170442
#> pm
#> 0.045436278
## Explicit printing
print(regmedint_obj)
#> ### Mediator model
#>
#> Call: glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Coefficients:
#> (Intercept) x c
#> -0.3545 0.3842 0.2694
#>
#> Degrees of Freedom: 99 Total (i.e. Null); 97 Residual
#> Null Deviance: 138.6
#> Residual Deviance: 136.1 AIC: 142.1
#> ### Outcome model
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#>
#> Coefficients:
#> (Intercept) x m c x:m
#> -1.04244118 0.44075656 0.09053705 -0.06689165 0.10031424
#>
#> Scale= 0.9658808
#>
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.177
#> n= 100
#> ### Mediation analysis
#> cde pnde tnie tnde pnie te
#> 0.541070807 0.488930417 0.018240025 0.498503455 0.008666987 0.507170442
#> pm
#> 0.045436278
## Evaluate at different values
print(regmedint_obj, m_cde = 0, c_cond = 1)
#> ### Mediator model
#>
#> Call: glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Coefficients:
#> (Intercept) x c
#> -0.3545 0.3842 0.2694
#>
#> Degrees of Freedom: 99 Total (i.e. Null); 97 Residual
#> Null Deviance: 138.6
#> Residual Deviance: 136.1 AIC: 142.1
#> ### Outcome model
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#>
#> Coefficients:
#> (Intercept) x m c x:m
#> -1.04244118 0.44075656 0.09053705 -0.06689165 0.10031424
#>
#> Scale= 0.9658808
#>
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.177
#> n= 100
#> ### Mediation analysis
#> cde pnde tnie tnde pnie te
#> 0.440756562 0.492306223 0.018077074 0.501765186 0.008618111 0.510383297
#> pm
#> 0.044816400