effect: Effects Estimate in Linear, Logistic and Poisson Regression...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/effect.R

Description

This function 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 estimated in the original scale of the variables.

Usage

1
2
3
4
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, ...)

Arguments

object

an object of class "tlm", a result of a call to tlm.

x1

numeric. The values of the explanatory variable where the effect should be computed. See ‘Details’.

x2

numeric. The alternative values of the explanatory variable (changing from x1) for which the effect should be computed. See ‘Details’.

c

numeric. The additive change in the explanatory variable. See ‘Details’.

q

numeric. The multiplicative change in the explanatory variable. See ‘Details’.

r

numeric. The percent change in the explanatory variable. See ‘Details’.

npoints

numeric. The number of points where the effect should be computed. See ‘Details’.

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’.

seed

numeric. A single value, the seed for bootstrapping. Default is 4321.

verbose

logical. Whether to print detailed progress on R prompt. Default is TRUE.

x

an object of class "effect", a result of a call to effect.

...

further additional arguments passed to the method print.

Details

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 argument are passed, the interquartile range will be considered and a summary effect should be 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.

Value

effect

point estimate and confidence interval for the effect size.

info

information on how to interpret the effect. Used by the function effectInfo.

Author(s)

Barrera-Gomez J and Basagana X.

References

Barrera-Gomez J, Basagana X. Models with transformed variables: interpretation and software. Epidemiology. 2015;26(2):e16-17.

See Also

tlm, effectInfo, MY.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
### Linear model with log transformation in the response variable:
data(imt)
head(imt)

# model fitting:
modimt <- tlm(y = logimt, x = 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)

tlm documentation built on May 2, 2019, 2:11 p.m.