| Extract | R Documentation |
This function extracts specific columns from X based on varind.
It provides an efficient procedure for conducting ABC evaluation,
especially when working with high-dimensional data.
Extract(X, varind, interaction.ind = NULL)
X |
Input data. An optional data frame, or numeric matrix of dimension
|
varind |
A numeric vector of class |
interaction.ind |
A two-column numeric matrix containing all possible
two-way interaction effects. It must be generated outside of this function using
|
Please be aware that this function automatically renames column names
into a designated format (e.g., X.1, X.2 for main effects, and X.1X.2 for
interaction effect, etc), regardless of the original column names in X.
Under no heredity condition, this function can be applied in the context of interaction only linear regression models. See Example section for details.
A numeric matrix is returned.
ABC, initial.
# Extract main effect X1 and X2 from X1,...X4
set.seed(0)
X1 <- matrix(rnorm(20), ncol = 4)
y1 <- X1[, 2] + rnorm(5)
interaction.ind <- t(combn(4,2))
# Extract main effect X1 and interaction effect X1X2 from X1,..X4
Extract(X1, varind = c(1,5), interaction.ind)
# Extract interaction effect X1X2 from X1,...X4
Extract(X1, varind = 5, interaction.ind)
# Extract using duplicated values in varind.
try(Extract(X1, varind = c(1,1), interaction.ind)) # this will not run
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.