SugiharaLab/rEDM

Tp < -1 gives error

Closed this issue · 3 comments

Hi,

Thanks for fixing the issue with tau in 52.

In rEDM 1.9.2, though, I still get the issue with tp < -1.

Error in RtoCpp_CCM(pathIn, dataFile, dataFrame, pathOut, predictFile, :
DataFrame::DataFrameFromColumnIndex(): A column index (66) exceeds the data frame domain.

Reprex:

data(paramecium_didinium, package = "rEDM")

vars <- names(paramecium_didinium)[2:3]

firstvar <- "paramecium"
secondvar <- "didinium"
  
# Prepare objects to save data in
timepoints_out <- list()
timepoints_plots <- list()
timepoints_means <- list()

parameters_to_check_1 <- c(-10:10)

### START RUN
for (i in 1:length(parameters_to_check_1)){
  
timepoint_for_analysis <- parameters_to_check_1[i]
dimension_for_analysis <- 3
evaluate_by_increment <- 10

thrips_combined_complete_data <- paramecium_didinium 

libSize = paste(
  # Start
  NROW(thrips_combined_complete_data) - dimension_for_analysis, 
  # Stop
  NROW(thrips_combined_complete_data) - dimension_for_analysis, 
  # Increment by which to evaluate
  evaluate_by_increment, 
  collapse = " ")

timepoints_out[[i]] = rEDM::CCM(dataFrame = thrips_combined_complete_data,
                                columns = firstvar, 
                                target = secondvar, 
                                libSizes = libSize, 
                                # ERROR from anything < -1
                                Tp = timepoint_for_analysis, 
                                E = dimension_for_analysis, 
                                includeData = TRUE,
                                sample = 100)

}

Session info:

R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Finnish_Finland.1252 LC_CTYPE=Finnish_Finland.1252
[3] LC_MONETARY=Finnish_Finland.1252 LC_NUMERIC=C
[5] LC_TIME=Finnish_Finland.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rEDM_1.9.2 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7
[5] purrr_0.3.4 readr_2.0.1 tidyr_1.1.3 tibble_3.1.4
[9] ggplot2_3.3.5 tidyverse_1.3.1

loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 lubridate_1.7.10 lattice_0.20-44 assertthat_0.2.1
[5] digest_0.6.27 foreach_1.5.1 utf8_1.2.2 R6_2.5.1
[9] cellranger_1.1.0 plyr_1.8.6 backports_1.2.1 reprex_2.0.1
[13] casnet_0.2.0 httr_1.4.2 pillar_1.6.2 rlang_0.4.11
[17] readxl_1.3.1 rstudioapi_0.13 Matrix_1.3-3 invctr_0.1.0
[21] splines_4.1.0 htmlwidgets_1.5.3 igraph_1.2.6 munsell_0.5.0
[25] broom_0.7.9 compiler_4.1.0 modelr_0.1.8 xfun_0.25
[29] pkgconfig_2.0.3 mgcv_1.8-35 htmltools_0.5.2 tidyselect_1.1.1
[33] codetools_0.2-18 fansi_0.5.0 withr_2.4.2 crayon_1.4.1
[37] tzdb_0.1.2 dbplyr_2.1.1 grid_4.1.0 nlme_3.1-152
[41] jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.0 DBI_1.1.1
[45] magrittr_2.0.1 scales_1.1.1 cli_3.0.1 stringi_1.7.4
[49] fs_1.5.0 doParallel_1.0.16 xml2_1.3.2 ellipsis_0.3.2
[53] generics_0.1.0 vctrs_0.3.8 iterators_1.0.13 tools_4.1.0
[57] glue_1.4.2 hms_1.1.0 parallel_4.1.0 fastmap_1.1.0
[61] colorspace_2.0-2 rvest_1.0.1 knitr_1.33 haven_2.4.3

Thank you for reporting this error. I have reproduced it in 1.9.2.

It looks to be another case where the CCM parameter validation checks are failing... will investigate.

This issue has been addressed in version 1.9.3. Thank you for reporting it!

Test

CCM( dataFrame = paramecium_didinium,
     columns = 'paramecium', target = 'didinium',
     libSizes = "10 65 5", E = 3, sample = 100, Tp = -3 )
   LibSize paramecium:didinium didinium:paramecium
1       10              0.6047              0.7999
2       15              0.6386              0.8064
3       20              0.6602              0.8303
4       25              0.6620              0.8318
5       30              0.6646              0.8379
6       35              0.6729              0.8407
7       40              0.6770              0.8408
8       45              0.6808              0.8397
9       50              0.6876              0.8401
10      55              0.6964              0.8435
11      60              0.7023              0.8430
12      65              0.7110              0.8459

The update is available in pyEDM on PyPI. CRAN takes some time, and prefers updates once-per-month. In the meantime, if it is desired to install from the package build, I posted it here: rEDM_1.9.3.tar.gz, or from the code respository and build the package with devtools, or, install with R CMD INSTALL.

As noted, this is addressed in version 1.9.3. It is now avaialable on CRAN. Thank you for the feedback!