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!
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.
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.
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;
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.
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!
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
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.