diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cea7ca2..49ac0ed 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,14 +1,10 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main - - master + branches: [main, master] pull_request: - branches: - - main - - master + branches: [main, master] name: R-CMD-check @@ -22,64 +18,36 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} + - name: Install XQuartz on macOS + if: runner.os == 'macOS' + run: brew install --cask xquartz - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index a76ff09..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,49 +0,0 @@ -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - -name: lint - -jobs: - lint: - runs-on: macOS-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v2 - - - uses: r-lib/actions/setup-r@v1 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Restore R package cache - uses: actions/cache@v2 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install dependencies - run: | - install.packages(c("remotes")) - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("lintr") - shell: Rscript {0} - - - name: Install package - run: R CMD INSTALL . - - - name: Lint - run: lintr::lint_package(linters = lintr::with_defaults(object_name_linter = NULL)) - shell: Rscript {0} diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 98bf3c1..1b2141c 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ -Version: 0.1.1 -Date: 2022-08-26 15:40:19 UTC -SHA: a7eb4f1af54665ef1c659ca66b1a3b9dacd34b97 +Version: 0.1.2 +Date: 2023-10-14 15:20:23 UTC +SHA: 90b7ea29a8775b8c388f10ce11a5ab409f6a178c diff --git a/DESCRIPTION b/DESCRIPTION index 806c7dc..1a154f8 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: goffda Type: Package Title: Goodness-of-Fit Tests for Functional Data -Version: 0.1.1 -Date: 2022-08-26 +Version: 0.1.2 +Date: 2023-10-14 Authors@R: c( person(given = "Eduardo", family = "García-Portugués", role = c("aut", "cre"), email = "edgarcia@est-econ.uc3m.es", @@ -39,5 +39,5 @@ LinkingTo: Rcpp, RcppArmadillo URL: https://github.com/egarpor/goffda BugReports: https://github.com/egarpor/goffda Encoding: UTF-8 -RoxygenNote: 7.2.0 +RoxygenNote: 7.2.3 Roxygen: list(old_usage = TRUE) diff --git a/NEWS.md b/NEWS.md index 7573a5a..89e7320 100755 --- a/NEWS.md +++ b/NEWS.md @@ -23,3 +23,8 @@ # goffda 0.1.1 * Fix in HTML version of manual. + +# goffda 0.1.2 + +* Drop C++11 requirement to adhere to new CRAN policies. +* Drop `personList()` and `citEntry()`. diff --git a/R/cv_glmnet.R b/R/cv_glmnet.R index d9e39f4..948fcce 100755 --- a/R/cv_glmnet.R +++ b/R/cv_glmnet.R @@ -397,7 +397,7 @@ cv_glmnet <- function(x, y, alpha = c("lasso", "ridge")[1], lambda = NULL, # Check if it is required a second call because the minimum is found at # one extreme of the sequence (quantified as either the 100 * cv_tol_second # largest or smallest values) - if (cv_second & (prc_lambda_min <= cv_tol_second | + if (cv_second && (prc_lambda_min <= cv_tol_second || prc_lambda_min >= (1 - cv_tol_second))) { # Save for message() @@ -461,10 +461,14 @@ cv_glmnet <- function(x, y, alpha = c("lasso", "ridge")[1], lambda = NULL, par(mfrow = c(1, 2)) plot(cv_old, axes = FALSE, xlab = "log10(lambda)") labs <- pretty(log10(cv_old$lambda)) - axis(1, at = log(10^labs), labels = labs); axis(2); box() + axis(1, at = log(10^labs), labels = labs) + axis(2) + box() plot(cv, axes = FALSE, xlab = "log10(lambda)") labs <- pretty(log10(cv$lambda)) - axis(1, at = log(10^labs), labels = labs); axis(2); box() + axis(1, at = log(10^labs), labels = labs) + axis(2) + box() } @@ -482,7 +486,9 @@ cv_glmnet <- function(x, y, alpha = c("lasso", "ridge")[1], lambda = NULL, par(mfrow = c(1, 1)) plot(cv, axes = FALSE, xlab = "log10(lambda)") labs <- pretty(log10(cv$lambda)) - axis(1, at = log(10^labs), labels = labs); axis(2); box() + axis(1, at = log(10^labs), labels = labs) + axis(2) + box() } diff --git a/R/data.R b/R/data.R index 2ab91ee..81d1c52 100755 --- a/R/data.R +++ b/R/data.R @@ -137,7 +137,7 @@ #' In leap years, the daily-average temperature is computed as the average of #' February 28th and 29th. #' @source The data was retrieved from the FTP of the -#' \href{http://www.aemet.es/es/portada/}{Meteorological State Agency of Spain +#' \href{https://www.aemet.es/es/portada/}{Meteorological State Agency of Spain #' (AEMET)} in 2014 using a processing script by the authors of the #' \code{\link[fda.usc]{fda.usc-package}}. #' @author diff --git a/R/flm_est.R b/R/flm_est.R index 0910774..52a0ce0 100755 --- a/R/flm_est.R +++ b/R/flm_est.R @@ -320,13 +320,13 @@ flm_est <- function(X, Y, est_method = "fpcr_l1s", } # Check thresholds (threshold = 1 is OK) - if (!is.numeric(thre_p) | (thre_p <= 0 | thre_p > 1)) { + if (!is.numeric(thre_p) || (thre_p <= 0 || thre_p > 1)) { stop(paste("Parameter thre_p must be a real numeric parameter greater", "than 0 and less than 1. Value of 1 is allowed.")) } - if (!is.numeric(thre_q) | (thre_q <= 0 | thre_q > 1)) { + if (!is.numeric(thre_q) || (thre_q <= 0 || thre_q > 1)) { stop(paste("Parameter thre_q must be a real numeric parameter greater", "than 0 and less than 1. Value of 1 is allowed.")) @@ -521,7 +521,7 @@ flm_est <- function(X, Y, est_method = "fpcr_l1s", intercept = FALSE, ...) lambda <- cv[["lambda"]] - } else{ + } else { cv <- NULL diff --git a/R/flm_test.R b/R/flm_test.R index a7425d4..01580c1 100755 --- a/R/flm_test.R +++ b/R/flm_test.R @@ -317,7 +317,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", ## Preprocessing # Detect non-implemented bootstrap resampling - if (boot_scores & (est_method == "fpcr_l1")) { + if (boot_scores && (est_method == "fpcr_l1")) { stop(paste("Bootstrap resampling of the residuals FPC coefficients is", "not implemented for est_method = \"fpcr_l1\"")) @@ -495,7 +495,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", if (fda.usc::is.fdata(beta0)) { - if (scalar_X | scalar_Y) { + if (scalar_X || scalar_Y) { l_beta0 <- length(beta0) if (l_beta0 != 1) { @@ -556,7 +556,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", } # Check adequate dimensions - if (length(X$argvals) != nrow(beta0) | + if (length(X$argvals) != nrow(beta0) || length(Y$argvals) != ncol(beta0)) { stop("beta0 must be a matrix of size ", length(X$argvals), " x ", @@ -742,7 +742,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", # (instead of p_hat) fit_flm_star <- flm_est(X = X, Y = Y_star, est_method = est_method, p = p_thre, q = q_thre, lambda = lambda, - X_fpc = fit_flm[["X_fpc"]],Y_fpc = NULL, + X_fpc = fit_flm[["X_fpc"]], Y_fpc = NULL, centered = TRUE, int_rule = int_rule, cv_verbose = FALSE, ...) @@ -886,7 +886,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", Rn_processes <- c( Rn(X_scores = X_scores, E_hat_scores = E_hat_scores, ind_X_fpc = ind_X_fpc, ind_Y_fpc = ind_Y_fpc), - lapply(1:dim(E_star_hat_scores)[3], function(i) { + lapply(seq_len(dim(E_star_hat_scores)[3]), function(i) { Rn(X_scores = X_scores, E_hat_scores = as.matrix(E_star_hat_scores[, , i]), ind_X_fpc = ind_X_fpc, ind_Y_fpc = ind_Y_fpc)}) @@ -905,7 +905,7 @@ flm_test <- function(X, Y, beta0 = NULL, B = 500, est_method = "fpcr", rug(knots(Rn_processes[[1]])) # Add bootstrap processes - out <- sapply(1:dim(E_star_hat_scores)[3], function(i) { + sapply(seq_len(dim(E_star_hat_scores)[3]), function(i) { plot(Rn_processes[[i + 1]], add = TRUE, col = gray(0.75, alpha = 0.75), pch = NA) }) diff --git a/R/fpc.R b/R/fpc.R index a0757c9..7a6baef 100755 --- a/R/fpc.R +++ b/R/fpc.R @@ -377,7 +377,7 @@ beta_fpc_coefs <- function(beta, X_fpc, Y_fpc, ind_X_fpc = 1:3, ind_Y_fpc = 1:3, # Check the dimension of beta with the argvals of X_fdata and Y_fdata s <- X_fpc[["rotation"]][["argvals"]] t <- Y_fpc[["rotation"]][["argvals"]] - if (nrow(beta) != length(s) | ncol(beta) != length(t)) { + if (nrow(beta) != length(s) || ncol(beta) != length(t)) { stop(paste("The dimensions of beta do not coincide with the argvals", "of X_fpc and Y_fpc")) @@ -410,7 +410,7 @@ beta_fpc_coefs <- function(beta, X_fpc, Y_fpc, ind_X_fpc = 1:3, ind_Y_fpc = 1:3, #' @rdname fpc_utils #' @export -fpc_to_fdata <- function(coefs, X_fpc, ind_coefs = 1:ncol(coefs)) { +fpc_to_fdata <- function(coefs, X_fpc, ind_coefs = seq_len(ncol(coefs))) { # coefs as matrix if (!is.matrix(coefs)) { @@ -444,8 +444,8 @@ fpc_to_fdata <- function(coefs, X_fpc, ind_coefs = 1:ncol(coefs)) { #' @rdname fpc_utils #' @export fpc_to_beta <- function(beta_coefs, X_fpc, Y_fpc, - ind_coefs_X = 1:nrow(beta_coefs), - ind_coefs_Y = 1:ncol(beta_coefs)) { + ind_coefs_X = seq_len(nrow(beta_coefs)), + ind_coefs_Y = seq_len(ncol(beta_coefs))) { # Check beta_coefs n_fpc_X <- nrow(X_fpc[["rotation"]][["data"]]) @@ -458,7 +458,7 @@ fpc_to_beta <- function(beta_coefs, X_fpc, Y_fpc, } else { - if (nrow(beta_coefs) != length(ind_coefs_X) | + if (nrow(beta_coefs) != length(ind_coefs_X) || ncol(beta_coefs) != length(ind_coefs_Y)) { stop(paste("The dimensions of beta_coefs do not match with", diff --git a/R/quadrature.R b/R/quadrature.R index e1deecf..193f80d 100755 --- a/R/quadrature.R +++ b/R/quadrature.R @@ -119,7 +119,7 @@ integral1D <- function(fx, t, int_rule = "trapezoid", equispaced = FALSE, } # Check if NA - if (any(is.na(fx)) & verbose) { + if (any(is.na(fx)) && verbose) { warning("NA values have been found") @@ -159,7 +159,7 @@ integral2D <- function(fxy, s, t, int_rule = "trapezoid", equispaced_x = FALSE, # Only trapezoidal rule has been implemented for bidimensional functions with # non equispaced grids - if (int_rule == "Simpson" & (equispaced_x + equispaced_y) != 2) { + if (int_rule == "Simpson" && (equispaced_x + equispaced_y) != 2) { stop(paste("Only trapezoidal rule (int_rule = \"trapezoid\") is allowed", "for 2D functions and non equispaced grids")) @@ -170,7 +170,7 @@ integral2D <- function(fxy, s, t, int_rule = "trapezoid", equispaced_x = FALSE, lx <- length(s) ly <- length(t) dim_fxy <- dim(fxy) - if (dim_fxy[1] != lx | dim_fxy[2] != ly) { + if (dim_fxy[1] != lx || dim_fxy[2] != ly) { stop(paste("The number of evaluations of the function must", "be the same as the number of grid points")) @@ -231,12 +231,12 @@ w_integral1D <- function(t, int_rule = "trapezoid", equispaced = FALSE, return(1) } - if (int_rule == "trapezoid" & lx < 2) { + if (int_rule == "trapezoid" && lx < 2) { stop(paste("Trapezoidal rule requires at least 2 grid points,", "but the length of t is", lx)) - } else if (int_rule == "Simpson" & lx < 7) { + } else if (int_rule == "Simpson" && lx < 7) { stop(paste("The extended Simpson's rule requires at least 7 grid points,", "but the length of t is", lx)) @@ -244,7 +244,7 @@ w_integral1D <- function(t, int_rule = "trapezoid", equispaced = FALSE, } # Simpson's rule requires equispaced grid points - if (!equispaced & int_rule == "Simpson") { + if (!equispaced && int_rule == "Simpson") { t <- seq(t[1], t[lx], l = lx) # We consider an equispaced grid lx <- length(t) diff --git a/R/scenarios-fr.R b/R/scenarios-fr.R index 5dded8d..44e8076 100755 --- a/R/scenarios-fr.R +++ b/R/scenarios-fr.R @@ -56,7 +56,7 @@ #' Defaults to \code{FALSE}. #' @param ... further parameters passed to #' \code{\link[goffda:elem-flmfr]{r_cm2013_flmfr}}, -#' \code{\link[goffda:elem-flmfr]{r_gof2021_flmfr}} and\cr +#' \code{\link[goffda:elem-flmfr]{r_gof2021_flmfr}} and\cr #' \code{\link[goffda:elem-flmfr]{r_ik2018_flmfr}}, depending on the #' chosen \code{scenario}. #' @return A list with the following elements: @@ -182,7 +182,7 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, # If scenario is not NULL, X_fdata = NULL, error_fdata = NULL and # beta = NULL are forced - if (verbose & (!is.null(X_fdata) | !is.null(error_fdata) | + if (verbose && (!is.null(X_fdata) || !is.null(error_fdata) || !is.null(beta))) { message("Scenario encoded as scenario = ", scenario, @@ -202,12 +202,12 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, } # Check if s and t are intervals - if (!is.vector(s) | length(s) < 1) { + if (!is.vector(s) || length(s) < 1) { stop("s must be a vector with length greater than zero") } - if (!is.vector(t) | length(t) < 1) { + if (!is.vector(t) || length(t) < 1) { stop("t must be a vector with length greater than zero") @@ -216,7 +216,7 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, } else { # If scenario = NULL, X_fdata, error_fdata and beta are required # Check if functional variables are properly provided - if (!fda.usc::is.fdata(X_fdata) | !fda.usc::is.fdata(error_fdata)) { + if (!fda.usc::is.fdata(X_fdata) || !fda.usc::is.fdata(error_fdata)) { stop(paste("scenario = NULL: \"fdata\" objects must be provided", "as X_fdata and error_fdata, and beta must be a matrix")) @@ -247,7 +247,7 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, } # Check if beta is a vector with properly length - if (!is.vector(beta) | + if (!is.vector(beta) || length(beta) != length(t)) { stop(paste("If concurrent model is generated, beta must be a vector", @@ -258,8 +258,8 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, } else { # Check if beta has properly dimensions - if (!(nrow(beta) == length(s) & - ncol(beta) == length(t) & is.matrix(beta))) { + if (!(nrow(beta) == length(s) && + ncol(beta) == length(t) && is.matrix(beta))) { stop(paste("scenario = NULL: beta must be a matrix whose", "dimensions are c(length(X_fdata$argvals),", @@ -331,7 +331,7 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, # Sampling deviations from the linearity # Check for nonlinear term - if (!is.null(nonlinear) & !is.character(nonlinear)) { + if (!is.null(nonlinear) && !is.character(nonlinear)) { if (!fda.usc::is.fdata(nonlinear)) { @@ -341,7 +341,7 @@ r_frm_fr <- function(n, scenario = 3, X_fdata = NULL, error_fdata = NULL, } else { # Check if dimensions match - if (nrow(nonlinear[["data"]]) != n | + if (nrow(nonlinear[["data"]]) != n || ncol(nonlinear[["data"]]) != length(t)) { stop(paste("If nonlinear is not NULL neither \"exp\", \"quadratic\"", @@ -397,7 +397,7 @@ nl_dev <- function(X_fdata, t = seq(0, 1, l = 101), nonlinear = NULL, } # Check grid points - if (!is.vector(t) | length(t) < 1) { + if (!is.vector(t) || length(t) < 1) { stop("Grid points in t must be a vector of length greater than zero") @@ -425,12 +425,12 @@ nl_dev <- function(X_fdata, t = seq(0, 1, l = 101), nonlinear = NULL, # If lengths of intervals is not the same, just rescaling is not possible # An interpolation is required - if (nonlinear != "sin" & (length(X_fdata[["argvals"]]) != length(t))) { + if (nonlinear != "sin" && (length(X_fdata[["argvals"]]) != length(t))) { X_fdata_int <- fda.usc::fdata(mdata = matrix(0, nrow = nrow(X_fdata[["data"]]), ncol = length(t)), argvals = t) - for (i in 1:nrow(X_fdata[["data"]])) { + for (i in seq_len(nrow(X_fdata[["data"]]))) { X_fdata_int[["data"]][i, ] <- spline(x = X_fdata[["argvals"]], y = X_fdata[["data"]][i, ], @@ -832,7 +832,7 @@ flm_term <- function(X_fdata, beta, t, int_rule = "trapezoid", beta <- as.vector(beta) # Check that dimensions of beta match lengths of s and t - if ((length(s) != length(t)) | (length(t) != length(beta))) { + if ((length(s) != length(t)) || (length(t) != length(beta))) { stop(paste("When concurrent model is considered, X_fdata and beta", "must be valued in the same grid interval t")) diff --git a/README.md b/README.md index 38705c0..5e78189 100755 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ GPLv3](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org [![R build status](https://github.com/egarpor/goffda/workflows/R-CMD-check/badge.svg)](https://github.com/egarpor/goffda/actions) [![](https://www.r-pkg.org/badges/version/goffda?color=green)](https://cran.r-project.org/package=goffda) -[![](http://cranlogs.r-pkg.org/badges/grand-total/goffda?color=green)](https://cran.r-project.org/package=goffda) -[![](http://cranlogs.r-pkg.org/badges/last-month/goffda?color=green)](https://cran.r-project.org/package=goffda) +[![](http://cranlogs.r-pkg.org/badges/grand-total/goffda)](https://cran.r-project.org/package=goffda) +[![](http://cranlogs.r-pkg.org/badges/last-month/goffda)](https://cran.r-project.org/package=goffda) @@ -145,6 +145,7 @@ legend("topleft", legend = c("1974-1993", "1994-2013"), col = 1:2, lwd = 2) ``` r + # Test composite and simple hypothesis (gof <- flm_test(X = aemet_temp_pred, Y = aemet_temp_resp, B = 1e4, verbose = FALSE, plot_dens = FALSE, plot_proc = FALSE)) diff --git a/README/README-aemet-1.png b/README/README-aemet-1.png index 7705ccf..955b945 100644 Binary files a/README/README-aemet-1.png and b/README/README-aemet-1.png differ diff --git a/README/README-test-1.png b/README/README-test-1.png index 11ad930..8bd4dba 100644 Binary files a/README/README-test-1.png and b/README/README-test-1.png differ diff --git a/README/README-test-3.png b/README/README-test-3.png index 52852d8..29347f9 100644 Binary files a/README/README-test-3.png and b/README/README-test-3.png differ diff --git a/README/README-test-5.png b/README/README-test-5.png index 6912523..be32d8a 100644 Binary files a/README/README-test-5.png and b/README/README-test-5.png differ diff --git a/cran-comments.md b/cran-comments.md index 3e7af2e..20f0c7c 100755 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,22 +1,15 @@ ## Test environments -* local R installation, R 4.1.0 -* ubuntu 16.04 (on travis-ci), R 3.6.3 +* local R installation, R 4.2.2 * win-builder (release, devel) -* Windows Server 2008 R2 SP1, R-devel, 32/64 bit (on R-hub) -* Windows Server 2008 R2 SP1, R-release, 32/64 bit (on R-hub) -* Windows Server 2008 R2 SP1, R-oldrel, 32/64 bit (on R-hub) -* Ubuntu Linux 16.04 LTS, R-release, GCC (on R-hub) -* Fedora Linux, R-devel, clang, gfortran (on R-hub) -* Debian Linux, R-devel, GCC ASAN/UBSAN (on R-hub) -* macOS 10.13.6 High Sierra, R-release, brew (on R-hub) -* macOS 10.13.6 High Sierra, R-release, CRAN's setup (on R-hub) -* Oracle Solaris 10, x86, 32 bit, R-release (on R-hub) -* Oracle Solaris 10, x86, 32 bit, R-release, Oracle Developer Studio 12.6 (on R-hub) - -On some platforms: - -* "Found the following (possibly) invalid URLs" -- double-checked and correctly spelled +* Windows Server 2022, R-release, 32/64 bit +* Windows Server 2022, R-devel, 64 bit +* Windows Server 2022, R-oldrel, 32/64 bit +* Windows Server 2022, R-patched, 32/64 bit +* Ubuntu Linux 20.04.1 LTS, R-release, GCC +* Ubuntu Linux 20.04.1 LTS, R-devel, GCC +* Debian Linux, R-release, GCC +* Debian Linux, R-devel, GCC ## R CMD check results diff --git a/data-raw/Ontario.R b/data-raw/Ontario.R index e7da3d1..b8a2600 100755 --- a/data-raw/Ontario.R +++ b/data-raw/Ontario.R @@ -5,7 +5,7 @@ library(lubridate) # Read data downloaded from David Benatia's personal website # (https://davidbenatia.com/research/) as companion for the paper -# "Functional linear regression with functional response" on the Journal of +# "Functional linear regression with functional response" on the Journal of # Econometrics (Benatia et al., 2017) data <- readMat("DATA.mat") @@ -16,13 +16,13 @@ data <- readMat("DATA.mat") # * DATA_Z (73 x 368 x 35). The functional predictor, temperature in # Ontario, is DATA_Z(:, :, 1) # * TIME_Y (25 x 368). The time variable for functional data. -# The remaining arrays of DATA_Y and DATA_Z contain the seasonal dummies, -# excep for the last array that contains a variable for year to separate the +# The remaining arrays of DATA_Y and DATA_Z contain the seasonal dummies, +# excep for the last array that contains a variable for year to separate the # samples # Store the temperature as fdata temp <- fda.usc::fdata(mdata = t(data$DATA.Z[, , 1]), argvals = (-24):48, - names = list(main = "Temperature 2010-2014", + names = list(main = "Temperature 2010-2014", xlab = "Hour = [Day - 1, Day, Day + 1]", ylab = "Temperature (ºC)")) @@ -31,7 +31,7 @@ temp <- fda.usc::fdata(mdata = t(data$DATA.Z[, , 1]), argvals = (-24):48, # i-th day is the same as the first observation of the (i + 1)-th day # Electricity as fdata elec <- fda.usc::fdata(mdata = t(data$DATA.Y[, , 1]), argvals = 0:24, - names = list(main = "Electricity consumption 2010-2014", + names = list(main = "Electricity consumption 2010-2014", xlab = "Hour", ylab = "Power (GW)")) # In order to add the time information to the data, we run in MATLAB: diff --git a/data-raw/aemet_temp.R b/data-raw/aemet_temp.R index 94b1794..4eec98d 100755 --- a/data-raw/aemet_temp.R +++ b/data-raw/aemet_temp.R @@ -1,8 +1,8 @@ library(fda.usc) -# Load the results from running aemet.local.R used for creating fda.usc's -# aemet. The script reads the data downloaded from AEMET's FTP in 2014. +# Load the results from running aemet.local.R used for creating fda.usc's +# aemet. The script reads the data downloaded from AEMET's FTP in 2014. # Unfortunately, the data retrieval approach does not work anymore due to a # change in AEMET's data access API, so one must have locally the old raw files # to reconstruct aemet.raw.RData @@ -34,7 +34,7 @@ aemet_temp$df$altitude <- NULL # Add metainfo aemet_temp$temp$rangeval <- c(0, 365) -aemet_temp$temp$names <- list(main = "Temperature", xlab = "Day", +aemet_temp$temp$names <- list(main = "Temperature", xlab = "Day", ylab = "Temperature (ºC)") # Save dataset diff --git a/goffda.Rproj b/goffda.Rproj index 4a4e498..398aa14 100755 --- a/goffda.Rproj +++ b/goffda.Rproj @@ -13,6 +13,7 @@ RnwWeave: knitr LaTeX: pdfLaTeX AutoAppendNewline: Yes +StripTrailingWhitespace: Yes BuildType: Package PackageUseDevtools: Yes diff --git a/inst/CITATION b/inst/CITATION index 27e9248..d4ca178 100755 --- a/inst/CITATION +++ b/inst/CITATION @@ -4,10 +4,11 @@ note <- paste("R package version", meta$Version) citHeader("To cite goffda in publications use:") -citEntry(entry = "Manual", +bibentry( + bibtype = "Manual", title = "{goffda}: Goodness-of-Fit Tests for Functional Data", - author = personList(as.person("Eduardo Garc\\'ia-Portugu\\'es"), - as.person("Javier \\'Alvarez-Li\\'ebana")), + author = c(person(given = "Eduardo", family = "García-Portugués"), + person(given = "Javier", family = "Álvarez-Liébana")), year = year, note = note, url = "https://CRAN.R-project.org/package=goffda", @@ -17,12 +18,13 @@ citEntry(entry = "Manual", paste0(note, "."), "https://CRAN.R-project.org/package=goffda") ) -citEntry(entry = "Article", +bibentry( + bibtype = "Article", title = "A goodness-of-fit test for the functional linear model with functional response", - author = personList(as.person("Eduardo Garc\\'ia-Portugu\\'es"), - as.person("Javier \\'Alvarez-Li\\'ebana"), - as.person("Gonzalo \\'Alvarez-P\\'erez"), - as.person("Wenceslao Gonzalez-Manteiga")), + author = c(person(given = "Eduardo", family = "García-Portugués"), + person(given = "Javier", family = "Álvarez-Liébana"), + person(given = "Gonzalo", family = "Álvarez-Pérez"), + person(given = "Wenceslao", family = "González-Manteiga")), journal = "Scandinavian Journal of Statistics", year = "2021", volume = "48", diff --git a/man/aemet_temp.Rd b/man/aemet_temp.Rd index fc23d4c..c4f8761 100755 --- a/man/aemet_temp.Rd +++ b/man/aemet_temp.Rd @@ -21,7 +21,7 @@ A list with the following entries: } \source{ The data was retrieved from the FTP of the -\href{http://www.aemet.es/es/portada/}{Meteorological State Agency of Spain +\href{https://www.aemet.es/es/portada/}{Meteorological State Agency of Spain (AEMET)} in 2014 using a processing script by the authors of the \code{\link[fda.usc]{fda.usc-package}}. } diff --git a/man/fpc_utils.Rd b/man/fpc_utils.Rd index cfa2593..36d3b30 100755 --- a/man/fpc_utils.Rd +++ b/man/fpc_utils.Rd @@ -13,10 +13,11 @@ fpc_coefs(X_fdata, X_fpc, ind_X_fpc = 1:3, int_rule = "trapezoid") beta_fpc_coefs(beta, X_fpc, Y_fpc, ind_X_fpc = 1:3, ind_Y_fpc = 1:3, int_rule = "trapezoid") -fpc_to_fdata(coefs, X_fpc, ind_coefs = 1:ncol(coefs)) +fpc_to_fdata(coefs, X_fpc, ind_coefs = seq_len(ncol(coefs))) -fpc_to_beta(beta_coefs, X_fpc, Y_fpc, ind_coefs_X = 1:nrow(beta_coefs), - ind_coefs_Y = 1:ncol(beta_coefs)) +fpc_to_beta(beta_coefs, X_fpc, Y_fpc, + ind_coefs_X = seq_len(nrow(beta_coefs)), + ind_coefs_Y = seq_len(ncol(beta_coefs))) } \arguments{ \item{X_fdata}{sample of functional data as an diff --git a/man/quadrature.Rd b/man/quadrature.Rd index 4d8239f..74191a4 100755 --- a/man/quadrature.Rd +++ b/man/quadrature.Rd @@ -7,12 +7,14 @@ \alias{w_integral1D} \title{Quadrature rules for the \pkg{goffda} package} \usage{ -integral1D(fx, t, int_rule = "trapezoid", equispaced = FALSE, verbose = FALSE) +integral1D(fx, t, int_rule = "trapezoid", equispaced = FALSE, + verbose = FALSE) integral2D(fxy, s, t, int_rule = "trapezoid", equispaced_x = FALSE, equispaced_y = FALSE, verbose = FALSE) -w_integral1D(t, int_rule = "trapezoid", equispaced = FALSE, verbose = FALSE) +w_integral1D(t, int_rule = "trapezoid", equispaced = FALSE, + verbose = FALSE) } \arguments{ \item{fx}{a vector of length \code{length(t)} with the evaluation of diff --git a/man/sim-frmfr.Rd b/man/sim-frmfr.Rd index b4bbcc3..4bd7565 100755 --- a/man/sim-frmfr.Rd +++ b/man/sim-frmfr.Rd @@ -69,7 +69,7 @@ Defaults to \code{FALSE}.} \item{...}{further parameters passed to \code{\link[goffda:elem-flmfr]{r_cm2013_flmfr}}, -\code{\link[goffda:elem-flmfr]{r_gof2021_flmfr}} and\cr +\code{\link[goffda:elem-flmfr]{r_gof2021_flmfr}} and\cr \code{\link[goffda:elem-flmfr]{r_ik2018_flmfr}}, depending on the chosen \code{scenario}.} diff --git a/src/Makevars b/src/Makevars index 7e6c1a8..2f42a43 100755 --- a/src/Makevars +++ b/src/Makevars @@ -1,6 +1,2 @@ ## Set PKG_LIBS PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) - -## With R 3.1.0 or later, you can uncomment the following line to tell R to -## enable compilation with C++11 (or even C++14) where available -CXX_STD = CXX11 diff --git a/src/Makevars.win b/src/Makevars.win index 7e6c1a8..2f42a43 100755 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -1,6 +1,2 @@ ## Set PKG_LIBS PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) - -## With R 3.1.0 or later, you can uncomment the following line to tell R to -## enable compilation with C++11 (or even C++14) where available -CXX_STD = CXX11