Displaying 20 results from an estimated 4000 matches similar to: "dgamma density values in extreme point"
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:
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 windows XP.
Thanks a lot.
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
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).
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
1998 Feb 23
1
R-beta: Help: cov.mve in R? dgamma in Splus?
Hi all
I have a couple of obscure questions for R/Splus experts (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
2005 Nov 04
1
dgamma error condition?
There's an apparent inconsistency between the
behavior of d(pqr)gamma and other distribution
functions for "bad" parameter values. Specifically,
most distributions give NaN and a warning for bad
parameters (e.g. probabilities <0 or >1). In contrast,
d(pqr)gamma actually gives an error and stops when shape<0.
I don't see why it has to be this way -- the internal
C code
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 parametrizations)
* and `a' is the shape parameter ( = alpha in
2013 Apr 09
5
Error when using fitdist function in R
Hello everyone,
I was trying to do some distribution fitting with a numerical field called
Tolls. The sample 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):
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 scale. Indeed, as both S and
2002 Oct 16
1
how to overlay the histogram with fitted gamma density plot (emergent!!)
For a real data column X value ranged between (56.4521,32317.9) with missing values, I need to overlay 2 plots: histogram & fitted gamma density.
I use following to generate histogram.
xbk_seq(50,33000,by=100)
hist(x,breaks=xbk)
But I don't know how to get "fitted gamma density"?
In SAS proc capability, I got Shape=2.59, Scale=3481).
But when I do
plot(dgamma(x,
2005 Aug 27
1
bug in L-BFGS-B? (PR#8099)
--WWm7B+u2U4
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit
G'day all,
I believe that this is related to PR#1717 (filed under
not-reproducible) which was reported for a version of R that is a
quite a bit older than the ones used in for this report. But I
noticed this behaviour under R 2.1.1 and R 2.2.0 on my linux box and
2008 Aug 04
2
Howto Smooth a Curve Created with the Point Function
Hi all,
I have this figure:
http://docs.google.com/Doc?id=df5zfsj4_103rjt2v4d5
created with the following steps:
> x
[1] 90.4 57.8 77.0 103.7 55.4 217.5 68.1 85.3 152.0 113.0 97.1 89.9
[13] 68.1 83.7 77.4 34.5 104.9 170.3 88.6 88.1 108.8 77.4 85.6 82.7
[25] 81.3 108.0 49.5 71.0 85.7 99.3 203.5 275.9 51.1 84.8 16.5 72.6
[37] 160.5 158.3 136.7 140.0 98.4 116.1
2008 Apr 14
2
looping problem
Hi R-users,
I would like to do looping for this process below to estimate alpha beta from gamma distribution:
Here are my data:
day_data1 <-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
1943 48.3 18.5 0.0 0.0 18.3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.8 2.8
1944 0.0 0.0
2008 May 21
2
Converting Data Types
Hi,
How can I convert the matrices to list.
For example I have this snippet:
samples<-mymatrix[1,]
print(samples)
which prints:
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"
2006 Sep 17
2
Building the call of an arbitrary function
Hy all,
Is there a direct way to build the complete function call 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,
2000 Feb 10
3
creating a grid of function values
I want 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
2003 Sep 30
3
fitdistr, mle's and gamma distribution
Dear R Users,
I am trying to obtain a best-fit analytic distribution for a dataset
with 11535459 entries. The data range 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:
2005 Nov 09
2
About: Error in FUN(X[[1]], ...) : symbol print-name too long
Hi,
I??m trying to use the Win2BUGS package from R and I have a similar problem
that reurns with the message:
Error in FUN(X[[1]], ...) : symbol print-name too long
But, there is no stray ` character in the file ( Sugestions given by: Duncan
Temple Lang <duncan>
Date: Mon, 26 Sep 2005 07:31:08 -0700 )
The progam in R is:
library(R2WinBUGS)
library(rbugs)
dat <-
2009 Jan 24
2
Different values for double integral
Dear R useRs,
i have the function f1(x, y, z) which i want to integrate for x and y.
On the one hand i do this by first integrating for x and then for y, on
the other hand i do this the other way round and i wondering why i
doesn't get the same result each way?
z <- c(80, 20, 40, 30)
"f1" <- function(x, y, z) {dgamma(cumsum(z)[-length(z)], shape=x, rate=y)}