effect | R Documentation |
Estimates the effect of a explanatory variable of interest on a response variable, under a fitted linear, logistic or Poisson regression model with transformed variables. The effect is reported in the original scale of the variables.
effect(
object,
x1 = NULL,
x2 = NULL,
c = NULL,
q = NULL,
r = NULL,
npoints = NULL,
level = 0.95,
nboot = 999,
seed = 4321,
verbose = TRUE
)
## S3 method for class 'effect'
print(x, ...)
object |
object of class " |
x1 |
numeric. The values of the explanatory variable where the effect should be computed. See Details below. |
x2 |
numeric. The alternative values of the explanatory variable
(changing from |
c |
numeric. The additive change in the explanatory variable. See Details below. |
q |
numeric. The multiplicative change in the explanatory variable. See Details below. |
r |
numeric. The percent change in the explanatory variable. See Details below. |
npoints |
numeric. The number of points where the effect should be computed. See Details below. |
level |
numeric. Confidence level for the effect estimate. Default is 0.95. |
nboot |
numeric. The number of non parametric bootstrap samples to compute confidence intervals. Default is 999. See Details below. |
seed |
numeric. A single value, the seed for bootstrapping. Default is 4321. |
verbose |
logical. Whether to print detailed progress on R prompt.
Default is |
x |
for |
... |
additional arguments for |
In order to compute the effect, both the initial and the final values
of the explanatory should be provided. It can be done in several ways. For
instance, providing, x1
and x2
; x1
and one of c
,
q
or r
; x1
, npoints
and one of c
,
q
or r
. Only one of the arguments c
, q
or
r
is used, prevailing c
and then q
. If no enough
arguments are passed, the interquartile range will be considered and a
summary effect is computed, if it exists.
Confidence intervals are computed by transforming the endpoints of the intervals in the transformed scale when it is possible, while non-parametric bootstrap is used otherwise.
A list with class "effect
" including the following items:
point estimate and confidence interval for the effect size.
information on how to interpret the effect. Used by the function
effectInfo
.
Barrera-Gomez J, Basagana X. Models with transformed variables: interpretation and software. Epidemiology. 2015;26(2):e16-17.
tlm
, effectInfo
, MY
.
### Linear model with log transformation in the response variable:
data(imt)
head(imt)
# model fitting:
modimt <- tlm(logimt ~ age, data = imt, ypow = 0)
modimt
# information on interpreting the effect:
effectInfo(modimt)
# the function effect provides as default the expected change in IMT
# for an additive change in age equal to the interquartile range:
effect(modimt)
# other effects:
(minage <- min(imt$age))
(maxage <- max(imt$age))
effect(modimt, c = maxage - minage)
## Not run:
effect(modimt, x1 = minage, r = 50, npoints = 3)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.