MY {tlm} | R Documentation |
Expected Adjusted Median or Generalized Mean
Description
This function computes expected measures of the response variable under a linear, logistic or Poisson regression fitted model with transformed variables. Measures can be calculated in both the original and the transformed space. The function automatically provides the name of the measure depending on the fitted model.
Usage
MY(object, x = NULL, npoints = 10, space = c("original", "transformed"),
level = 0.95)
## S3 method for class 'MY'
print(x, ...)
Arguments
object |
an object of class " |
x |
for |
npoints |
numeric. If |
space |
character. If " |
level |
numeric. The confidence level for measures. Default is 0.95. |
... |
further additional arguments for the |
Details
In order to compute adjusted measures, all explanatory variables in the model different than the explanatory variable of interest are set at their means.
If space
is "original
", then the mean (for Poisson response) or the probability (for binary response) is computed. For gaussian response, the mean is computed if the response variable is not transformed; otherwise, the geometric mean (for log transformation in the response) or the median (for power transformation) is computed.
If space
is "transformed
", then the mean (for Poisson response or transformed gaussian response), or the logodds (for binary response) is computed.
If x
is NULL
, the measure is computed in npoints
values of the explanatory variable of interest. Those values are choosen to be in arithmetic progression in the given space
, inside the observed range of the explanatory variable.
Value
M |
adjusted measure of the response variable. See ‘Details’. |
ymeasure |
the type of measure for |
space |
space where measures has been computed (" |
ypow |
numeric power transformation assumed in the response variable. See |
xpow |
numeric power transformation assumed in the explanatory variable of interest. See |
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
, effect
.
Examples
data(feld1)
head(feld1)
# Linear model with log-log transformation, adjusting for variable 'cat':
modcat <- tlm(y = logroom, x = logmattress, z = cat, data = feld1, ypow = 0, xpow = 0)
summary(modcat)
# Geometric mean of the response as a function of the explanatory variable,
# adjusted for 'cat':
MY(modcat)
MY(modcat, npoints = 3)
# computed at 1st and 3rd quartiles of the explanatory variable:
MY(modcat, x = quantile(feld1$mattress, probs = c(1, 3)/4))
# Mean of the log(response) as a function of the log explanatory variable,
# adjusted for 'cat':
MY(modcat, space = "transformed")