Skip to content

Commit

Permalink
added rdpack for ubuntu check
Browse files Browse the repository at this point in the history
  • Loading branch information
rajitachandak committed Mar 20, 2024
1 parent 61e9188 commit 5c9f65c
Show file tree
Hide file tree
Showing 18 changed files with 103 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- run: sudo apt-get install -y libharfbuzz-dev
- run: sudo apt-get install -y libfribidi-dev
- run: mkdir R_packages/
- run: Rscript -e 'install.packages(c("Matrix", "Rcpp", "ggplot2", "purrr", "MASS", "mvtnorm", "combinat", "stats", "covr", "testthat", "devtools", "spam", "roxygen2", "RcppArmadillo"), lib="./R_packages/")'
- run: Rscript -e 'install.packages(c("Matrix", "Rcpp", "ggplot2", "purrr", "MASS", "mvtnorm", "combinat", "stats", "covr", "testthat", "devtools", "spam", "roxygen2", "Rdpack", "RcppArmadillo"), lib="./R_packages/")'
- run: cd R/lpcde/ && Rscript -e '.libPaths("../../R_packages/"); library(covr); cov = package_coverage(); to_cobertura(cov)'
- uses: codecov/codecov-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions R/lpcde/R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#' @title All Sums in C++ (Internal Function)
#' @description Function that prints all combinations of natural numbers that
#' add up to target value.
#' @param target target value for sum.
#' @return list of combinations that add up to target value.
#' @param Target target value for sum.
#' @return List of combinations that add up to target value.
#' @keywords internal
print_all_sumC <- function(target) {
.Call(`_lpcde_print_all_sumC`, target)
Expand Down
8 changes: 4 additions & 4 deletions R/lpcde/R/lpcde.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
#' bandwidth selected for each grid point)
# or (2) \code{"mse-rot"} (rule-of-thumb bandwidth with Gaussian
# reference model).
#' @param ng int. number of grid points to be used. generates evenly space points over the support of the data.
#' @param grid_spacing String. If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points.
#' @param normalize Boolean. False (default) returns original estimator, True normalizes estimates to integrate to 1.
#' @param nonneg Boolean. False (default) returns original estimator, True returns maximum of estimate and 0.
#' @param ng Int, number of grid points to be used. generates evenly space points over the support of the data.
#' @param grid_spacing String, If equal to "quantile" will generate quantile-spaced grid evaluation points, otherwise will generate equally spaced points.
#' @param normalize Boolean, False (default) returns original estimator, True normalizes estimates to integrate to 1.
#' @param nonneg Boolean, False (default) returns original estimator, True returns maximum of estimate and 0.
#' @return
#' \item{Estimate}{ A matrix containing (1) \code{grid} (grid points),\cr
#' (2) \code{bw} (bandwidths),\cr
Expand Down
44 changes: 22 additions & 22 deletions R/lpcde/R/matrices.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#######################################################################################

#' @title Sx Matrix (Internal Function)
#' @description S_x matrix constructed as described in *ref main paper*.
#' @param x_data data of covariates.
#' @param q maximum degree for x.
#' @param kernel_type type of kernel function.
#' @description S_x matrix.
#' @param x_data Data of covariates.
#' @param q Maximum degree for x.
#' @param kernel_type Type of kernel function.
#' @return S_x matrix
#' @keywords internal
S_x = function(x_data, q, kernel_type){
Expand All @@ -33,12 +33,12 @@ S_x = function(x_data, q, kernel_type){

#' @title c_x vector (Internal Function)
#' @description c_x vector generated as described in main paper.
#' @param x_data data of covariates.
#' @param eval_pt evaluation point.
#' @param m order of polynomial.
#' @param q maximum degree for x.
#' @param h bandwidth.
#' @param kernel_type type of kernel function.
#' @param x_data Data of covariates.
#' @param eval_pt Evaluation point.
#' @param m Order of polynomial.
#' @param q Maximum degree for x.
#' @param h Bandwidth.
#' @param kernel_type Type of kernel function.
#' @keywords internal
c_x = function(x_data, eval_pt, m, q, h, kernel_type){
# setting kernel and dimension of x data
Expand Down Expand Up @@ -102,13 +102,13 @@ c_x = function(x_data, eval_pt, m, q, h, kernel_type){


#' @title T_x matrix (Internal Function)
#' @description constructing the Tx matrix as described in the supplemental appendix.
#' @param x_data data of covariates.
#' @param eval_pt evaluation point.
#' @param q polynomial order for covariates.
#' @param h bandwidth.
#' @param kernel_type type of kernel function.
#' @return matrix.
#' @description Constructing the Tx matrix as described in the supplemental appendix.
#' @param x_data Data of covariates.
#' @param eval_pt Evaluation point.
#' @param q Polynomial order for covariates.
#' @param h Bandwidth.
#' @param kernel_type Type of kernel function.
#' @return Matrix.
#' @keywords internal
T_x = function(x_data, eval_pt, q, h, kernel_type){
x_data = as.matrix(x_data)
Expand Down Expand Up @@ -142,11 +142,11 @@ T_x = function(x_data, eval_pt, q, h, kernel_type){


#' @title T_y matrix (Internal Function)
#' @description constructing the Ty matrix as described in the supplemental appendix.
#' @param y_data vector of data points.
#' @param p polynomial order.
#' @param kernel_type type of kernel function. Currently only works with uniform kernel.
#' @return matrix Ty.
#' @description Constructing the Ty matrix as described in the supplemental appendix.
#' @param y_data Vector of data points.
#' @param p Polynomial order.
#' @param kernel_type Type of kernel function. Currently only works with uniform kernel.
#' @return Matrix Ty.
#' @keywords internal
T_y = function(y_data, yp_data, p, kernel_type){
y_data = as.matrix(y_data)
Expand Down
44 changes: 22 additions & 22 deletions R/lpcde/R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# This file contains code for basic utility functions used in other computations
#######################################################################################

#' @title polynomial order vector
#' @description generates list of all combinations
#' @title Polynomial order vector
#' @description Generates list of all combinations
#' of length less than or equal to d of numbers that add up to n.
#' @param n total value of each combination
#' @param d maximum length of combinations
#' @param n Total value of each combination
#' @param d Maximum length of combinations
mvec = function(n, d){
if (d ==1){
mvec = n
Expand All @@ -32,9 +32,9 @@ mvec = function(n, d){
#' has multivariate functionality as described in the main paper
#' normalized by factorials in denominator.
#' NOTE: currently works only up to 4th degree polynomial expansion for multivariate \code{x}.
#' @param x a number or vector.
#' @param p a number (integer).
#' @return polynomial basis of \code{x} up to degree \code{p}.
#' @param x A number or vector.
#' @param p A number (integer).
#' @return Polynomial basis of \code{x} up to degree \code{p}.
#' @examples poly_base(x = 2, p = 5)
#' @export
poly_base = function(x, p){
Expand Down Expand Up @@ -132,9 +132,9 @@ poly_base = function(x, p){
#' @description Function to generate unit basis vector according to polynomial order
#' and derivative order. This function returns unit vector that is the same size
#' as the vector returned by \code{poly_base(x, p)}.
#' @param x sample input scalar or vector.
#' @param p polynomial order.
#' @param mu derivative order.
#' @param x Sample input scalar or vector.
#' @param p Polynomial order.
#' @param mu Derivative order.
#' @return Vector of appropriate length with ones corresponding to entries of order \code{mu}.
#' @examples basis_vec(x = 2, p = 5, mu = 1)
#' @export
Expand Down Expand Up @@ -209,14 +209,14 @@ basis_vec = function(x, p, mu){
}
}

#' @title lp integral (Internal Function)
#' @description local polynomial integral evaluation
#' @title Lp integral (Internal Function)
#' @description Local polynomial integral evaluation
#' calculation of elements of S_y and middle integral (evaluating integral at end points).
#' @param l degree of polynomial being integrated.
#' @param a lower limit of integration.
#' @param b upper limit of integration.
#' @param kernel_type type of kernel function. Choose from "uniform", "triangular", "epanechnikov".
#' @return value of integral.
#' @param l Degree of polynomial being integrated.
#' @param a Lower limit of integration.
#' @param b Upper limit of integration.
#' @param kernel_type Type of kernel function. Choose from "uniform", "triangular", "epanechnikov".
#' @return Value of integral.
#' @keywords internal
int_val = function(l, a, b, kernel_type){
if (kernel_type == "triangular"){
Expand Down Expand Up @@ -247,9 +247,9 @@ int_val = function(l, a, b, kernel_type){

#' @title Kernel Evaluation function (Internal Function)
#' @description Function that evaluates product kernel at x based on the chosen function.
#' @param x evaluation point.
#' @param kernel_type type of kernel function. Choose from "uniform", "triangular", "epanechnikov".
#' @return kernel evaluated at \code{x}.
#' @param x Evaluation point.
#' @param kernel_type Type of kernel function. Choose from "uniform", "triangular", "epanechnikov".
#' @return Kernel evaluated at \code{x}.
#' @keywords internal
kernel_eval = function(x, kernel_type){
if (kernel_type == "uniform"){
Expand All @@ -264,8 +264,8 @@ kernel_eval = function(x, kernel_type){
}

#' @title Matrix invertibility check
#' @description function to check intertibility of matrix.
#' @description Function to check intertibility of matrix.
#' @return TRUE if matrix is invertible.
#' @param m matrix
#' @param m Matrix
#' @keywords internal
check_inv = function(m) class(try(solve(m),silent=T))=="matrix"
8 changes: 4 additions & 4 deletions R/lpcde/man/S_x.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions R/lpcde/man/T_x.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions R/lpcde/man/T_y.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions R/lpcde/man/basis_vec.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions R/lpcde/man/c_x.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions R/lpcde/man/check_inv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions R/lpcde/man/int_val.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions R/lpcde/man/kernel_eval.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions R/lpcde/man/lpcde.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5c9f65c

Please sign in to comment.