search for: dhyper

Displaying 20 results from an estimated 47 matches for "dhyper".

Did you mean: hyper
1998 Apr 03
1
R-beta: Bug in dhyper (and phyper) (fwd)
Last night I sent the bug report below to r-help. I have since then looked at dhyper.c and found: if (NR < 0 || NB < 0 || n <= 0 || n > N) DOMAIN_ERROR; I changed 'n <= 0' to 'n < 0' and then dhyper worked as I wanted. Am I introducing some potentially dangerous behaviour by this change? Goran ----------------------------...
2004 Nov 24
1
(PR#7393) Re: dhyper() does not allow non-integer values for
...able text, while the remaining parts are likely unreadable without MIME-aware tools. ---1936847065-1111238301-1101309010=:193006 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 24 Nov 2004 Erik.Jorgensen@agrsci.dk wrote: > > dhyper() does not allow non-integer values for input parameters m and n. > > this is in contrast to the other functions in the _hyper() "family", I would argue that the bug was in the other functions. If not, there is a= =20 bug in the documentation, which gives no way to tell what the re...
2008 Feb 27
1
dhyper, phyper (PR#10853)
...uld use the function phyper() for this because, as I interpret the help files, this routine yields cumulative hypergeometric probabilities. But I'm finding that it gives different results than seber(). I apologize if I am in too far over my head, but I am wondering if this is a bug in dhyper/phyper? Perhaps I have misunderstood what phyper() actually does, or am calling it incorrectly? Or, were Fieller and Turner in error? All the best, Tom Thomas Dye Dean Hall 201, Tuesday 1:00-1:55 pm
2004 Nov 25
0
(PR#7393) Re: dhyper() does not allow non-integer values for
>>>>> "PD" == Peter Dalgaard <p.dalgaard@biostat.ku.dk> >>>>> on 24 Nov 2004 18:32:15 +0100 writes: PD> tlumley@u.washington.edu writes: >> > > dhyper() does not allow non-integer values for input >> parameters m and n. >> > >> > this is in contrast to the other functions in the >> _hyper() "family", >> >> I would argue that the bug was in the other functions. If &gt...
2012 Oct 01
1
Retrieve hypergeometric results in large scale
I'm going to use dhyper(x, m, n, k) to get a 95% coverage. Let me use an example to explain my problem: Suppose I have a urn containing 90 red and 10 black balls. Now I wanna remove 3 from the urn. By the following codes: m<-90;n<-10;k<-3; x<-0:3 dhyper(x,m,n,k) I can obtain the probability that 0,1,2,3 re...
2009 Oct 16
1
How odds ratio is computed in fisher.test()?
...d. I thought that it is (n11/n12)/(n21/n22), but it is not what fisher.test() computes. Could somebody let me know? > n11=3 > n12=1 > n21=1 > n22=3 > > n1_=n11+n12 > n2_=n21+n22 > > n_1=n11+n21 > n_2=n12+n22 > > x=rbind(c(n11,n12),c(n21,n22)) > > threshold=dhyper(n11,n1_,n2_,n_1) > probability=dhyper(0:n_1,n1_,n2_,n_1) > sum(probability[probability<=threshold]) [1] 0.4857143 > (n11/n12)/(n21/n22) [1] 9 > fisher.test(x) Fisher's Exact Test for Count Data data: x p-value = 0.4857 alternative hypothesis: true odds ratio is not equ...
2003 Oct 01
1
hypergeometric & population estimates
...ared caribou. We want to estimate the number of caribou in this population with 95% confidence limits. Gary White uses the hypergeometric distribution and determines the population estimates using maximum likelihood and 95%CL as -2LogLikelihoods. Below, I determined the population estimate using dhyper(x,m,n,k) and maximizing the density value as a function of n, but do not know how I should calculate MLE with this distribution. x <- 8 # number resighted caribou (white balls drawn) m <-11 # number collared caribou (white balls total) k <- 70 # number caribou see...
1998 Mar 26
3
R-beta: Teach material for R
A non-text attachment was scrubbed... Name: not available Type: text Size: 1480 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19980326/974231c9/attachment.pl
2003 Nov 14
2
Round error?
Hi all, I have tried to compute a p-value for a hypergeometric distribution as: dhyper(x,k,l,n) + phyper(x,k,l,n,lower.tail=FALSE) and sometimes obtained negative values. Do you know if it is because a round error or am I doing something wrong? Thanks in advance, Aurora
2008 Dec 03
1
hypergeometric
...did read through the R documentation on hypergeometric but not really sure what it means. I would like to evaluate the hypergeometric function as follows: F((2*alpha+1)/2, (2*alpha+2)/2 , alpha+1/2, betasq/etasq). I'm not sure which function should be used- either phyper or qhyper or dhyper Where alpha <- .75; beta1 <- 7 ; beta2 <- 5.5; etasq <- ((beta1+beta2)/(2*beta1*beta2*(1-rho))) ^2 betasq <- ((beta1-beta2)^2+4*beta1*beta2*rho)/(4*beta1^2*beta2^2*(1-rho)^2) Thank you so much for your help. [[alternative HTML version deleted]]
2004 Apr 15
0
phyper accuracy and efficiency (PR#6772)
...) (65.213.85.218) Time to kick phyper's tires... The current version has very serious cancellation issues. For example, if you ask for a small right-tail you are likely to get total cancellation. For example phyper(59, 150, 150, 60, FALSE, FALSE) gives 6.372680161e-14. The right answer is dhyper(0, 150, 150, 60, FALSE) which is 5.111204798e-22. phyper is also really slow for large arguments. Therefore, I suggest using the code below. This is a sniplet from Gnumeric, so you'll have to s/gnm_float/double/ and s/gnum//, etc. The code isn't perfect. In fact, if i*(NR+NB) is close...
2017 Aug 25
2
Are r2dtable and C_r2dtable behaving correctly?
It is not about "really arge total number of observations", but: set.seed(4711);tabs <- r2dtable(1e6, c(2, 2), c(2, 2)); A11 <- vapply(tabs, function(x) x[1, 1], numeric(1));table(A11) A11 0 1 2 166483 666853 166664 There are three possible matrices, and these come out in proportions 1:4:1, the one with all cells filled with ones being most common. Cheers, Jari
2008 Aug 21
1
pnmath compilation failure; dylib issue?
...0.4 -std=gnu99 -dynamiclib -Wl,- headerpad_max_install_names -mmacosx-version-min=10.4 -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/ lib -o pnmath.so bd0.o beta.o chebyshev.o choose.o d1mach.o dbeta.o dbinom.o dcauchy.o dchisq.o dexp.o df.o dgamma.o dgeom.o dhyper.o dlnorm.o dlogis.o dnbeta.o dnbinom.o dnchisq.o dnf.o dnorm.o dnt.o dpois.o dt.o dunif.o dweibull.o fmax2.o fmin2.o ftrunc.o gamma.o gamma_cody.o i1mach.o imax2.o imin2.o lbeta.o lgamma.o lgammacor.o mlutils.o pbeta.o pbinom.o pcauchy.o pchisq.o pexp.o pf.o pgamma.o pgeom.o phyper.o plno...
2017 Aug 25
0
Are r2dtable and C_r2dtable behaving correctly?
...11 <- vapply(tabs, function(x) x[1, 1], numeric(1));table(A11) > > A11 > 0 1 2 > 166483 666853 166664 > > There are three possible matrices, and these come out in proportions 1:4:1, the one with all cells filled with ones being > most common. ... and > dhyper(0:2,2,2,2) [1] 0.1666667 0.6666667 0.1666667 > dhyper(0:2,2,2,2) *6 [1] 1 4 1 so that is exactly what you would expect. However, > dhyper(10782,209410, 276167, 25000) [1] 0.005230889 so you wouldn't expect 10782 to recur. It is close to the mean of the hypergeometric distribution, but...
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1998 Feb 23
0
R-beta: Hypergeometric Probabilities
...NB++; term *= (NR / xr) * (xb / NB); xb--; NR--; } If the first "term" is 0, the rest will be. This is the case in the example given above. One can get the correct cumulative probabilities by using "cumsum" and "dhyper", of course. Possibly it would be wise to modify "phyper" to fix this problem. (One easy modification would be to add an "if" statement to check on the parameters. If they're suitably small, use the current method. If they're larger, compute the probabilities as i...
2008 Sep 10
1
A question about the hypergeometric distribution and phyper()
Dear All I have a question about the hypergeomteric distribution. Example 1: I have a universe of 6187 objects, and 164 have a particular attribute, therefore 6187-164 do not have that attribute. I sample 249 of those objects, and find that 19 have that attribute. I get a p-value here (looking at just over-representation): phyper(19, 164, 6187-164, 249, lower.tail=FALSE) [1] 7.816235e-06
2009 Jul 17
2
Fisher's exact test
Hi, I'm trying to run Fisher's Exact test on the data below, but I'm not sure how interpret the data shown. Can someone tell me what this is saying? Looking at the numbers it should be that there's no significant difference between the HDL and LDL, but a p-value of 1 seems high. Is the low value in the LDL unbound making the test unstable and should I be using an alternative? Best
2002 Aug 05
2
options(digits) (PR#1879)
...dicates that the vector hasn't been generated in the proper way, or something, but I thought I'd report it all the same. [Previously saved workspace restored] > sqrt(2) [1] 1.414214 > options(digits=4) > sqrt(2) [1] 1.414 > options(digits=3) > for(j in 1:30){temp[j]<-sum(dhyper(0:6, j, 30 - j, 6)[3:7])} > temp [1] 0.0000 0.0345 0.0936 0.1691 0.2543 0.3438 0.4333 0.5195 0.6002 0.6736 [11] 0.7389 0.7956 0.8437 0.8835 0.9157 0.9410 0.9603 0.9744 0.9844 0.9912 [21] 0.9954 0.9979 0.9992 0.9998 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 > sqrt(2) [1] 1.41 > temp [1] 0...