[R] hypergeometric

2008-12-03 Thread Zakaria, Roslinazairimah - zakry001
Hi,

 

I hope somebody can help me on how to use the hypergeometric function.
I 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]]

__
R-help@r-project.org 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] hypergeometric integral

2014-06-17 Thread Xuse Chuse
Dear all,

I am trying to make a numerical integral of a Hypergeometrical function 2F1
but it is not working. I dont know how to pass the arguments to my
function. Thank you beforehand.
Chuse.

Here is my code:

H <- 0.7;

t <- 1;
s <- seq(0,t,0.1);
x <- 1-t/s;

library(gsl)
Gauss2F1 <- function(H,x){
  a <- H-1/2;
  b <- 1/2-H;
  c <- H+1/2;
#  if(x>=0 & x<1){
#hyperg_2F1(a,b,c,x)
#  }else{
hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b
#  }
}

F <- Gauss2F1(a,b,c,x)

integrate(F,lower=-1,upper=1,H=0.7)

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] hypergeometric function

2008-12-03 Thread Roslina Zakaria
Hi,
 
I hope somebody can help me on how to use the hypergeometric function.  I 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).
 
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) 
 
I’m not sure which function should be used- either phyper or  qhyper or dhyper
 
Thank you so much for your help.


   
__
R-help@r-project.org 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] hypergeometric

2008-12-03 Thread Jarle Brinchmann
The dhyper etc deal with the hypergeometric _distribution_ while what
you appear to want have is the hypergeometric special function (the
connection is that the regular  hypergeometric function is the
generating function for the hypergeometric distribution if I recall
correctly).

Anyway, what you need, I believe, is the hypergeo library from CRAN.

 Cheers,
 Jarle.

On Wed, Dec 3, 2008 at 9:17 AM, Zakaria, Roslinazairimah - zakry001
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I hope somebody can help me on how to use the hypergeometric function.
> I 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]]
>
> __
> R-help@r-project.org 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@r-project.org 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] hypergeometric

2008-12-03 Thread Robin Hankin

The hypergeo package should be able to deal with this,
although the function you specify below looks like a degenerate case
(if I understand it correctly) so the convergence rate
is likely to be slow.

Let me know how you get on

best wishes

Robin (author of hypergeo)




Jarle Brinchmann wrote:

The dhyper etc deal with the hypergeometric _distribution_ while what
you appear to want have is the hypergeometric special function (the
connection is that the regular  hypergeometric function is the
generating function for the hypergeometric distribution if I recall
correctly).

Anyway, what you need, I believe, is the hypergeo library from CRAN.

 Cheers,
 Jarle.

On Wed, Dec 3, 2008 at 9:17 AM, Zakaria, Roslinazairimah - zakry001
<[EMAIL PROTECTED]> wrote:
  

Hi,



I hope somebody can help me on how to use the hypergeometric function.
I 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.







--
Robin K. S. Hankin
Uncertainty Analyst
University of Cambridge
19 Silver Street
Cambridge CB3 9EP
01223-764877

__
R-help@r-project.org 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] hypergeometric vs fisher.test

2010-08-13 Thread Andrea Franceschini

Dear R team,
I have a simple question.

I tried this command:
phyper(17,449,19551,181, FALSE)
[1] 1.47295e-07

and then I tried this command:
(fisher.test(matrix(c(17,449,181,19551),2,2),
alternative='greater'))$p.value
[1] 3.693347e-06


Shouldn't be identical the results of the two commands ?
What is the difference ?

Thx a lot
-- 
View this message in context: 
http://r.789695.n4.nabble.com/hypergeometric-vs-fisher-test-tp2324223p2324223.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] hypergeometric integral

2014-06-17 Thread JLucke
#First, correct your code
H <- 0.7;

t <- 1;
s <- seq(0,t,0.1);
x <- 1-t/s;

