R/bdlm_paral.R

Defines functions bdlm_paral

Documented in bdlm_paral

#' Linear regression using MLR-MR algorithm
#' 
#' Linear regression for Big Data using MLR-MR algorithm to perform lm regression with big data :  https://isglobal-brge.github.io/Master_Modelling/dealing-with-big-data-in-r.html#linear-regression-for-big-data
#' 
#' @export
#' 
#' @param Y, numerical matrix column with response variable
#' @param model, numerical matrix with paired observations of the predictor variable X
#' @param blocks, integer with number of blocks we want to split matrix if null matrix is splited in blocks as maximum of 1000 variables per block
#' @param threads, threads (optional) only if bparal = true, number of concurrent threads in parallelization if threads is null then threads =  maximum number of threads available
#' @return Lineal regression coefficients 
#' @examples
#' 
#' \dontrun{
#'     library(BigDataStatMeth)
#'     data(mtcars)
#' 
#'     Y <- mtcars$mpg
#'     X <- model.matrix(~ wt + cyl, data=mtcars)
#'     m <- 4
#'     res <- bdlm_paral( X, Y, m, 1)
#'     res
#' }
#' 
#' 
bdlm_paral <- function( Y, model, blocks, threads = NULL)
{ 
   
   res <- .Call('_BigDataStatMeth_bdMLR_MR', PACKAGE = 'BigDataStatMeth', model, Y, blocks, threads)
   rownames(res) <- colnames(model)
   colnames(res) <- c("coef.")
   return(res)
   
}

Try the BigDataStatMeth package in your browser

Any scripts or data that you put into this service are public.

BigDataStatMeth documentation built on March 30, 2022, 1:07 a.m.