Re: [R] Calculation of ratio distribution properties
MathCad code failed to attach last time. Here it is. On 25-May-07, at 2:24 PM, Mike Lawrence wrote: I came across this reference: http://www.informaworld.com/smpp/content? content=10.1080/03610920600683689 The authors sent me code (attached with permission) in MathCad to perform the calculations in which I'm interested. However, I do not have MathCad nor experience with its syntax, so I thought I'd send the code to the list to see if anyone with more experience with R and MathCad would be interested in making this code into a function or package of some sort Mike Begin forwarded message: From: Noyan Turkkan [EMAIL PROTECTED] Date: May 25, 2007 11:09:02 AM ADT To: Mike Lawrence [EMAIL PROTECTED] Subject: Rép. : R code for 'Density of the Ratio of Two Normal Random Variables'? Hi Mike I do not know if anyone coded my approach in R. However if you have acces to MathCad, I am including a MathCad file (also in PDF) which computes the density of the ratio of 2 dependent normal variables, its mean variance. If you do not have acces to MathCad, you will see that all the computations can be easily programmed in R, as I replaced Hypergeometric function by the Erf function. I am not very familiar with R but the erf function may be programmed as : (erf - function(x) 2*pnorm(x *sqrt(2)) - 1). Good luck. Noyan Turkkan, ing. Professeur titulaire directeur / Professor Head Dépt. de génie civil / Civil Eng. Dept. Faculté d'ingénierie / Faculty of Engineering Université de Moncton Moncton, N.B., Canada, E1A 3E9 Mike Lawrence [EMAIL PROTECTED] 05/25/07 9:20 am Hi Dr. Turkkan, I am working on a problem that necessitates the estimation of the mean and variance of the density of two dependent normal random variables and in my search for methods to achieve such estimation I came across your paper 'Density of the Ratio of Two Normal Random Variables' (2006). I'm not a statistics or math expert by any means, but I am quite familiar with the R programming language; do you happen to know whether anyone has coded your approach for R yet? Cheers, Mike -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein Ratio2depNV.pdf -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculation of ratio distribution properties
According to the paper I cited, there is controversy over the sufficiency of Hinkley's solution, hence their proposed more complete solution. On 25-May-07, at 2:45 PM, Lucke, Joseph F wrote: The exact ratio is given in On the Ratio of Two Correlated Normal Random Variables, D. V. Hinkley, Biometrika, Vol. 56, No. 3. (Dec., 1969), pp. 635-639. -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calculation of ratio distribution properties
Mike, Attached is an R function to do this, along with an example that will reproduce the MathCad plot shown in your attached paper. I haven't checked it thoroughly, but it seems to reproduce the MathCad example well. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Lawrence Sent: Friday, May 25, 2007 1:55 PM To: Lucke, Joseph F Cc: Rhelp Subject: Re: [R] Calculation of ratio distribution properties According to the paper I cited, there is controversy over the sufficiency of Hinkley's solution, hence their proposed more complete solution. On 25-May-07, at 2:45 PM, Lucke, Joseph F wrote: The exact ratio is given in On the Ratio of Two Correlated Normal Random Variables, D. V. Hinkley, Biometrika, Vol. 56, No. 3. (Dec., 1969), pp. 635-639. -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calculation of ratio distribution properties
Hi all, Looking to calculate the expected mean and variance of a ratio distribution where the source distributions are gaussian with known parameters and sample values are correlated. I see (from wikipedia: http://en.wikipedia.org/wiki/ Ratio_distribution#Gaussian_ratio_distribution) that this calculation is quite involved, so I'm hoping that someone has already coded a function to achieve this. Thanks, Mike -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University Website: http://myweb.dal.ca/mc973993 Public calendar: http://icalx.com/public/informavore/Public The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.