BookmarkSubscribeRSS Feed
Quantopic
Obsidian | Level 7

Hi all,

 

By using SEVERITY procedure, I found that the exponential distribution is the one that fits better empirical data; so, I got the parameter theta.

 

I built a random dataset distributed according to an exponential distribution wiith parameter theta equal to 0.7423, on the basis of the following code:

 

 

data exponential (keep = x);
	call streaminit(&seed.);
	theta = &theta.;
		do i = 1 to &n.;
			x = theta * rand("Exponential");
			output;
		end;
run;

 

where n, theta estimate and seed are previosly defined.

 

After that, I merge the empirical data with the ones etimated above.

 

Now, I want to compare graphically the distributions.

 

Can you suggest a way to overlay them?

 

Thanks all!

 

 

 

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Is this a "from a stats point of view whats the best way to graphically represent this type of data" 

or a "technically how do I overlay data in a graph" question?

I can't answer the first as thats all greek to me (literally), but for the second, using sgplot ot Graph Template language it is very easy to overlay multiple plots, first join your data, then sgplot it:

proc sgplot data=have;
  scatter x=xvalue y=empirical;
  scatter x=xvalue y=othervalue;
run;

Will overlay the two graphs, although need to check axis values etc, to make sure they match somehow (not much good if all of one set of values is 100* more than the other for instance.

 

Rick_SAS
SAS Super FREQ

You've generated random Exp(theta) data. A better way is to compute the Exp(theta) PDF (density) and overlay that.  You can do it with PROC SGPLOT, but the easiest way is to use the ODS graphics that are automatically produced by PROC SEVERITY or PROC UNIVARIATE. Try submitting

ODS GRAPHICS ON;

before you run the PROC SEVERITY code and you should automatically get a histogram and a fitted density curve, as shown below:

data exponential (keep = x);
call streaminit(12345);
theta = 7;
do i = 1 to 200;
	x = theta * rand("Exponential");
	output;
end;
run;

ods graphics on;
proc severity data=exponential;
   loss x;
   dist exp;
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1699 views
  • 0 likes
  • 3 in conversation