R/RcppExports.R

Defines functions screen_sparse_cpp screen_cpp

Documented in screen_cpp screen_sparse_cpp

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Sure Independence Screening in Step 2
#'
#' @param x a n-by-p matrix of main effects, with i.i.d rows, and each row represents a vector of observations of p main-effects
#' @param y a vector of length n. In sprinter, y is the residual from step 1
#' @param num_keep the number of candidate interactions in Step 2. Default to be n / [log n]
#' @param square An indicator of whether squared effects should be considered in Step 1 (NOT Step 2!). square == TRUE if squared effects have been considered in Step 1, i.e., squared effects will NOT be considered in Step 2.
#' @param main_effect An indicator of whether main effects should also be screened. Default to be false. The functionality of main_effect = true is not used in sprinter, but for SIS_lasso.
#' @return an matrix of 3 columns, representing the index pair of the selected interactions, and the corresponding absolute correlation with the residual.
#' @export
screen_cpp <- function(x, y, num_keep, square = FALSE, main_effect = FALSE) {
    .Call('_sprintr_screen_cpp', PACKAGE = 'sprintr', x, y, num_keep, square, main_effect)
}

#' Sure Independence Screening in Step 2 for sparse design matrix
#'
#' @param x a n-by-p sparse matrix of main effects
#' @param y a vector of length n. In sprinter, y is the residual from step 1
#' @param num_keep the number of candidate interactions in Step 2. Default to be n / [log n]
#' @param square An indicator of whether squared effects should be considered in Step 1 (NOT Step 2!). square == TRUE if squared effects have been considered in Step 1, i.e., squared effects will NOT be considered in Step 2.
#' @param main_effect An indicator of whether main effects should also be screened. Default to be false. The functionality of main_effect = true is not used in sprinter, but for SIS_lasso.
#' @return an matrix of 3 columns, representing the index pair of the selected interactions, and the corresponding absolute correlation with the residual.
#' @export
screen_sparse_cpp <- function(x, y, num_keep, square = FALSE, main_effect = FALSE) {
    .Call('_sprintr_screen_sparse_cpp', PACKAGE = 'sprintr', x, y, num_keep, square, main_effect)
}
hugogogo/sprintr documentation built on Dec. 14, 2021, 6:07 p.m.