search for: dgamma

Displaying 20 results from an estimated 160 matches for "dgamma".

Did you mean: gamma
2013 Apr 09
5
Error when using fitdist function in R
...le size = 999 rows. Basically I assigned the Toll data to a new variable K by doing: k<-dtest$Toll After that, tried to fit a gamma distribution by doing: fitG<-fitdist(k, "gamma") Then the following messages showed (oh and I checked for empty rows before doing this): Warning in dgamma(c(363328L, 376216L, 367032L, 314826L, 311892L, 313340L, : NaNs produced Warning in dgamma(c(363328L, 376216L, 367032L, 314826L, 311892L, 313340L, : NaNs produced Warning in dgamma(c(363328L, 376216L, 367032L, 314826L, 311892L, 313340L, : NaNs produced Warning in dgamma(c(363328L, 376216L,...
2009 Sep 25
1
Problem with dgamma function.
Hi, All, I am getting some funny results trying to use R's built in distribution functions. In R: > dgamma(4.775972,1.37697964405418, 0.106516604930466) [1] 0.05585295 > dgamma(4.775972,1.37697964405418, 0.106516604930466,TRUE) ### THIS IS JUST WRONG! [1] 0.01710129 > log(dgamma(4.775972,1.37697964405418, 0.106516604930466)) [1] -2.885033 > In C: dgamma(4.775972,1.37697964405418, 0.1065166049...
2007 Apr 23
2
Problem with dgamma ?
Hi All, Here 's what I got using dgamma function : > nu<-.2 > nu*log(nu)-log(gamma(nu))+(nu-1)*log(1)-nu*(1) [1] -2.045951 > dgamma(1,nu,nu,1) [1] 0.0801333 > dgamma(1,nu,nu,0) [1] NaN Warning message: NaNs produced in: dgamma(x, shape, scale, log) Could anyone tell me what is wrong here ? I am using R-2.4.1 on windo...
2011 Sep 10
1
dgamma in jags within r
I define priors in jags within r using a gamma distribution. I would like to control the shape but I have problems. Any help will be usefull. From help of dgamma ___________________ The Gamma distribution with parameters shape = a and scale = s has density f(x)= 1/(s^a Gamma(a)) x^(a-1) e^-(x/s) and rate=1/scale From jags user manual ____________________ dgamma(r, mu) has a density of ?^r*x^(r?1)*exp(??x) -------------------- Gamma(r) So I conclude that...
2016 Nov 13
1
dgamma density values in extreme point
Dear R-Devel group, My name is Alexey, a data scientist from Moscow, currently working for Align Technology Inc. We have recently had a discussion of the results that the dgamma function (stats) returns for an extreme point (x == 0). <dgamma(0,1,1,log = FALSE) [1] 1 and <dgamma(0,0.5,1,log = FALSE) [1] Inf Density appears to be defined in point zero for the distribution with the said parameters. It looks like the returned value is a limit of f(x) where x --...
2008 Jun 25
1
dgamma in WinBUGS and JAGS (rjags)
Hello, In WinBUGS 1.4 manual (http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/manual14.pdf), the gamma density is presented as dgamma(r,mu) where r and mu are the shape and rate parameters, respectively. In JAGS (rjags) manual version 1.0.2, May 9, 2008 (http://www-fis.iarc.fr/~martyn/software/jags/jags_user_manual.pdf), on page 26 the gamma density is presented as dgamma(mu,r) instead of dgamma(r,mu). Since JAGS uses the BUGS la...
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, lo...
2000 Feb 10
3
creating a grid of function values
...to create a grid of function values for use in `contour' or `persp'. The function is the log-likelihood for the gamma. The sample is stored as vector of length 20 called `Survival'. A single evaluation of the log-likelihood at, say, scale = 9 and shape = 10 would be obtained by sum(dgamma(Survival, scale = 9, shape = 10, log = TRUE)) (This may work only 0.99.0, I'm not sure.) I would like to evaluate such a function on a grid of scale and shape values. I don't think I can use `outer' because of the way the evaluation of the dgamma function would vectorize. Although I...
2008 May 21
2
Converting Data Types
...V1 V2 V3 V4 V5 V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object "samples" such that it prints: [1] 103.9 88.5 242.9 206.6 175.7 164.4 The reason I ask this because I can't use the former "samples" object with this function: llgm <- dgamma(samples, scale=1, shape=2, log = TRUE) which gives this error: e 1374Error in dgamma(x, shape, scale, log) : Non-numeric argument to mathematical function Regards, Edward
2005 Aug 27
1
bug in L-BFGS-B? (PR#8099)
...brary and on my linux machine I get the following results: > library(MASS) > set.seed(123) > x <- rgamma(100, shape = 5, rate = 0.1) > fitdistr(x, "gamma") shape rate 6.45947303 0.13593172 (0.89052006) (0.01948648) > fitdistr(x, dgamma, list(shape = 1, rate = 0.1), lower = 0.01) shape rate 2.156761461 0.010000000 (0.277607887) (0.001433778) I find the second result quite extraordinary. O.k., the likelihood that is maximised is quite flat along a certain direction, but I don't think that it is so flat...
2006 Sep 17
2
Building the call of an arbitrary function
...of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a probability density function for some law given in argument to the first function: > f("gamma", 1000) will return, say, function(x, shape, rate, scale = 1/rate) dgamma(x + 1000, shape, rate, scale = 1/rate) (Notice that the arguments of the output function are those of dgamma().) I tried all sorts of combinations of call(), formals(), args() et al. to no avail. But then, I avoided, so far, to build the whole thing as a character string. Would it be the only o...
2003 Sep 30
3
fitdistr, mle's and gamma distribution
...ge in value from 1 to 300000000. I use: fitdistr(data, "gamma") to obtain mle's for the parameters. I get the following error: Error in optim(start, mylogfn, x = x, hessian = TRUE, ...) : non-finite finite-difference value [1] And the following warnings: NaNs produced in: dgamma(x, shape, scale, log) I have the same problem with the exponential distribution, but the lognormal and weibull distributions don't have this problem. I suspect the problem has to do with: "It means that in computing derivatives by finite differencing, one of the values is NA, +Inf or...
2013 Jul 12
2
How to determine the pdf of a gamma distribution using the estimated parameters?
Hello everyone, With th bar histogram (number of occurrences) hist<-c(24,7,4,1,2,1,1) of seven equally spaces classes ]1-4], ]5-8], ]9-12], ]13-16], ]17-20], ]21-24], ]25-28], I obtained shape=0.8276 and rate=0.1448. I would like to know how to build the continuous pdf of a this gamma distribution knowing these two estimated parameters such that I will be able to predict the pdf of any
2008 Apr 14
2
looping problem
...1[,1] x2 <- day_data1[,2] x3 <- day_data1[,3] x4 <- day_data1[,4] x5 <- day_data1[,5] tol <- 1E-6 a1 <- x1[x1>tol] a2 <- x2[x2>tol] a3 <- x3[x3>tol] a4 <- x4[x4>tol] a5 <- x5[x5>tol] library(MASS) ## Example January Charleville 1943-2007 fitdistr(a1,dgamma, list(shape = 1, rate = 0.1), lower = 0.01) fitdistr(a2,dgamma, list(shape = 1, rate = 0.1), lower = 0.01) fitdistr(a3,dgamma, list(shape = 1, rate = 0.1), lower = 0.01) fitdistr(a4,dgamma, list(shape = 1, rate = 0.1), lower = 0.01) fitdistr(a5,dgamma, list(shape = 1, rate = 0.1), lower = 0.01) He...
2002 Jan 11
2
new dgamma rate argument
Can someone explain to me in what way the new (dpqr)gamma parameter can be interpreted as a rate (when shape != 1)? The only gamma rate that I am aware of is the hazard rate given by dgamma/(1-pgamma), the log of which is returned by my hgamma function (event library). Jim -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]sub...
1998 Feb 23
1
R-beta: Help: cov.mve in R? dgamma in Splus?
...(which unfortunately isn't me!) I am trying to compute Bayes Factors using some Splus code of Raftery in Gilks et al (1996). Only problem is 1) R doesn't seem to have a robust covariance (cov.mve) which I suspect I need rather than a non-robust classical estimate 2) Splus has cov.mve BUT dgamma in Splus doesn't have a scale parameter (like in R). I presume it is easy to include one but it is not immediately obvious to me. I would prefer to use R and could probably modify minvol.f to compute cov.mve from R but don't want to reinvent the wheel. Any suggestions greatly appreciated!...
2005 Jun 25
1
comment in src/nmath/dgamma.c
Hi, In src/nmath/dgamma.c the comment at the top says * DESCRIPTION * * Computes the density of the gamma distribution, * * 1/s (x/s)^{a-1} exp(-x/s) * p(x;a,s) = ----------------------- * (a-1)! * * where `s' is the scale (= 1/lambda in other...
2005 Nov 04
1
dgamma error condition?
...t;0 (or scale<0) and return NaN and a warning, and none of the other distribution functions in that bit of the code have similar behavior. It would seem more consistent (and would be more convenient for me -- the error-instead-of-warning is making me have to jump through additional hoops) if dgamma just returned NaN and a warning. Any thoughts? cheers Ben Bolker
2005 Nov 09
2
About: Error in FUN(X[[1]], ...) : symbol print-name too long
...that results in Beherens-Fisher posterior and in the model.file of WinBUGS "d2.bug" there is the following codes: model { for( i in 1 : 30 ) { x[i] ~ dnorm(mu1,sig1) } for( i in 1 : 30 ) { y[i] ~ dnorm(mu2,sig2) } mu1 ~ dnorm(50,1.0E-6) sig1 ~ dgamma(0.001,0.001) mu2 ~ dnorm(50,1.0E-6) sig2 ~ dgamma(0.001,0.001) lbda <- mu1 - mu2 } I??m a new user of WinBUGS and if someone detect error in the model codes too, I??m grateful. Thanks for help! Gilberto Matos. -------------- next part -------------- An embedded and charse...
2013 Mar 28
3
problem with plots with short example.
..., y = therms$difftherm, numstate = therms$numstate )) ################################################### ### code chunk number 3: exchange ################################################### exchange.mod <- "model{ for(i in 1:N){ y[i] ~ dnorm(mu, tau) } mu ~ dnorm(0,.001) tau ~ dgamma(.1,.1) }" exchange.out <- run.jags(exchange.mod, data=dat, burnin=10000, sample=50000, thin=5, monitor=c("mu", "tau"), monitor.deviance=T, monitor.pd=T, silent.jags=T) ################################################### ### code chunk number 4: exchange ######...