R/08_regmedint_class_user_methods.R
summary.regmedint.Rd
Summarize 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.
Whether to add exponentiated point and confidence limit estimates. When yreg = "linear"
, it is ignored.
Confidence level for the confidence intervals.
For compatibility with the generic. Ignored.
A summary_regmedint
object, which is a list containing the summary objects of the mreg_fit
and the yreg_fit
as well as the mediation analysis results.
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)
## Detailed result with summary
summary(regmedint_obj)
#> ### Mediator model
#>
#> Call:
#> glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Deviance Residuals:
#> Min 1Q Median 3Q Max
#> -1.5143 -1.1765 0.9177 1.1133 1.4602
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.3545 0.3252 -1.090 0.276
#> x 0.3842 0.4165 0.922 0.356
#> c 0.2694 0.2058 1.309 0.191
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 138.59 on 99 degrees of freedom
#> Residual deviance: 136.08 on 97 degrees of freedom
#> AIC: 142.08
#>
#> Number of Fisher Scoring iterations: 4
#>
#> ### Outcome model
#>
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#> Value Std. Error z p
#> (Intercept) -1.0424 0.1903 -5.48 4.3e-08
#> x 0.4408 0.3008 1.47 0.14
#> m 0.0905 0.2683 0.34 0.74
#> c -0.0669 0.0915 -0.73 0.46
#> x:m 0.1003 0.4207 0.24 0.81
#> Log(scale) -0.0347 0.0810 -0.43 0.67
#>
#> Scale= 0.966
#>
#> Weibull distribution
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.18
#> Number of Newton-Raphson Iterations: 5
#> n= 100
#>
#> ### Mediation analysis
#> est se Z p lower upper
#> cde 0.541070807 0.29422958 1.8389409 0.06592388 -0.03560858 1.11775019
#> pnde 0.488930417 0.21049248 2.3227928 0.02019028 0.07637274 0.90148809
#> tnie 0.018240025 0.03706111 0.4921608 0.62260566 -0.05439841 0.09087846
#> tnde 0.498503455 0.21209540 2.3503737 0.01875457 0.08280410 0.91420281
#> pnie 0.008666987 0.02730994 0.3173565 0.75097309 -0.04485951 0.06219348
#> te 0.507170442 0.21090051 2.4047853 0.01618197 0.09381303 0.92052785
#> pm 0.045436278 0.09119614 0.4982259 0.61832484 -0.13330488 0.22417743
#>
#> Evaluated at:
#> avar: x
#> a1 (intervened value of avar) = 1
#> a0 (reference value of avar) = 0
#> mvar: m
#> m_cde (intervend value of mvar for cde) = 1
#> cvar: c
#> c_cond (covariate vector value) = 0.5
#>
#> Note that effect estimates can vary over m_cde and c_cond values when interaction = TRUE.
## Add exponentiate results for non-linear outcome models
summary(regmedint_obj, exponentiate = TRUE)
#> ### Mediator model
#>
#> Call:
#> glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Deviance Residuals:
#> Min 1Q Median 3Q Max
#> -1.5143 -1.1765 0.9177 1.1133 1.4602
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.3545 0.3252 -1.090 0.276
#> x 0.3842 0.4165 0.922 0.356
#> c 0.2694 0.2058 1.309 0.191
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 138.59 on 99 degrees of freedom
#> Residual deviance: 136.08 on 97 degrees of freedom
#> AIC: 142.08
#>
#> Number of Fisher Scoring iterations: 4
#>
#> ### Outcome model
#>
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#> Value Std. Error z p
#> (Intercept) -1.0424 0.1903 -5.48 4.3e-08
#> x 0.4408 0.3008 1.47 0.14
#> m 0.0905 0.2683 0.34 0.74
#> c -0.0669 0.0915 -0.73 0.46
#> x:m 0.1003 0.4207 0.24 0.81
#> Log(scale) -0.0347 0.0810 -0.43 0.67
#>
#> Scale= 0.966
#>
#> Weibull distribution
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.18
#> Number of Newton-Raphson Iterations: 5
#> n= 100
#>
#> ### Mediation analysis
#> est se Z p lower upper
#> cde 0.541070807 0.29422958 1.8389409 0.06592388 -0.03560858 1.11775019
#> pnde 0.488930417 0.21049248 2.3227928 0.02019028 0.07637274 0.90148809
#> tnie 0.018240025 0.03706111 0.4921608 0.62260566 -0.05439841 0.09087846
#> tnde 0.498503455 0.21209540 2.3503737 0.01875457 0.08280410 0.91420281
#> pnie 0.008666987 0.02730994 0.3173565 0.75097309 -0.04485951 0.06219348
#> te 0.507170442 0.21090051 2.4047853 0.01618197 0.09381303 0.92052785
#> pm 0.045436278 0.09119614 0.4982259 0.61832484 -0.13330488 0.22417743
#> exp(est) exp(lower) exp(upper)
#> cde 1.717845 0.9650179 3.057967
#> pnde 1.630571 1.0793648 2.463266
#> tnie 1.018407 0.9470547 1.095136
#> tnde 1.646256 1.0863290 2.494786
#> pnie 1.008705 0.9561318 1.064168
#> te 1.660586 1.0983544 2.510615
#> pm NA NA NA
#>
#> Evaluated at:
#> avar: x
#> a1 (intervened value of avar) = 1
#> a0 (reference value of avar) = 0
#> mvar: m
#> m_cde (intervend value of mvar for cde) = 1
#> cvar: c
#> c_cond (covariate vector value) = 0.5
#>
#> Note that effect estimates can vary over m_cde and c_cond values when interaction = TRUE.
## Evaluate at different values
summary(regmedint_obj, m_cde = 0, c_cond = 1)
#> ### Mediator model
#>
#> Call:
#> glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Deviance Residuals:
#> Min 1Q Median 3Q Max
#> -1.5143 -1.1765 0.9177 1.1133 1.4602
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.3545 0.3252 -1.090 0.276
#> x 0.3842 0.4165 0.922 0.356
#> c 0.2694 0.2058 1.309 0.191
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 138.59 on 99 degrees of freedom
#> Residual deviance: 136.08 on 97 degrees of freedom
#> AIC: 142.08
#>
#> Number of Fisher Scoring iterations: 4
#>
#> ### Outcome model
#>
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#> Value Std. Error z p
#> (Intercept) -1.0424 0.1903 -5.48 4.3e-08
#> x 0.4408 0.3008 1.47 0.14
#> m 0.0905 0.2683 0.34 0.74
#> c -0.0669 0.0915 -0.73 0.46
#> x:m 0.1003 0.4207 0.24 0.81
#> Log(scale) -0.0347 0.0810 -0.43 0.67
#>
#> Scale= 0.966
#>
#> Weibull distribution
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.18
#> Number of Newton-Raphson Iterations: 5
#> n= 100
#>
#> ### Mediation analysis
#> est se Z p lower upper
#> cde 0.440756562 0.30083077 1.4651313 0.14288511 -0.14886090 1.03037403
#> pnde 0.492306223 0.21015655 2.3425690 0.01915149 0.08040695 0.90420550
#> tnie 0.018077074 0.03653416 0.4947991 0.62074191 -0.05352857 0.08968272
#> tnde 0.501765186 0.21433402 2.3410432 0.01922994 0.08167823 0.92185214
#> pnie 0.008618111 0.02707487 0.3183067 0.75025232 -0.04444765 0.06168388
#> te 0.510383297 0.21212172 2.4060870 0.01612443 0.09463237 0.92613422
#> pm 0.044816400 0.08889613 0.5041434 0.61416060 -0.12941682 0.21904962
#>
#> Evaluated at:
#> avar: x
#> a1 (intervened value of avar) = 1
#> a0 (reference value of avar) = 0
#> mvar: m
#> m_cde (intervend value of mvar for cde) = 0
#> cvar: c
#> c_cond (covariate vector value) = 1
#>
#> Note that effect estimates can vary over m_cde and c_cond values when interaction = TRUE.
## Change confidence level
summary(regmedint_obj, m_cde = 0, c_cond = 1, level = 0.99)
#> ### Mediator model
#>
#> Call:
#> glm(formula = m ~ x + c, family = binomial(link = "logit"), data = data)
#>
#> Deviance Residuals:
#> Min 1Q Median 3Q Max
#> -1.5143 -1.1765 0.9177 1.1133 1.4602
#>
#> Coefficients:
#> Estimate Std. Error z value Pr(>|z|)
#> (Intercept) -0.3545 0.3252 -1.090 0.276
#> x 0.3842 0.4165 0.922 0.356
#> c 0.2694 0.2058 1.309 0.191
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#> Null deviance: 138.59 on 99 degrees of freedom
#> Residual deviance: 136.08 on 97 degrees of freedom
#> AIC: 142.08
#>
#> Number of Fisher Scoring iterations: 4
#>
#> ### Outcome model
#>
#> Call:
#> survival::survreg(formula = Surv(y, event) ~ x + m + x:m + c,
#> data = data, dist = "weibull")
#> Value Std. Error z p
#> (Intercept) -1.0424 0.1903 -5.48 4.3e-08
#> x 0.4408 0.3008 1.47 0.14
#> m 0.0905 0.2683 0.34 0.74
#> c -0.0669 0.0915 -0.73 0.46
#> x:m 0.1003 0.4207 0.24 0.81
#> Log(scale) -0.0347 0.0810 -0.43 0.67
#>
#> Scale= 0.966
#>
#> Weibull distribution
#> Loglik(model)= -11.4 Loglik(intercept only)= -14.5
#> Chisq= 6.31 on 4 degrees of freedom, p= 0.18
#> Number of Newton-Raphson Iterations: 5
#> n= 100
#>
#> ### Mediation analysis
#> est se Z p lower upper
#> cde 0.440756562 0.30083077 1.4651313 0.14288511 -0.33413214 1.21564526
#> pnde 0.492306223 0.21015655 2.3425690 0.01915149 -0.04902118 1.03363363
#> tnie 0.018077074 0.03653416 0.4947991 0.62074191 -0.07602870 0.11218285
#> tnde 0.501765186 0.21433402 2.3410432 0.01922994 -0.05032266 1.05385303
#> pnie 0.008618111 0.02707487 0.3183067 0.75025232 -0.06112213 0.07835835
#> te 0.510383297 0.21212172 2.4060870 0.01612443 -0.03600604 1.05677263
#> pm 0.044816400 0.08889613 0.5041434 0.61416060 -0.18416486 0.27379767
#>
#> Evaluated at:
#> avar: x
#> a1 (intervened value of avar) = 1
#> a0 (reference value of avar) = 0
#> mvar: m
#> m_cde (intervend value of mvar for cde) = 0
#> cvar: c
#> c_cond (covariate vector value) = 1
#>
#> Note that effect estimates can vary over m_cde and c_cond values when interaction = TRUE.