Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of allowed libSizes for tau or negative tp #52

Closed
heinonmatti opened this issue Sep 7, 2021 · 4 comments
Closed

Example of allowed libSizes for tau or negative tp #52

heinonmatti opened this issue Sep 7, 2021 · 4 comments

Comments

@heinonmatti
Copy link

heinonmatti commented Sep 7, 2021

Hi,

Stupid question: I've been stuck for days trying to figure out how to use rEDM::CCM() with tau > 0 and tp < -1.

Would it be possible to give an example of how to specify libSizes here?

I keep getting an error such as:

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

I cannot use the example in https://ha0ye.github.io/rEDM/articles/rEDM.html, because the same happens there (additionally, target_column and lib_column need to be specified as.character() for the code to work)

output <- do.call(rbind, lapply(seq_len(NROW(params)), function(i) {
    ccm(paramecium_didinium, E = params$E[i], lib_sizes = NROW(paramecium_didinium), 
        random_libs = FALSE, lib_column = params$lib_column[i], target_column = params$target_column[i], 
        tp = params$tp[i], silent = TRUE)
}))
@SoftwareLiteracy
Copy link
Contributor

It looks like there is a problem in the code validation checks with CCM and tau > 0. We need to look into this.

I don't think the problem has to do with libSizes, which is documented here.

It looks like the case of positive tau and negative Tp works in Simplex, which is the underlying method of CCM. This can offer a rather laborious workaround. Another option is to use the legacy package from which the example you cite is formed.

Please note that the example you cite is from a legacy version of rEDM. The current version suggests to use the current API (CCM rather than the legacy version ccm), as noted in the rEDM NEWS. The new API are direct calls into the underlying C++ library. The legacy API has an intermediate wrapper layer that is not complete.

Please also note your rEDM version and environment with sessionInfo().

@heinonmatti
Copy link
Author

heinonmatti commented Sep 8, 2021

Thanks for the quick reaction!

Another option is to use the legacy package from which the example you cite is formed.

Which version should I download to have a go? (given CCM in the current version gives an equivalent error to ccm)

My current rEDM is v. 1.9.1

sessionInfo:

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
[2] LC_CTYPE=Finnish_Finland.1252
[3] LC_MONETARY=Finnish_Finland.1252
[4] LC_NUMERIC=C
[5] LC_TIME=Finnish_Finland.1252

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

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

loaded via a namespace (and not attached):
[1] readxl_1.3.1 backports_1.2.1
[3] plyr_1.8.6 igraph_1.2.6
[5] sp_1.4-5 usethis_2.0.1
[7] digest_0.6.27 httpcache_1.2.0
[9] yardstick_0.0.8 foreach_1.5.1
[11] casnet_0.2.0 htmltools_0.5.2
[13] viridis_0.6.1 lars_1.2
[15] fansi_0.5.0 checkmate_2.0.0
[17] magrittr_2.0.1 memoise_2.0.0
[19] cluster_2.1.2 doParallel_1.0.16
[21] tzdb_0.1.2 openxlsx_4.2.4
[23] remotes_2.4.0 modelr_0.1.8
[25] vroom_1.5.4 stabledist_0.7-1
[27] prettyunits_1.1.1 colorspace_2.0-2
[29] ecp_3.1.3 rvest_1.0.1
[31] ggrepel_0.9.1 haven_2.4.3
[33] xfun_0.25 callr_3.7.0
[35] crayon_1.4.1 jsonlite_1.7.2
[37] zoo_1.8-9 iterators_1.0.13
[39] glue_1.4.2 gtable_0.3.0
[41] car_3.0-11 pkgbuild_1.2.0
[43] DEoptimR_1.0-9 abind_1.4-5
[45] VIM_6.1.1 scales_1.1.1
[47] DBI_1.1.1 Rcpp_1.0.7
[49] laeken_0.5.1 viridisLite_0.4.0
[51] units_0.7-2 clue_0.3-59
[53] TSMCP_1.0 bit_4.0.4
[55] foreign_0.8-81 proxy_0.4-26
[57] DT_0.18 vcd_1.4-8
[59] htmlwidgets_1.5.3 timeSeries_3062.100
[61] httr_1.4.2 ellipsis_0.3.2
[63] spatial_7.3-14 pkgconfig_2.0.3
[65] farver_2.1.0 nnet_7.3-16
[67] invctr_0.1.0 dbplyr_2.1.1
[69] utf8_1.2.2 tidyselect_1.1.1
[71] labeling_0.4.2 rlang_0.4.11
[73] munsell_0.5.0 cellranger_1.1.0
[75] tools_4.1.0 cachem_1.0.6
[77] cli_3.0.1 generics_0.1.0
[79] ranger_0.13.1 devtools_2.4.2
[81] broom_0.7.9 mpmi_0.43.1
[83] evaluate_0.14 fastmap_1.1.0
[85] yaml_2.2.1 bit64_4.0.5
[87] processx_3.5.2 knitr_1.33
[89] fs_1.5.0 plus_1.0
[91] zip_2.2.0 pander_0.6.4
[93] robustbase_0.93-8 visdat_0.5.3
[95] xml2_1.3.2 compiler_4.1.0
[97] rstudioapi_0.13 curl_4.3.2
[99] e1071_1.7-8 testthat_3.0.4
[101] reprex_2.0.1 rjstat_0.4.1
[103] stringi_1.7.4 statip_0.2.3
[105] ps_1.6.0 desc_1.3.0
[107] modeest_2.4.0 lattice_0.20-44
[109] fBasics_3042.89.1 Matrix_1.3-3
[111] classInt_0.4-3 vctrs_0.3.8
[113] pillar_1.6.2 lifecycle_1.0.0
[115] lmtest_0.9-38 data.table_1.14.0
[117] cowplot_1.1.1 R6_2.5.1
[119] stable_1.1.4 KernSmooth_2.23-20
[121] gridExtra_2.3 rio_0.5.27
[123] sessioninfo_1.1.1 codetools_0.2-18
[125] COVID19_2.3.2 boot_1.3-28
[127] MASS_7.3-54 assertthat_0.2.1
[129] pkgload_1.2.1 rprojroot_2.0.2
[131] fmi2_0.2.0 withr_2.4.2
[133] naniar_0.6.1 parallel_4.1.0
[135] hms_1.1.0 grid_4.1.0
[137] rpart_4.1-15 timeDate_3043.102
[139] class_7.3-19 rmarkdown_2.10
[141] carData_3.0-4 rmutil_1.1.5
[143] sf_1.0-2 pROC_1.17.0.1
[145] lubridate_1.7.10

@SoftwareLiteracy
Copy link
Contributor

Thank you for the sessionInfo, and, for reporting the bug.

To use the legacy version hosted on CRAN, here are three options, the first two within R, the third as a command line from a system console:

require(devtools)
install_version("rEDM", version = "0.7.3", repos = "http://cran.us.r-project.org")

url = "https://cran.r-project.org/src/contrib/Archive/rEDM/rEDM_0.7.3.tar.gz"
install.packages( url, repos = NULL, type = "source" )

wget http://cran.r-project.org/src/contrib/Archive/rEDM/rEDM_0.7.3.tar.gz
R CMD INSTALL rEDM_0.7.3.tar.gz

I believe that Hao Ye also publishes the legacy packages on his github.

@SoftwareLiteracy
Copy link
Contributor

This has been fixed in version 1.9.2, now available on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants