search for: pgamma

Displaying 20 results from an estimated 126 matches for "pgamma".

Did you mean: gamma
2002 May 24
0
problem with R-mathlib standalone
Hi, I'm trying to use pgamma() within my C application but I'm getting strange results. I have a Debian system with r-mathlib 1.4.1-1 and gcc 2:2.95.4-9. Here are 3 example pgamma() calls executed by R: $ R -q --vanilla < gamma.R > pgamma(98, 100, 1) [1] 0.4333105 > pgamma(21, 100, 5) [1] 0.7002453 > pgamm...
2006 Sep 01
1
integration problem with gamma function
...int["p(s?v|D_1D_2I) = const. ",N[PSVbar,6]]; </---> <--- translation to R ---> integpsvbar <- function(A) { # Mathematica: gamma[a,z0,z1] = gamma[a,z1] - gamma[a,z0] UiA <- Ni*(Dsi-2*Di*A+A^2)/2 UiiA <- Nii*(Dsii-2*Dii*A+A^2)/2 1/UiA^(Ni/2) * 1/UiiA^(Nii/2) * ( pgamma(UiA/(sL^2), Ni/2) - pgamma(UiA/(sH^2), Ni/2) ) * ( pgamma(UiiA/(sL^2), Nii/2) - pgamma(UiiA/(sH^2), Nii/2) ) } psvbar <- integrate(integpsvbar, lower=L, upper=H) psvbar$value PSVbar <- psvbar$value / (4*log(sH/sL)) PSVbar <- PSVbar * sqrt(pi) * sqrt(pi) #note: two times pgamma in i...
2006 Jan 27
0
pgamma - inadequate algorithm design and poor coding (PR#8528)
R versions 2.1.0 to present. Examples shown were computed under Windows R-devel, current SVN, but ix86 Linux shows similar behaviour (sometimes NaN or -Inf rather than Inf, depending on the compiler and optimization level used). The replacement pgamma algorithm used from R 2.1.0 has an inadequate design and no supporting documentation whatsoever. There is no reference given to support the algorithm, and it seems very desirable to use only algorithms with a published (and preferably refereed) analysis, or at least of impeccable provenance....
2008 Aug 07
1
qgamma inaccuracy (PR#12324)
...ious probability distributions in R, and it seems the gamma distribution is inaccurate for some inputs. For example, qgamma(1e-100, 5e-101, lower.tail=FALSE) gives: 1.0. However, it seems this is incorrect; I think the correct answer should be 0.082372029620717283. When I check these numbers using pgamma, I get: pgamma(1,5e-101, lower.tail=FALSE) = 9.1969860292859463e-102 and pgamma(0.082372029620717283,5e-101, lower.tail=FALSE) = 1.0000000000000166e-100. Similarly, for example: qgamma(1e-100,0.005,lower.tail=FALSE) = 109.36757177007101 pgamma(109.36757177007101, 0.005, lower.tail=FALSE) = 1.4787...
2003 Jan 30
1
vector passed to `if' in `pgamma'
In the current R-devel sources, the `pgamma' function gives a warning when the `shape' argument is passed as a vector of length > 1. That is, > pgamma(3, 1) [1] 0.950213 > pgamma(3, c(1, 2)) [1] 0.9502129 0.8008517 Warning message: the condition has length > 1 and only the first element will be used in: if (shape <=...
2004 Oct 22
3
pgamma discontinuity (PR#7307)
...andalone/test.c to read: --------------------------------------------------------------------------------- #define MATHLIB_STANDALONE 1 #include <Rmath.h> #include <stdio.h> int main() { double x; for (x = 99990; x <= 100009; x++) printf ("%.14g --> %.14g\n", x, pgamma (1000000.0, x, 1.0, 0, 1)); return 0; } --------------------------------------------------------------------------------- and have no further local changes. I get... src/nmath/standalone> LD_LIBRARY_PATH=. ./test 99990 --> -669773.38974057 99991 --> -669771.08705436 99992 --> -669...
2009 May 07
1
data transformation using gamma
...> dim(bhall) [1]  1 12 > trans_dt <- function(dt,a,b) + { n1 <- ncol(dt) +   n2 <- length(dt) +   trans  <- vector(mode='numeric', length=n2) +   dim(trans) <- dim(dt) +   for (i in 1:n1) +   {  dt[,i] <- as.vector(dt[,i]) +      trans[,i] <- transform(dti,newdt=pgamma(dti,shape= a[1,i],scale=b[1,i])) } +   trans + } > trans_dt(dp1,ahall,bhall) Error in transform(dti, newdt = pgamma(dti, shape = a[1, i], scale = b[1,  :   object "dti" not found and also try trans_dt <- function(dt,a,b) { n1 <- ncol(dt)   n2 <- length(dt)   trans  <- v...
2006 Mar 28
2
R 2.3.0 (alpha) on FreeBSD 6.1 fails make check-all
...[2]: Leaving directory `/usr/local/beta/R-alpha/tests' gmake[1]: *** [test-all-basics] Error 1 gmake[1]: Leaving directory `/usr/local/beta/R-alpha/tests' gmake: *** [check-all] Error 2 I have checked d-p-q-r-tests.Rout.fail for any obvious problems - I found some warnings, viz. > pgamma(1,Inf,scale=Inf) == 0 [1] TRUE > ## Also pgamma(Inf,Inf) == 1 for which NaN was slightly more appropriate > all(is.nan(c(pgamma(Inf, 1,scale=Inf), + pgamma(Inf,Inf,scale=Inf)))) [1] TRUE Warning messages: 1: NaNs produced in: pgamma(q, shape, scale, lower.tail, log.p) 2: NaNs p...
2004 Mar 19
3
Incomplete Gamma Functions and GammaDistribution Doc errata.
...n such as that presented in Mathworld: http://mathworld.wolfram.com/GammaDistribution.html (see just below equation (2) ) "define $\theta \equiv 1 / \lambda$ to be the time between changes" which makes \theta in equation (3) a rate parameter. In the R documentation (i.e. ?pgamma) this same equation is presented but the parameter \theta is now called s and is termed the scale. This goes against general usage of mathworld, wikipaedia, the COLT library, and others who call the "s" term a "rate". Please either change the equation or replace the name with...
2008 Aug 05
0
qgamma inaccuracy
...ious probability distributions in R, and it seems the gamma distribution is inaccurate for some inputs. For example, qgamma(1e-100, 5e-101, lower.tail=FALSE) gives: 1.0. However, it seems this is incorrect; I think the correct answer should be 0.082372029620717283. When I check these numbers using pgamma, I get: pgamma(1,5e-101, lower.tail=FALSE) = 9.1969860292859463e-102 and pgamma(0.082372029620717283,5e-101, lower.tail=FALSE) = 1.0000000000000166e-100. Similarly, for example: qgamma(1e-100,0.005,lower.tail=FALSE) = 109.36757177007101 pgamma(109.36757177007101, 0.005, lower.tail=FALSE) = 1.4787...
2009 Jan 19
2
pchisq error
Dear R experts, I'm trying to call 'pchisq' from within a C subroutine. The following error is returned: ** NON-convergence in pgamma()'s pd_lower_cf() f= nan. This error message is not printed the first time I call 'pchisq' from the C subroutine, but the second time or the next time I call 'pchisq' from within R. My session output is shown below: ###################### > system('R CMD SHLIB reprodu...
2008 Jul 26
4
parametric bootstrap
Hi I am trying to find a parametric bootstrap confidence interval and when I used the boot function I get zero bias and zero st.error? What could be my mistake? Thank you and take care. Laila [[alternative HTML version deleted]]
2005 Oct 02
1
rate instead of scale in ?ks.test
...s I'm not sure, I haven't found this in the bug tracker, and the R FAQ says that stats is an Add-on package of R, I think this is the place to send it. ?ks.test provides the example <QUOTE> # Does x come from a shifted gamma distribution with shape 3 and scale 2? ks.test(x+2, "pgamma", 3, 2) # two-sided </QUOTE> Maybe it should say ``with shape 3 and rate 2''? If I do > x <- rgamma(1e6, shape = 3, scale = 2) > ks.test( x, 'pgamma', 3, 2 ) One-sample Kolmogorov-Smirnov test data: x D = 0.7513, p-value < 2.2e-16 alternative hypothes...
2005 Aug 31
1
Distributional characteristics
...riable and I want to test (graphically, plotting observed and theoretical distr, qqplot) whether it follows some formal distribution. (some thing close to Ricci document : Fitting distributions with R, Feb05). The distribution I want to fit is a truncated Gamma at 1 (the minimal value is 1), P(x)=Pgamma(rate,x)/(1-Pgamma(rate,x<1)) NB : changing the variable (x-1,ln(x)) didn't get satisfying results Best Naji
2007 Aug 14
1
Can I calculcate the percentage of a gamma function area below a cutoff value?
Hi there, I have some bird flight height data that follows a gamma distribution. The data (x) goes from 0 to 700 meters (n=1055). The calculated parameters calculated from the fitdistr(x) are (shape = 5.1379, rate = 0.017541), and therefore the scale (1/rate) = 57.00929. I would like to calculate the percentage of the function area that occurs below 50 meters (0-50m). Is that
2007 Oct 07
1
a function to compute the cumulative distribution function (cdf) of the gamma
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?... Nom : non disponible Url : https://stat.ethz.ch/pipermail/r-help/attachments/20071006/065906cc/attachment.pl
2005 Nov 09
2
help with legacy R code
...0)) xmin = 0 newx = good$x xmean = mean(newx) xmax = max(newx)+0.15 goodhist <- hist(newx, br=seq(from=0,to=xmax,by=0.15), probability=T, col="lightyellow") initmean <- (min(newx)+max(newx))/2 totalx <- length(newx) wrongmeanshift <- wrongmean + 0.2 wrongper <- pgamma(wrongmeanshift, wrongshape, wrongrate) nfalseundermean <- which(abs(newx-wrongmeanshift)==min(abs(newx-wrongmeanshift))) initnfalse <- nfalseundermean / wrongper fitmean <- -1 fitsd <- 0 fitnfalse <- initnfalse fitshape <- wrongshape fitrate <- wrongrate curve((fitnfa...
2004 Jan 15
1
Exactness of ppois
Hello, by checking the precision of a convolution algorithm, we found the following "inexactness": We work with R Version 1.8.1 (2003-11-21) on Windows systems (NT, 2000, XP). Try the code: ## Kolmogorov distance between two methods to ## determine P(Poisson(lambda)<=x) Kolm.dist <- function(lam, eps){ x <- seq(0,qpois(1-eps, lambda=lam), by=1) max(abs(ppois(x,
2001 Sep 06
1
RFC: d/p/q/rgamma
dgamma and friends in S are documented as dgamma(x, shape, rate=1) pgamma(q, shape, rate=1) qgamma(p, shape, rate=1) rgamma(n, shape, rate=1) whereas R has dgamma(x, shape, scale=1, log = FALSE) pgamma(q, shape, scale=1, lower.tail = TRUE, log.p = FALSE) qgamma(p, shape, scale=1, lower.tail = TRUE, log.p = FALSE) rgamma(n, shape, scale=1) Note the use of rate vs scal...
2020 Oct 09
1
Aide pour finaliser ce code
...to[j,]=w[j,]-Xbar } TO.jh[[i]]=to } #calcul des Lamda J Lamda=matrix(0,p,p) for (i in 1:q){ to=TO.jh[[i]] w=matrix(0,p,p) for (j in 1:R[i]){ w=w+(P11[[i]][j]*(to[j,]%*%t(to[j,]))) } Lamda=Lamda+w } tr1=n*sum(diag(Lamda)) # Calcul de Gamma GGamma=matrix(0,p*sum(R),p*sum(R)) PGamma=kronecker(diag(P11[[1]]),diag(p)) Ifin=p*R[1] GGamma[1:Ifin,1:Ifin]=PGamma for (i in 2:q){ PGamma=kronecker(diag(P11[[i]]),diag(p)) Idebut=((p*sum(R[1:(i-1)]))+1) Ifin=(p*sum(R[1:i])) GGamma[Idebut:Ifin,Idebut:Ifin]=PGamma } #Calcul de Sigma # Calcul de Vn X1=CentrageV(X,Xbar,n) Vn=...