Programming the statistical procedures from SAS

qqplot or pp plot

Reply
Contributor
Posts: 39

qqplot or pp plot

Hi,

I am trying qqplot/ppplot for inverse gaussian. SAS support website says to use :

proc univariate data=name;

           qqplot var/ igauss(mu= lambda= );

run;

But I am getting an error. Any idea why is it not working? I can make it work for gamma but not inv gaussian. I can't find any alternatives either.

Thanks for any help.

Grand Advisor
Posts: 16,928

Re: qqplot or pp plot

For SAS 9.3 inverse gaussian isn't a valid parameter, the distributions options are:

Can you point to where the SAS support website provides that option?

Base SAS(R) 9.3 Procedures Guide: Statistical Procedures

Option

Description

BETA(beta-options)

specifies beta Q-Q plot for shape parameters and specified with mandatory ALPHA= and BETA= beta-options

EXPONENTIAL(exponential-options)

specifies exponential Q-Q plot

GAMMA(gamma-options)

specifies gamma Q-Q plot for shape parameter specified with mandatory ALPHA= gamma-option

GUMBEL(Gumbel-options)

specifies gumbel Q-Q plot

LOGNORMAL(lognormal-options)

specifies lognormal Q-Q plot for shape parameter specified with mandatory SIGMA= lognormal-option

NORMAL(normal-options)

specifies normal Q-Q plot

PARETO(Pareto-options)

specifies generalized Pareto Q-Q plot for shape parameter specified with mandatory ALPHA= Pareto-option

POWER(power-options)

specifies power function Q-Q plot for shape parameter specified with mandatory ALPHA= power-option

RAYLEIGH(Rayleigh-options)

specifies Rayleigh Q-Q plot

WEIBULL(Weibull-options)

specifies three-parameter Weibull Q-Q plot for shape parameter specified with mandatory C= Weibull-option

WEIBULL2(Weibull2-options)

specifies two-parameter Weibull Q-Q plot

Contributor
Posts: 39

Re: qqplot or pp plot

here is for ppplot:

Base SAS(R) 9.3 Procedures Guide: Statistical Procedures

got the igauss syntex from here:

Base SAS(R) 9.3 Procedures Guide: Statistical Procedures

Is there any way to get qqplot for inverse gaussian if proc univariate does not work.

Thanks

Valued Guide
Valued Guide
Posts: 679

Re: qqplot or pp plot

In 9.3, you can get a ppplot, but not a qqplot. If you check the documentation, igauss is only a valid option on ppplot. I just did this using:

proc univariate data=a;

var x;

ppplot x / igauss;

run;

Contributor
Posts: 39

Re: qqplot or pp plot

Hmmm! it is pretty strange. If I try the exact code with gamma option, it works, but iguass option does not work. SAS does not even recognize it as a valid option.

Thanks for the help.

Grand Advisor
Posts: 16,928

Re: qqplot or pp plot

Its not a valid option for qqplot according to the SAS Docs.

The only way I could think of is pretty much brute force, generating the values and using proc gplot.

Respected Advisor
Posts: 2,655

Re: qqplot or pp plot

Since the inverse Gaussian is an exponential family, you might try:

proc univariate data=a;

var x;

qqplot x / exponential;

run;

A reference line can be inserted by noting that THETA=-lambda/(2*mu*mu) and SIGMA=-lambda/2 (I think.  Those might be reversed).  And no guarantees on this one--it's just a possibility.

Steve Denham

Contributor
Posts: 39

Re: qqplot or pp plot

Steve,

Your code does work. However, I need to draw a reference line at 45 degree for comparison. It might be a silly question, but I could not find any resources for help with that. Thanks!

Respected Advisor
Posts: 2,655

Re: qqplot or pp plot

Today's scary approach:

proc univariate data=a;

var x;

qqplot x / exponential(theta=est sigma=est);

run;

That should give you a 45 degree line, and estimates of theta and sigma.  From those values, you can calculate lambda and mu for the inverse gaussian.

Why is this scary?  It's untested, and right now, I don't have time to write a program that would generate 1000 inv-gaussian random variates with known lambda and mu values to check it.

Steve Denham

SAS Super FREQ
Posts: 3,319

Re: qqplot or pp plot

You can produce the quantiles for IGAUSS and use them to produce a Q-Q plot. See Modeling the distribution of data? Create a Q-Q plot - The DO Loop

You can use the LINEPARM statement in PROC SGPLOT to produce a diagonal line. See Add a diagonal line to a scatter plot: The SAS 9.3 way - The DO Loop

Contributor
Posts: 39

Re: qqplot or pp plot

Hi Rick,

Thanks for your reply. There are many useful information on the links you provided. I was able to get the qqplot as per your instruction. However, I was not able to draw the diagonal line because I am using SAS9.2 so lineparm will not work.

Thanks much,

-CD

SAS Super FREQ
Posts: 3,319

Re: qqplot or pp plot

The very first sentence of the blog post  "Add a diagonal line..." contains a link to an article that shows how to add a diagonal line at SAS 9.2.

Ask a Question
Discussion stats
  • 11 replies
  • 637 views
  • 0 likes
  • 5 in conversation