turn on suggestions

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

Showing results for

Find a Community

Topic Options

- Subscribe to 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-22-2013 02:58 PM

Hi,

I've used PROC FCMP to solve the following problem:

Find x such that PRBBNRM(x, -0.2, 0.5) = 0.1.

What is the analogous solution in IML?

Thanks in advance!

Accepted Solutions

Solution

08-23-2013
06:38 AM

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

Posted in reply to Garnett

08-23-2013 06:38 AM

A few thoughts:

1) To answer your original question, you can use any root-finding algorithm. If you have SAS/IML 12.1 or later, you can use the FROOT function. For earlier releases, you can use a bisection method. (You don't say which book of mine you have, but in my "blue book" on simulating data, I show root-finding examples in Chapter 7. In the "red book," see the example of the golden section search.)

2) I originally misread your question, I thought you were asking to find the contour of PROBBNRM(x, y, 0.5). But from your follow-up, it looks like that is indeed what you want. For the a bivariate CDF, you can reduce the problem of finding a contour to a series of 1D line searches, as you've done in the FCMP example.

3) I Haven't read the Genz and Bretz paper for a multivaraite CDF. Could you give a more complete reference? They have several papers in this general area.

All Replies

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

Posted in reply to Garnett

08-22-2013 03:47 PM

I'd be interested in hearing how you solved this problem with FCMP.

I want to make sure that you want the contours of the CUMULATIVE bivariate distribution function that are shown in this article: Visualize the bivariate normal cumulative distribution - The DO Loop These are going to be "L-shaped" curves.

I'm double-checking because you could also want the contours of the bivariate density function, which are ellipses.

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

Posted in reply to Rick_SAS

08-22-2013 04:12 PM

Hi Rick, Thanks for your reply (Love your book, BTW). I am, in fact, looking for contours on the cdf, per your Do Loop post. Here is a greatly simplified example. I would like to do this in IML, but instead of the ProbBnrm function, I'd like to try the multivariate normal cdf module developed by Author : ALAN GENZ and FRANK BRETZ. To do this, I believe that I'll have to code the procedure in IML. proc fcmp outlib = work.funcs.math; function Intersection(_y, _x); return(ProbBnrm(_x,_y,0.5)); endsub; function SolveIntersect(_Perc,_x); array solveopts[5] initial abconv relconv maxiter solvstat (.4 .001 1.0e-6 10000); y = solve("Intersection",solveopts, _Perc,.,_x); return(y); endsub; options cmplib=work.funcs; run; quit; data Solved; do x = -1 to 1 by 0.5; Intersection10 = SolveIntersect(0.1,x); output; end; run;

Solution

08-23-2013
06:38 AM

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

Posted in reply to Garnett

08-23-2013 06:38 AM

A few thoughts:

1) To answer your original question, you can use any root-finding algorithm. If you have SAS/IML 12.1 or later, you can use the FROOT function. For earlier releases, you can use a bisection method. (You don't say which book of mine you have, but in my "blue book" on simulating data, I show root-finding examples in Chapter 7. In the "red book," see the example of the golden section search.)

2) I originally misread your question, I thought you were asking to find the contour of PROBBNRM(x, y, 0.5). But from your follow-up, it looks like that is indeed what you want. For the a bivariate CDF, you can reduce the problem of finding a contour to a series of 1D line searches, as you've done in the FCMP example.

3) I Haven't read the Genz and Bretz paper for a multivaraite CDF. Could you give a more complete reference? They have several papers in this general area.

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

Posted in reply to Rick_SAS

08-23-2013 11:43 AM

Thanks. I have the red book. I also only have IML 9.3, so clearly I'm getting behind.

The Genz and Bretz reference was from one of your posts in this forum regarding MVN tail probabilities. I've also worked from some of the papers Genz has on his website: www.math.wsu.edu/faculty/genz/homepage.

In general, my problem is to find points on the surface X such that F(X<= x) = 0.1. For my particular clinical application, I can tolerate a small amount of inaccuracy in those points. It's easy enough to find the curve in 2D using the fcmp solve function for the toy example that I provided (and a small number of applications that I work on). I'd like to develop the method for an arbitrary dimension.

Since I have an older version of IML, I will work with the bisection approach that you described.

Thanks very much for your insights!

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

Posted in reply to Garnett

09-25-2013 03:17 PM

I describe an algorithm (complete with SAS/IML code) for computing contours of the standardized bivariate normal CDF in this article: Compute contours of the bivariate normal CDF - The DO Loop