-
Notifications
You must be signed in to change notification settings - Fork 97
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
Null models fail with invalid data #177
Comments
I added error messages to the For For A note in the help page about these restrictions is also added, see branch |
millions of random numbers may be generated with one matrix (e.g., in quasiswap) with same dimensions, and it is wasteful to repeat check for dimensions every time when the dimensions do not change. This should be checked before entering the loop or in R before calling C (like it is done now in make.commsim after 96fbde0 and github issue #177).
millions of random numbers may be generated with one matrix (e.g., in quasiswap) with same dimensions, and it is wasteful to repeat check for dimensions every time when the dimensions do not change. This should be checked before entering the loop or in R before calling C (like it is done now in make.commsim after 96fbde0 and github issue #177). (cherry picked from commit f567fa5)
PR #175 allows building stratified null models. Either species or sites are split to classes, null model is generated separately for each class, and then these simulations are combined again with
smbind
. With careless invocation, users can generate classes which have only one element, and then several sampling methods fails, sometimes fatally. Here is an overview of models that fail with only one observation:swap
,tswap
andcurveball
go to infinite loop that cannot be interrupted. Same infinite loop problem concerns functions that use these swapping functions:swap_count
,abuswap_r
,abuswap_c
. The only way to get out is to kill R and lose a day's work. Commit 6cc3fd0 will fix this and give a user-error instead of un-interruptable infinite loop.r2dtable
fails with a cryptic error messageError in r2dtable(fill, rf, cf) : invalid argument 'r'
. Functions that depend onr2dtable
fails similarly:quasiswap_count
,swsh_samp
,swsh_both
,swsh_samp_r
,swsh_samp_c
,swsh_both_r
,swsh_both_c
.c0_samp
andc0_both
with one site andr0_samp
andc0_both
with one species fail with error message onnumber of items to replace is not a multiple of replacement length
. Probably this happens because of dropping dimensions.backtrack
fails withError in sample.int(length(x), size, replace, prob) : too few positive probabilities
.Many of these are user errors, but models
r00
,r0
,c0
and quantitativer00_
,r0_
,c0_
models based on these can produce different one-item matrices (but I haven't checked if these are valid: they may not be). We do not expect to see this usage at large, but with stratified models they just may appear. The question is should we handle these more gracefully than with these error messages. Moreover, we probably should verify that the quantitative models are valid ones.One thing that must be fixed are the swap models (
swap
,tswap
,curveball
): it is a user error to ask swapping of one row or one column, but un-interruptable infinite loop is unacceptable. I'll change it to a normal error.The text was updated successfully, but these errors were encountered: