BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Garnett
Obsidian | Level 7


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!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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.

View solution in original post

5 REPLIES 5
Rick_SAS
SAS Super FREQ

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.

Garnett
Obsidian | Level 7

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;

Rick_SAS
SAS Super FREQ

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.

Garnett
Obsidian | Level 7

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!

Rick_SAS
SAS Super FREQ

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 5 replies
  • 2473 views
  • 0 likes
  • 2 in conversation