Description Usage Arguments Value Author(s) See Also Examples
Creates a transformed variable using either the natural log, a dummy transformation, linear splines, or a polynomial. Mostly for use in regression. If a partial formula of the form ~var1 + var2
is entered, returns the formula for use in regression. The partial formula can be named by adding an equals sign before the tilde.
1 2 3 |
... |
variable(s) used to create the transformation. |
type |
a character string describing the transformation. Partial matching is used, so only enough of the string to make the transformation unique is needed. |
subset |
used in creating dummy variables. Only used if |
knots |
vector of knots to create the splines. Only used if |
degree |
the degree of the polynomial to be returned. Only used if |
reference |
the reference vector for levels of the dummy variable. Only used if |
lbl |
a label for the splines. Only used if |
center |
the center of the returned polynomial. Only used if |
includeAll |
a logical value to use all values even in the presense of a subset. Only used if |
parameterization |
defaults to |
vrsn |
if |
A matrix or vector containing the transformations. The class of the returned value is c("transformation", y)
where y
is the class of the transformed variable (usually numeric
). The type of transformation performed is encoded as one of the attributes of the returned value, along with the original data.
Scott S. Emerson, M.D., Ph.D., Andrew J. Spieker, Brian D. Williamson
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Reading in a dataset
mri <- read.table("http://www.emersonstatistics.com/datasets/mri.txt", header=TRUE)
attach(mri)
# Create a spline based on absolute
U(ldl, type="lspline", knots=c(70, 100, 130, 160))
U(ldl, type="ls", knots=c(70,100,130,160))
# Create a spline based on change
U(ldl, type="ls", knots=c(70, 100, 130, 160), parameterization="change")
# Create a log transformed variable
U(age, type="log")
## Create a partial formula
U(ma=~male+age)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.