library(gsl)
Gauss2F1 <- function(H,x){
  a <- H-1/2;
  b <- 1/2-H;
  c <- H+1/2;
  #  if(x>=0 & x<1){
  #hyperg_2F1(a,b,c,x)
  #  }else{
  hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b
  #  }
}

#Here
#F <- Gauss2F1(a,b,c,x)
#and here
#integrate(F,lower=0,upper=1,H=0.7)

integrate(Gauss2F1,lower=0,upper=1,H=0.7)

Error in integrate(Gauss2F1, lower = 0, upper = 1, H = 0.7) : 
  non-finite function value

#Then note that
Gauss2F1(H,x)
 [1]  Inf 1.143016 1.083553 1.056065 1.039444 1.028055 1.019653 
1.013143 1.007920 1.003618
[11] 1.00
#whereupon you find your second problem.
#Joe



Xuse Chuse  
Sent by: r-help-boun...@r-project.org
06/17/2014 08:32 AM

To
r-help , 
cc

Subject
[R] hypergeometric integral






Dear all,

I am trying to make a numerical integral of a Hypergeometrical function 
2F1
but it is not working. I dont know how to pass the arguments to my
function. Thank you beforehand.
Chuse.

Here is my code:

H <- 0.7;

t <- 1;
s <- seq(0,t,0.1);
x <- 1-t/s;

library(gsl)
Gauss2F1 <- function(H,x){
  a <- H-1/2;
  b <- 1/2-H;
  c <- H+1/2;
#  if(x>=0 & x<1){
#hyperg_2F1(a,b,c,x)
#  }else{
hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b
#  }
}

F <- Gauss2F1(a,b,c,x)

integrate(F,lower=-1,upper=1,H=0.7)

 [[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] hypergeometric integral

2014-06-17 Thread JLucke
I made a stupid mistake.  My note at the end is irrelevant as is the code 
before the library statement.
Instead, the upper bound to your integral must be around .5, not 1.


> integrate(Gauss2F1,lower=0,upper=.5,H=0.7)
0.4954698 with absolute error < 5.5e-15

> integrate(Gauss2F1,lower=0,upper=.51,H=0.7)
Error in integrate(Gauss2F1, lower = 0, upper = 0.51, H = 0.7) : 
  non-finite function value




> 








jlu...@ria.buffalo.edu 
Sent by: r-help-boun...@r-project.org
06/17/2014 10:24 AM

To
Xuse Chuse , 
cc
r-help , r-help-boun...@r-project.org
Subject
Re: [R] hypergeometric integral






#First, correct your code
H <- 0.7;

t <- 1;
s <- seq(0,t,0.1);
x <- 1-t/s;

library(gsl)
Gauss2F1 <- function(H,x){
  a <- H-1/2;
  b <- 1/2-H;
  c <- H+1/2;
  #  if(x>=0 & x<1){
  #hyperg_2F1(a,b,c,x)
  #  }else{
  hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b
  #  }
}

#Here
#F <- Gauss2F1(a,b,c,x)
#and here
#integrate(F,lower=0,upper=1,H=0.7)

integrate(Gauss2F1,lower=0,upper=1,H=0.7)

Error in integrate(Gauss2F1, lower = 0, upper = 1, H = 0.7) : 
  non-finite function value

#Then note that
Gauss2F1(H,x)
 [1]  Inf 1.143016 1.083553 1.056065 1.039444 1.028055 1.019653 
1.013143 1.007920 1.003618
[11] 1.00
#whereupon you find your second problem.
#Joe



Xuse Chuse  
Sent by: r-help-boun...@r-project.org
06/17/2014 08:32 AM

To
r-help , 
cc

Subject
[R] hypergeometric integral






Dear all,

I am trying to make a numerical integral of a Hypergeometrical function 
2F1
but it is not working. I dont know how to pass the arguments to my
function. Thank you beforehand.
Chuse.

Here is my code:

H <- 0.7;

t <- 1;
s <- seq(0,t,0.1);
x <- 1-t/s;

library(gsl)
Gauss2F1 <- function(H,x){
  a <- H-1/2;
  b <- 1/2-H;
  c <- H+1/2;
#  if(x>=0 & x<1){
#hyperg_2F1(a,b,c,x)
#  }else{
hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b
#  }
}

F <- Gauss2F1(a,b,c,x)

integrate(F,lower=-1,upper=1,H=0.7)

 [[alternative HTML version deleted]]

__
R-help@r-project.org 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.


 [[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] hypergeometric vs fisher.test

2010-08-13 Thread peter dalgaard

On Aug 13, 2010, at 3:47 PM, Andrea Franceschini wrote:

> 
> Dear R team,
> I have a simple question.
> 
> I tried this command:
> phyper(17,449,19551,181, FALSE)
> [1] 1.47295e-07
> 
> and then I tried this command:
> (fisher.test(matrix(c(17,449,181,19551),2,2),
> alternative='greater'))$p.value
> [1] 3.693347e-06
> 
> 
> Shouldn't be identical the results of the two commands ?
> What is the difference ?

Just read the phyper docs more carefully (and perhaps revisit the theory), and 
you'll see that phyper is using margin totals of the table, where fisher.test 
is using the individual entries. Also beware of left/right continuity issues 
with tails of discrete distributions: The convention is that the lower and the 
upper tail sums to 1, so your "17" is NOT included in the upper tail.

> 
> Thx a lot
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/hypergeometric-vs-fisher-test-tp2324223p2324223.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org 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] hypergeometric vs fisher.test

2010-08-13 Thread Andrea Franceschini

I ask the question also because I found this line in Wikipedia:
"The test (see above) based on the hypergeometric distribution
(hypergeometric test) is identical to the corresponding one-tailed
version of Fisher's exact test".

Is this wrong ?  May I kindly ask a friendly explanation for
not-experts in statistics ?

Thx a lot,

-- 
View this message in context: 
http://r.789695.n4.nabble.com/hypergeometric-vs-fisher-test-tp2324223p2324429.html
Sent from the R help mailing list archive at Nabble.com.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] hypergeometric vs fisher.test

