[R] R-function available for noncentral hypergeometric distribution

Jason Liao jg_liao at yahoo.com
Sat Sep 8 16:04:40 CEST 2001


For those who are interested, I have made available a R function for
noncentral hypergeometric distribution at

http://www.geocities.com/jg_liao/software/Hypergeometric/hypergeometric_in_R.txt

The paper that describes the algorithm will appear in The American
Statistician.  

The function does not run on S-plus as the R's scoping rule is used.
Here is how the function can be used:

 
>  n1 <- 100
>  n2 <- 100
>  m1 <- 100
>  N <- n1+n2
>  odds.ratio <- 3;
#create an object for this specific non-central hypergeometric
distribution
>  obj <- hypergeometric(n1, n2, N, odds.ratio)
#get the mean
>  obj$mean()
[1] 63.46481
#get the variance
>  obj$var()
[1] 11.66092
#probability mass at 40
>  obj$d(40)
[1] 1.978419e-11
#cumulative distribution from lower end to 40
>  obj$p(40)
[1] 2.304486e-11
#generates one random deviate from the distribution
>  obj$r()
[1] 63
  

=====
Jason G. Liao
Department of Biometry and Epidemiology
Medical University of South Carolina
135 Rutledge Ave., STE 1148, Charleston, SC 29425
phone (843) 876-1114, fax (843) 876-1126

http://www.geocities.com/jg_liao/index.html

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list