MY | R Documentation |
Computes expected measures of the response variable under a linear, logistic or Poisson regression fitted model with transformed variables. Measures can be reported in both the original and the transformed space. The function automatically provides the name of the measure depending on the fitted model.
MY(
object,
x = NULL,
npoints = 10,
space = c("original", "transformed"),
level = 0.95
)
## S3 method for class 'MY'
print(x, ...)
object |
object of class |
x |
For |
npoints |
numeric. If |
space |
character. If " |
level |
numeric. The confidence level for measures. Default is 0.95. |
... |
additional arguments for |
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
argument in MY
is NULL
, the measure is computed in
npoints
values of the explanatory variable of interest. Those values
are chosen to be in arithmetic progression in the given space
, inside
the observed range of the explanatory variable.
A list with class "MY
" including the following items:
adjusted measure of the response variable. See Details below.
the type of measure for M
.
numeric power transformation assumed in the response variable.
See tlm
.
numeric power transformation assumed in the explanatory variable
of interest. See tlm
.
Barrera-Gomez J, Basagana X. Models with transformed variables: interpretation and software. Epidemiology. 2015;26(2):e16-17.
tlm
, effectInfo
, effect
.
data(feld1)
head(feld1)
# Linear model with log-log transformation, adjusting for variable 'cat':
modcat <- tlm(logroom ~ logmattress + 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.