... or: what's the best way to draw (with replacement) from an input a
vector that has a different length (shorter or longer)?
Let's say I have a vector 'myresids' of length T and I want to
draw/resample a random vector of length H != T. How can I do that in
hansl both efficiently and elegantly?
Using 'resample(myresids)[1:H]' would work for H<T but would probably be
inefficient, because T random draws are done instead of just H. (Also it
would have to be replaced by some kind of loop for H>T.)
Or I could do 'myresids[mrandgen(i, 1, T, H, 1)]', which should work for
any H and would hopefully be efficient (?). However, IMHO it's not
easily readable, because only the parameter H is actually really
important in this context, the rest is just confusing syntax.
So, might it be useful to have a better equivalent expression for the
above? I would have suggested 'resample(myresids, H)', but resample()
already has a different second argument.
Any hints for the present syntax or suggestions for new syntax features
appreciated.
thanks,
sven