Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- General Programming
- /
- Rand()

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-14-2016 03:42 PM

Hello,

I use Proc severity and i have parameter for GPD distribution,

I would like to use them to simulate an sampling of GPD like a "rand("Weib", 0.25,2.1)"

My parameters are for theta =126998.5 and for xi =0.31954.

Accepted Solutions

Solution

09-20-2016
06:19 AM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Azeddine

09-20-2016 06:18 AM

If you shows that DATA step and PROC UNIVARIATE call, we can help diagnose the problem.

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Azeddine

09-15-2016 10:08 AM

Reference: p 113 of Wicklin (2013) Simulating Data with SAS

The discussion begins with "you can use the inverse CDF algorithm to simulate random variates." It ends with this DATA step code:

U = rand("Uniform");

X = theta - sigma/alpha * (U**alpha-1);

The three-parameter distribution for the above uses the parameterization documented in PROC UNIVARIATE: theta=threshold, sigma=scale, and alpha=shape.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

09-20-2016 03:51 AM

Thank you for your answer, in my case it doesn't work,

So i try with a analytic inversion of function:

The initial Function of GPD is defined here in proc severity:

with x=(x'-Treshold)

I use this formula :

X'=&Treshold+(((1-rand('uniform'))**(-&&Gpd_xi))-1)*(&&Gpd_theta/&&Gpd_xi)

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Azeddine

09-20-2016 05:54 AM

You say it doesn't work. Please show us the SAS code you are using.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

09-20-2016 06:08 AM

To be honnest it gave me result but the result are different between resimulation with proc univariate and your resimulation.

Solution

09-20-2016
06:19 AM

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Azeddine

09-20-2016 06:18 AM

If you shows that DATA step and PROC UNIVARIATE call, we can help diagnose the problem.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

09-20-2016 09:18 AM

Here is simulation code and PROC UINIVARIATE code that shows agreement between the parameters and the parameter estimates.

```
/* simulation of generalized pareto distribution */
data GenPareto(keep= X);
alpha = 1/4; /* shape */
sigma = 10; /* scale */
theta = 1.5; /* threshold */
call streaminit(1);
/* support of x is theta + (0, sigma/alpha] = theta + (0,40] */
do i = 1 to 400;
U = rand("Uniform");
X = theta - sigma/alpha * (U**alpha - 1);
output;
end;
run;
proc univariate data=GenPareto;
histogram x / pareto(threshold=1.5); /* parameters are alpha=0.25 sigma=10 */
ods select histogram;
run;
```