behavior of rCRP

19 views
Skip to first unread message

David Christianson

unread,
Oct 3, 2025, 12:46:51 PM (4 days ago) Oct 3
to nimble-users
I am finding the rCRP and dCRP quite useful.  I have a small question about rCRP.  Why does the random generator return return 1 instead of 0 when size=0?
rCRP(n=1,conc=1,size=0)

David Christianson

unread,
Oct 6, 2025, 12:18:20 PM (yesterday) Oct 6
to nimble-users
Or perhaps returning would NA be more consistent as the observation is table assignment of 0 individuals?

Chris Paciorek

unread,
11:32 AM (4 hours ago) 11:32 AM
to David Christianson, nimble-users
Yeah, it looks like we don't handle this corner case in a good way, and thanks for the report. You can see the logic in the `BNP_distributions.R` in the source code. We assign `x[1] = 1` as a starting point even if `size=0`.

I think that what we should probably do is return a 0-length vector in that case (LMK if you think otherwise). I'll file an issue for us to do that in the next (hopefully coming soon) release.
 
-chris

--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/nimble-users/a5714e1d-b4b7-41c2-9f15-4ccfe2f1514fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages