# NOT RUN {
# from fastICA::fastICA
set.seed(131)
S <- matrix(runif(400), 200, 2)
A <- matrix(c(1, 1, -1, 3), 2, 2, byrow = TRUE)
X <- as.data.frame(S %*% A)
tr <- X[1:100, ]
te <- X[101:200, ]
rec <- recipe( ~ ., data = tr)
ica_trans <- step_center(rec, V1, V2)
ica_trans <- step_scale(ica_trans, V1, V2)
ica_trans <- step_ica(ica_trans, V1, V2, num_comp = 2)
if (FALSE) {
ica_estimates <- prep(ica_trans, training = tr)
ica_data <- bake(ica_estimates, te)
plot(te$V1, te$V2)
plot(ica_data$IC1, ica_data$IC2)
tidy(ica_trans, number = 3)
tidy(ica_estimates, number = 3)
}
# }
Run the code above in your browser using DataLab