-
Notifications
You must be signed in to change notification settings - Fork 95
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
Error in tmp[, seq_len(p) + p + 1] : subscript out of bounds #276
Comments
Thanks @kdyson. What's |
Oh shoot, yeah--that's just my var for how many permutations I want things to do. It's set at 99999 for the example. |
Also--this may end up being a parallel error? removing that argument also seems to fix things. |
No error with me, but copy-pasting the example (and with Permutation test for adonis under reduced model
Terms added sequentially (first to last)
Permutation: free
Number of permutations: 99999
adonis2(formula = sqrt(species.site) ~ gc.simple + acres, data = troubleshoot, permutations = perm, method = "bray", by = "terms", parallel = 2)
Df SumOfSqs R2 F Pr(>F)
gc.simple 1 0.02657 0.02485 0.9688 0.9729
acres 1 0.02773 0.02594 1.0110 0.2491
Residual 37 1.01469 0.94921
Total 39 1.06898 1.00000 This was with vegan 2.5-1 using R 3.4.4 on macOS. Obviously we need more detail. However, the error line reported in the header of this message is line 170 of |
@kdyson : are you on Windows? We use different parallel processing there than in Unix-like systems (Linux, macOS), and I have not tested that extensively since I have no Windows. It could be a bug in the code that we use when we fork to Windows-compatible type of parallel processing (which we can replicate in Unix-like systems if we set up the clusters before processing). However, it is past midnight over here, and I'll wait till sunrise before having a look at that. |
Yep, I am on Windows, v. 10.0.16299.371, vegan 2.5-1, parallel 3.4.4, R 3.4.4. Thanks so much for looking into this, I appreciate it! Easy enough to turn off parallel for now but with next-gen sequencing data sets it's nice to have :) |
I could reproduce it on Mac as well by explicitly defining the cluster (which happens inside cl <- makeCluster(2)
adonis2(
formula = sqrt(species.site) ~ gc.simple + acres,
data = troubleshoot,
parallel = cl,
permutations = perm,
method = "bray",
by = "terms"
)
# Error in tmp[, seq_len(p) + p + 1] : subscript out of bounds
stopCluster(cl) I suspect the dimensions of |
@psolymos that was my suspicion, too. Should happen in the parallel processing block well before crash line 170. Go to check this (and if this is a problem, we probably need to check the parallel code blocks in other functions, too). |
@jarioksa : in debug, It is not a cluster vs. forking issue, but rather wrong dimension assumed in the the cluster case only. |
With by="terms" the permutest.cca evaluates all contrasts within compiled code and the number of columns in return matrix depends on the number of contrasts. Socket clusters in parallel processing where not adapted to this, but assumed only tests of one term. Socket clusters are used as the only alternative in Windows, and optional with pre-set clusters in unix-like systems. Addresses github issue #276 where this was reported for adonis2. Obviously also influences by="onedf" in permutest, although this was not tested.
I think this really is a bug in handling socket clusters in parallel processing. Socket clusters are the only available alternative in Windows, and they can be invoked in Linux and macOS as predefined clusters generated by |
Probably fixed with 8003a4f, but needs testing also in Windows. |
A recent update (between 2.4.1 I think and current) has created an error in permutest.cca under specific conditions.
Minimum reproducible example:
Changing by to "margin" or explicitly calling ~ troubleshoot$gc.simple etc. seems to fix the problem. Smaller tables and one variable models also work fine.
The text was updated successfully, but these errors were encountered: