HannaMeyer/CAST

Inf/NA for large factorial

Closed this issue · 3 comments

Dear Hanna,
if n in factorial(n) is larger than 170, the results is NaN or Inf (R version 4.0.1). I wonder about this cause it did not happen before (before = 18 month ago :-). Did you include the line lately? I wonder because for the rainfall paper there have been more than 400 variables? While there are ways to compute factorial for larger n with big integer (gmp::factorialZ), this does not solve the problem because the matrix definition won't understand.

Is perf_all the matrix you mentioned which is only relevant if you want to look up the ffs/error function, one could make it optional to execute.

Cheers
Thomas

CAST/R/ffs.R

Line 142 in f7a2824

nrow=factorial(n) / (factorial(n-minVar)* factorial(minVar))+

Yes, the line was included in January 2019. But it is not a major problem to ignore that part if n>170.
Only the report on all individual model performances is affected which means that plot_ffs can only be used with plotType="selected".
But that should be fine because I guess no one wants to see the results for such a large number of models ;-)
I'll still look for another solution that still allows for the report. But for now you can run it again with your +170 variables. Please check!

Great! You could use a list to add the individual entries...

solved now by avoiding to calculate factorial (n).
So the report can now be created for >170 variables as well...