[R] Custom sampling method in R XXXX

Dan Abner dan.abner99 at gmail.com
Mon Jun 23 23:11:00 CEST 2014

 Hi all,

I have the following situation and a good efficient way to perform
this operation in R has not come to me. Any suggestions/input are

I have a user-defined parameter (let's call it x) whose value is
selected from a set of possible values (j). Once the user selects one
of the values of j for x, then I need to map a probability
distribution to the values of j such that the middle probability of
.5385 (see probs below) is associated with the value of x and the tail
probabilities are assigned to the 2 values below x and 2 values above
x in j. Therefore, in the example below:


probabilities would be assigned to the values of j as such:

value     probability
0            0.023077
0.125     0.207692
0.25       0.538462
0.375     0.207692
0.5         0.023077

And then 1 value of j is selected based on the associated probability.
Any ideas on an efficient way to do this?

An added dimension of complexity is when the value of x is selected
near the parameter boundary of j. If x = 0, then the easiest thing I
can think of is to assign probabilities as:

value      probability
0             0.76923077
0.125      0.207692
0.25        0.023077

However, I am open to other possibilities.

Any assistance is appreciated.



More information about the R-help mailing list