| Type: | Package | 
| Title: | Fit Repeated Linear Regressions | 
| SystemRequirements: | GNU Scientific Library (GSL). Note: users should have GSL installed. | 
| Version: | 1.3.0 | 
| Date: | 2023-10-10 | 
| Author: | Lijun Wang [aut, cre, cph] | 
| Maintainer: | Lijun Wang <szcfweiya@gmail.com> | 
| Description: | When fitting a set of linear regressions which have some same variables, we can separate the matrix and reduce the computation cost. This package aims to fit a set of repeated linear regressions faster. More details can be found in this blog Lijun Wang (2017) https://stats.hohoweiya.xyz/regression/2017/09/26/An-R-Package-Fit-Repeated-Linear-Regressions/. | 
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] | 
| URL: | https://github.com/szcf-weiya/fRLR, https://stats.hohoweiya.xyz/regression/2017/09/26/An-R-Package-Fit-Repeated-Linear-Regressions/ | 
| Imports: | Rcpp (≥ 0.12.12) | 
| LinkingTo: | Rcpp | 
| RoxygenNote: | 7.2.3 | 
| Encoding: | UTF-8 | 
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0) | 
| VignetteBuilder: | knitr | 
| Config/testthat/edition: | 3 | 
| NeedsCompilation: | yes | 
| Packaged: | 2023-10-11 23:10:15 UTC; weiya | 
| Repository: | CRAN | 
| Date/Publication: | 2023-10-12 13:20:06 UTC | 
Fit Repeated Linear Regressions with One Variable
Description
Fit a set of linear regressions which differ only in one variable.
Usage
frlr1(R_X, R_Y, R_COV, num_threads = -1L)
Arguments
| R_X | the observation matrix | 
| R_Y | the response | 
| R_COV | common variables | 
| num_threads | number of threads for openmp. If it is -1 (default), it will use all possible threads. | 
Value
the fitting results for each regression.
Examples
set.seed(123)
X = matrix(rnorm(50), 10, 5)
Y = rnorm(10)
COV = matrix(rnorm(40), 10, 4)
frlr1(X, Y, COV)
Fit Repeated Linear Regressions with Two Variables
Description
Fit a set of linear regressions which differ only in two variables.
Usage
frlr2(R_X, R_idx1, R_idx2, R_Y, R_COV, num_threads = -1L)
Arguments
| R_X | the observation matrix | 
| R_idx1 | the first identical feature | 
| R_idx2 | the second identical feature | 
| R_Y | the response variable | 
| R_COV | common variables | 
| num_threads | number of threads for openmp. If it is -1 (default), it will use all possible threads. | 
Value
the fitting results for each regression.
Examples
set.seed(123)
X = matrix(rnorm(50), 10, 5)
Y = rnorm(10)
COV = matrix(rnorm(40), 10, 4)
idx1 = c(1, 2, 3, 4, 1, 1, 1, 2, 2, 3)
idx2 = c(2, 3, 4, 5, 3, 4, 5, 4, 5, 5)
frlr2(X, idx1, idx2, Y, COV)