We using R to run a Pareto/NBD model. One step requires to draw random numbers from a restricted area of the pareto distribution, and the restriction is based on a given value. Does anyone know how to do this?
To explain this with a brief example (see Tables): Existing values to start from are
- Values 1: vector with n numbers (A,B,….N).
- Value 2: vector with n numbers (AA,BB,….NN).
Every value 1 has a corresponding value 2, whereby value 1 < value 2
- Parameter (s, β) of the Pareto distribution
Now we need n number of random draws (i.e. n= as many random draws RD as there are values in Value 2) from the area of a pareto distribution (and only there) where RD ≥ Value1 .
Example
Value 1; Value 2; Random draw from pareto dristribution pRD from area where
A= 10; AA = 20; pRDA ≥ A
B = 20; BB = 21; pRDB ≥ B
C=5; CC= 30; pRDC ≥ C
N= 30; NN = 35; pRDN ≥ N
Any suggestions how to do this in R?????
One suggestion is to run this “restricted random draw” in the following way:
a) calculate the cumulative distribution function (cdf) of the pareto distribution at Value 1
b) draw a uniform random number between this calculated cdf and 1.0
c) Then invert the drawn uniform random number using the cdf of Pareto to get a valid random draw from the Pareto in the desired region
(1) Value 1;
(2) Value 2 With Pareto Parameter (s, β)
(3) a) calculate cumulative distribution function (cdf) of the pareto distribution at Value 1;
(4) b) draw a uniform random number between this calculated cdf and 1.0 (actually I am not certain whether its indeed > or ≥);
(5) c) invert uRD using the cdf of Pareto to;
(6) arrive at desired pRD for every value;
(1); (2); (3); (4); (5); (6)
A= 10; AA = 20; cdfA; cdfA > uRDA> 1.0; invert uRDA by cdfA; 10 ≥ pRDA
B = 20; BB = 21; cdfB; cdfB> uRDB > 1.0; invert uRDB & cdfB; 20 ≥ pRDB
C=5; CC= 30; cdfC; cdfC > uRDB > 1.0; invert uRDC & cdfC; 5 ≥ pRDC
N= 30; NN = 35; cdfN; cdfN > uRDN> 1.0; invert uRDN & cdfN; 30 ≥ pRDN
Does anyone know how to write this in R code?
I hope the explanation is comprehensible.
Any advice is highly appreciated - Thanks a million!!!!!
To explain this with a brief example (see Tables): Existing values to start from are
- Values 1: vector with n numbers (A,B,….N).
- Value 2: vector with n numbers (AA,BB,….NN).
Every value 1 has a corresponding value 2, whereby value 1 < value 2
- Parameter (s, β) of the Pareto distribution
Now we need n number of random draws (i.e. n= as many random draws RD as there are values in Value 2) from the area of a pareto distribution (and only there) where RD ≥ Value1 .
Example
Value 1; Value 2; Random draw from pareto dristribution pRD from area where
A= 10; AA = 20; pRDA ≥ A
B = 20; BB = 21; pRDB ≥ B
C=5; CC= 30; pRDC ≥ C
N= 30; NN = 35; pRDN ≥ N
Any suggestions how to do this in R?????
One suggestion is to run this “restricted random draw” in the following way:
a) calculate the cumulative distribution function (cdf) of the pareto distribution at Value 1
b) draw a uniform random number between this calculated cdf and 1.0
c) Then invert the drawn uniform random number using the cdf of Pareto to get a valid random draw from the Pareto in the desired region
(1) Value 1;
(2) Value 2 With Pareto Parameter (s, β)
(3) a) calculate cumulative distribution function (cdf) of the pareto distribution at Value 1;
(4) b) draw a uniform random number between this calculated cdf and 1.0 (actually I am not certain whether its indeed > or ≥);
(5) c) invert uRD using the cdf of Pareto to;
(6) arrive at desired pRD for every value;
(1); (2); (3); (4); (5); (6)
A= 10; AA = 20; cdfA; cdfA > uRDA> 1.0; invert uRDA by cdfA; 10 ≥ pRDA
B = 20; BB = 21; cdfB; cdfB> uRDB > 1.0; invert uRDB & cdfB; 20 ≥ pRDB
C=5; CC= 30; cdfC; cdfC > uRDB > 1.0; invert uRDC & cdfC; 5 ≥ pRDC
N= 30; NN = 35; cdfN; cdfN > uRDN> 1.0; invert uRDN & cdfN; 30 ≥ pRDN
Does anyone know how to write this in R code?
I hope the explanation is comprehensible.
Any advice is highly appreciated - Thanks a million!!!!!