In R:
I have a sample (y) of length 1e4.
y = sample(0:200, 1e4, replace = TRUE)
I have plugged this sample into:
dbinom(y-x,100,0.3)
However, I would like to gather samples from this function but simulate for x values from 0:200
i.e
x = 0:200
For e.g. the first iteration will be 1e4 samples of dbinom(y-0,100,0.3) which will produce 1e4 samples then the next iteration will be dbinom(y-1,100,0.3) etc up until x = 200.
This is for going to be used in getting the M = max(f(y)/h(y)) for accept-reject envelope method however since my f(y) is discrete I would like to sample for each integer value of x = 0:200 and then get the max from there.
However, I am unsure as to how to approach this as I am new to R.
Any help is much appreciated!