Displaying 1 result from an estimated 1 matches for "smallsamp".
Did you mean:
smallmap
2004 May 19
0
R Optimization 101 for R Newcomers: An extended example
...gger than one needs to total up
to more than K. Again, one can be profligate: if I need about 10 mydat
values on average to sum up to K, if I sample 30 or 40 or some such
thing, I'm sure to have enough (and can always add a check or use
"try()" to make sure if I am faint of heart). If smallsamp is this
sample of the next 30 or 40 values from my large bootstrap sample, then
the following code vectorizes the inner loops:
count <- sum(cumsum(smallsamp)<K)+1
Note a trick here: The <K produces a vector of logical TRUE's for all
cumsum values <K. This is silently treated as nu...