2010-08-13 Thread Peter Dalgaard
Andrea Franceschini wrote:
> I ask the question also because I found this line in Wikipedia:
> "The test (see above) based on the hypergeometric distribution
> (hypergeometric test) is identical to the corresponding one-tailed
> version of Fisher's exact test".
> 
> Is this wrong ?  May I kindly ask a friendly explanation for
> not-experts in statistics ?
> 
> Thx a lot,
> 

You never said you were a non-expert. A question like that might very
well have come from a student, or an incompetent claiming to have found
a bug in fisher.test...

The point was that Fisher's test takes the 2x2 table

a b
c d

and interprets the situation under the null hypothesis as taking a
sample of size a+c from an urn with a+b white balls and c+d black balls.

Once you read the docs for phyper properly (it _is_ tricky to get it
right), you arrive at

> phyper(16,17+181,449+19551,17+449, lower.tail=FALSE)
[1] 3.693347e-06


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org 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] hypergeometric vs fisher.test

2010-08-13 Thread TGS
"or an incompetent"

Such harsh words Peter. You're not making this a friendly environment for 
people to ask questions. Is there a less competent attribute mailing list so 
that some of us don't offend you with our questions?

On Aug 13, 2010, at 2:11 PM, Peter Dalgaard wrote:

Andrea Franceschini wrote:
> I ask the question also because I found this line in Wikipedia:
> "The test (see above) based on the hypergeometric distribution
> (hypergeometric test) is identical to the corresponding one-tailed
> version of Fisher's exact test".
> 
> Is this wrong ?  May I kindly ask a friendly explanation for
> not-experts in statistics ?
> 
> Thx a lot,
> 

You never said you were a non-expert. A question like that might very
well have come from a student, or an incompetent claiming to have found
a bug in fisher.test...

