make_sq_inter {FSM} | R Documentation |
Squares and two-way interactions of variables
Description
Generates squares and/or two-way interactions (pairwise products) of the columns of a data frame.
Usage
make_sq_inter(
data_frame,
is_square = TRUE,
is_inter = TRUE,
keep_marginal = TRUE
)
Arguments
data_frame |
Data frame containing the variables whose squares and interactions are to be created. |
is_square |
If |
is_inter |
If |
keep_marginal |
If |
Value
A data frame containing the squares and/or pairwise products of data_frame
.
Author(s)
Ambarish Chattopadhyay, Carl N. Morris and Jose R. Zubizarreta.
Examples
# Consider a data frame with N = 12 units and 2 covariates.
data_frame_sample = data.frame(male = c(rep(1,6),rep(0,6)),
age = c(20,30,40,40,50,60,20,30,40,40,50,60))
# Get a data frame with all possible squares and first order interactions.
make_sq_inter(data_frame = data_frame_sample, is_square = TRUE,
is_inter = TRUE, keep_marginal = FALSE)
[Package FSM version 1.0.0 Index]