Learn R Programming

FindIt (version 0.5)

maketwoway: Constructing a named matrix of all two-way interactions.

Description

maketwoway takes a set of pre-treatment covariates and returns all sensible two-way interactions.

Usage

maketwoway(X, wts = 1, center = TRUE, deletion = TRUE, threshold = 0.99999, frame.meanPre, predict = FALSE)

Arguments

X
A matrix of pre-treatment covariates.
wts
An optional set of extrapolation weights.
center
Whether the columns should be centered before interacting.
deletion
Whether to automatically drop pairwise linearly dependent columns and columns of all 0's or 1's.
threshold
Threshold to drop correlated columns.
frame.meanPre
An argument to use when maketwoway is called within predict.FindIt.
predict
An argument to use when maketwoway is called within predict.FindIt.

Value

X
A matrix with all linear terms, squared terms, and two-way interactions from the original matrix.
scale.X
A vector of weights for reutrning X to its original scale.

Details

Useful for constructing a matrix for FindIt. Takes a matrix and returns a matrix of two-way interactions. A named matrix with an intercept, all two-way interactions and square terms are returned. If center=TRUE, interactions are formed by (1) centering, (2) scaling to sd 1, and (3) interacting. Non-sensible interactions, such as interacting dummy variables for male and female, as well as squared terms for dummy variables, are not returned. A rescaling vector is returned, so that the columns of the standardized matrix can be returned to their original scale.

Examples

Run this code
#See the help page for FindIt() for an example.
	

Run the code above in your browser using DataLab