The point was that Fisher's test takes the 2x2 table

a b
c d

and interprets the situation under the null hypothesis as taking a
sample of size a+c from an urn with a+b white balls and c+d black balls.

Once you read the docs for phyper properly (it _is_ tricky to get it
right), you arrive at

> phyper(16,17+181,449+19551,17+449, lower.tail=FALSE)
[1] 3.693347e-06


-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org 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@r-project.org 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] hypergeometric series in R

2010-06-08 Thread Arnau Mir

Hello.

Somebody knows how to compute generalized hypergeometric series in R?
(see 
http://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/02/ 
to understand what I mean)


Thanks in advance,

Arnau.

__
R-help@r-project.org 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] hypergeometric function in ‘ mvtnorm’

2012-03-18 Thread statfan
Is there any way to know how the "dmvt" function computes the hypergeometric
function needed in the calculation for the density of multivariate t
distribution?  

--
View this message in context: 
http://r.789695.n4.nabble.com/hypergeometric-function-in-mvtnorm-tp4483730p4483730.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] hypergeometric series in R

2010-06-08 Thread Ben Bolker
Arnau Mir  uib.es> writes:

> 
> Hello.
> 
> Somebody knows how to compute generalized hypergeometric series in R?
> (see 
> http://functions.wolfram.com/HypergeometricFunctions/HypergeometricPFQ/02/ 
> to understand what I mean)

library(sos)
findFn("generalized hypergeometric function")

 -> see the hypergeo package, and the Hyperg function in the gsl package.
 You'll have to work out for yourself whether the particular version and
parameterization match what you need.

__
R-help@r-project.org 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] hypergeometric function in ‘ mvtnorm’

2012-03-19 Thread R. Michael Weylandt
To view the source of (most) functions, simply type funcname without
parentheses: here, you get

> dmvt

function (x, delta, sigma, df = 1, log = TRUE, type = "shifted")
{
if (df == 0)
return(dmvnorm(x, mean = delta, sigma = sigma, log = log))
if (is.vector(x)) {
x <- matrix(x, ncol = length(x))
}
if (missing(delta)) {
delta <- rep(0, length = ncol(x))
}
if (missing(sigma)) {
sigma <- diag(ncol(x))
}
if (NCOL(x) != NCOL(sigma)) {
stop("x and sigma have non-conforming size")
}
if (!isSymmetric(sigma, tol = sqrt(.Machine$double.eps),
check.attributes = FALSE)) {
stop("sigma must be a symmetric matrix")
}
if (length(delta) != NROW(sigma)) {
stop("mean and sigma have non-conforming size")
}
m <- NCOL(sigma)
distval <- mahalanobis(x, center = delta, cov = sigma)
logdet <- sum(log(eigen(sigma, symmetric = TRUE, only.values =
TRUE)$values))
logretval <- lgamma((m + df)/2) - (lgamma(df/2) + 0.5 * (logdet +
m * logb(pi * df))) - 0.5 * (df + m) * logb(1 + distval/df)
if (log)
return(logretval)
return(exp(logretval))
}


Most of the functions in here you can see code for the same way: the
only ones you won't be able to are eigen, lgamma, log, exp, but these
methods are pretty well-documented and you shouldn't need to find code
for them. If you do, you'll need to read the underlying C.

Michael

On Sun, Mar 18, 2012 at 11:12 PM, statfan  wrote:
> Is there any way to know how the "dmvt" function computes the hypergeometric
> function needed in the calculation for the density of multivariate t
> distribution?
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/hypergeometric-function-in-mvtnorm-tp4483730p4483730.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org 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@r-project.org 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] hypergeometric function in ‘ mvtnorm’

2012-03-19 Thread statfan
Thanks for your advice.  I actually meant to ask about the "pmvt" for the
distribution function.  Viewing the source code "pmvt" uses the function
"mvt" which uses the function "probval" which sources the fortran code:

