standardized-class {standardize}R Documentation

Class standardized containing regression variables in a standardized space.

Description

The standardize function returns a list of class standardized, which has a print method, and which can additionally be used to place new data into the same standardized space as the data passed in the call to standardize using the predict function. The standardized list contains the following elements.

Details

call

The call to standardize which created the object.

scale

The scale argument to standardize.

formula

The regression formula in standardized space (with new names) which can be used along with the data element to fit regressions. It has an attribute standardized.scale which is the same as the scale element of the object (this allows users and package developers to write regression-fitting functions which can tell if the input is from a standardized object).

family

The regression family.

data

A data frame containing the regression variables in a standardized space (renamed to have valid variable names corresponding to those in the formula element).

offset

The offset passed through the offset argument to standardize (scaled if family = gaussian), or NULL if the offset argument was not used.

pred

A list containing unevaluated calls which allow the predict method to work.

variables

A data frame with the name of the original variable, the corresponding name in the standardized data frame and formula, and the class of the variable in the standardized data frame.

contrasts

A named list of contrasts for all factors included as predictors, or NULL if no predictors are factors.

groups

A named list of levels for random effects grouping factors, or NULL if there are no random effects.

In the variables data frame, the Variable column contains the name of the variable in the original formula passed to standardize. The Standardized Name column contains the name of the variable in the standardized formula and data frame. The original variable name is altered such that the original name is still recoverable but is also a valid variable name for regressions run using the formula and data elements of the standardized object. For example, exp(x) would become exp_x and log(x + 1) would become log_x.p.1. If the indicator function is used, this can lead to a long and possibly difficult to interpret name; e.g. I(x1 > 0 & x2 < 0) would become I_x1.g.0.a.x2.l.0. In such cases, it is better to create the variable explicitly in the data frame and give it a meaningful name; in this case, something like mydata$x1Pos_x2Neg <- mydata$x1 > 0 & mydata$x2 < 0, and then use x1Pos_x2Neg in the call to standardize. The Class column in the variables data frame takes the following values (except for non-gaussian responses, which are left unaltered, and so may have a different class; the class for the response is always preceded by response.).

numeric

A numeric vector.

poly

A numeric matrix resulting from a call to poly.

scaledby

A numeric vector resulting from a call to scale_by.

scaledby.poly

A numeric matrix resulting from a call to poly nested within a call to scale_by.

factor

An unordered factor.

ordered

An ordered factor.

group

A random effects grouping factor.

offset

If the offset function was used within the formula passed to standardize, then the variable is numeric and labeled as offset. The formula element of the standardize object contains offset calls to ensure regression fitting functions use them properly. If the offset argument was used in the call to standardize (rather than putting offset calls in the formula), then the offset is not in the variables data frame (it is in the offset element of the standardized object).

The standardized object has a printing method which displays the call, formula, and variable frame along with an explanation of the standardization. The is.standardized function returns TRUE if an object is the result of a call to standardize and FALSE otherwise. The predict method places new data into the same standardized space as the data passed to the original standardize call.

Author(s)

Christopher D. Eager <eager.stats@gmail.com>


[Package standardize version 0.2.2 Index]