Fortran("mvtdst", N = as.integer(n), NU = as.integer(df), 
LOWER = as.double(lower), UPPER = as.double(upper), INFIN =
as.integer(infin), 
CORREL = as.double(corrF), DELTA = as.double(delta), 
MAXPTS = as.integer(x$maxpts), ABSEPS = as.double(x$abseps), 
RELEPS = as.double(x$releps), error = as.double(error), 
value = as.double(value), inform = as.integer(inform), 
PACKAGE = "mvtnorm")

I wish to look at how this "mvtdst" calculates the hypergeometric function
(2_F_1).  Anyway that I can see that?
Thanks 

--
View this message in context: 
http://r.789695.n4.nabble.com/hypergeometric-function-in-mvtnorm-tp4483730p4485277.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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] hypergeometric function in ‘ mvtnorm’

2012-03-19 Thread Berend Hasselman

On 19-03-2012, at 16:54, statfan wrote:

> Thanks for your advice.  I actually meant to ask about the "pmvt" for the
> distribution function.  Viewing the source code "pmvt" uses the function
> "mvt" which uses the function "probval" which sources the fortran code:
> 

No  it doesn't "source". It call a compiled Fortran subroutine.

> Fortran("mvtdst", N = as.integer(n), NU = as.integer(df), 
>LOWER = as.double(lower), UPPER = as.double(upper), INFIN =
> as.integer(infin), 
>CORREL = as.double(corrF), DELTA = as.double(delta), 
>MAXPTS = as.integer(x$maxpts), ABSEPS = as.double(x$abseps), 
>RELEPS = as.double(x$releps), error = as.double(error), 
>value = as.double(value), inform = as.integer(inform), 
>PACKAGE = "mvtnorm")
> 
> I wish to look at how this "mvtdst" calculates the hypergeometric function
> (2_F_1).  Anyway that I can see that?

Yes. Download the source code of the package.
Obtainable from CRAN.
Unpack and browse.

Berend

__
R-help@r-project.org 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] Hypergeometric Function seems to give wrong results

2015-07-06 Thread Carlos Nasher via R-help
Hello R helpers,

I need to evaluate the Hypergeometric Function of the 2nd kind (Tricomi
confluent hypergeometric function). Therefore I'm using the kummerU
function from the fAsianOptions package. It seems to me that kummerU is
giving wrong results. Here's an example:

library("fAsianOptions")
kummerU(a=19, b=19, x = 10)

R gives 1838.298 for the real part.

If I use Mathematica via the wolfram site (
http://functions.wolfram.com/webMathematica/FunctionEvaluation.jsp?name=HypergeometricU)
the result is 3.52603e-20 which is more reasonable in the context of my
analysis.

Can anyone help how to compute the correct values within R?

Best regards,
Carlos

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Hypergeometric Function seems to give wrong results

2015-07-08 Thread Ben Bolker
Carlos Nasher via R-help  r-project.org> writes:

>

[snip]

> I need to evaluate the Hypergeometric Function of the 2nd kind (Tricomi
> confluent hypergeometric function). Therefore I'm using the kummerU
> function from the fAsianOptions package. It seems to me that kummerU is
> giving wrong results. Here's an example:
> 
> library("fAsianOptions")
> kummerU(a=19, b=19, x = 10)
> 
> R gives 1838.298 for the real part.
> 
> If I use Mathematica via the wolfram site (
> http://functions.wolfram.com/webMathematica
   /FunctionEvaluation.jsp?name=HypergeometricU)
> the result is 3.52603e-20 which is more reasonable in the context of my
> analysis.
> 

 [snip]

  Your best bet is probably to contact the package maintainer
(use maintainer("fAsianOptions") to see who it is, or look on 
the CRAN page for the package).  If this functionality is very
commonly used in finance you might try the r-sig-finance mailing
list (indicating that you've already tried here).

  good luck
Ben Bolker

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.