Displaying 20 results from an estimated 4000 matches similar to: "rgamma with negative shape and scale parameters works?"
2012 Jan 27
2
The following code (using rgamma) hangs
Hi,
I'm seeing something that may be a bug in R's standalone math library,
which is packaged by Debian as r-mathlib. I reported it to the Debian BTS
as http://bugs.debian.org/657573
I'm using Debian squeeze, and the code was tested with r-mathlib 2.11.1-6
(default on stable) and 2.14.1-1 (from testing/unstable).
I summarize this report below. The following code with the R math
2001 Oct 21
3
generating a gamma random variable
Dear R People,
This question has nothing to do with R directly, but it is a simulation
question. I need to generate a random variable distributed as
gamma(\alpha,\beta), with the additional proviso that it must be a
function of random variable(s) which do not depend on \alpha, \beta. In
this case, I have \alpha = (T-1)/2, where T is a positive integer.
So, it seems reasonable to first simulate
2013 Dec 18
1
rgamma
Estimado Jorge
Perdóneme que lo moleste de nuevo, hay otra condición además de que
sum(y)=1 y es que
y[1] tiene que dar 0
en el ejemplo
y<- c (0.0000000000, 0.6321985783, 0.2325728597, 0.0855587737, 0.0314753138,
0.0115791209, 0.0042597205, 0.0015670636, 0.0005764905,
0.0002120790)
y[1]=0
sum(y)=1
esto se utiliza en el paquete EpiEstim donde se
2012 Jul 14
2
rgamma function
Hi,
Has anyone encountered the problem of rgamma function in C? The
following simplified program always dies for me, and I wonder if anyone
can tell me the reason.
#include <Rmath.h>
#include <time.h>
#include <Rinternals.h>
SEXP generateGamma ()
{
srand(time(NULL));
return (rgamma(5000,1));
}
Has anyone encountered a similar problem before? Is there another way
2008 Nov 15
1
rgamma with rate as vector
Hi - I have a question about the following code from Bayesian
Computation with R (Jim Albert).
par(mfrow=c(2,2))
m = 500
alphas = c(5, 20, 80, 400)
for (j in 1:4) {
mu = rgamma(m, shape=10, rate=10)
lambda1 = rgamma(m, shape=alphas[j], rate=alphas[j]/mu)
lambda2 = rgamma(m, shape=alphas[j], rate=alphas[j]/mu)
plot(lambda1, lambda2)
title(main=paste('alpha=',
2004 Feb 05
5
rgamma question
I was trying to generate random numbers with a gamma distribution. In R the
function is:
rgamma(n, shape, rate = 1, scale = 1/rate). My question is that if
X~gamma(alpha, beta) and I want to generate one random number where do I
plug alpha and beta in rgamma? and, what is the meaning and use of rate?
Thanks for your attention,
Jorge
[[alternative HTML version deleted]]
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
2007 Nov 18
1
many zeroes in rgamma ... what's going on?
Hello fellow R users,
I wanted to view the density on the standard deviation scale of a gamma(0.001, 0.001) prior for the precision. I did this as seen in the code below and found that for some reason rgamma is giving many values equal to zero, which is strange since a gamma distribution is continuous. What is going on here?
Thanks for any help in advance.
Greg
> x1 <- rgamma(10000,
2010 Jul 20
1
Call to rgamma using .C causes R to hang
Hi,
I've been trying to get this working for ages, but it causes R to hang.
Here is my C code saved as test1.c
# include <R.h>
# include <Rmath.h>
void test1 (double *x, double *result)
{
result[0] = rgamma(*x, 2.0);
}
This was compiled using R CMD SHLIB test1.c & loaded in R using:
dyn.load("test1.dll")
out <-
2013 Dec 18
3
rgamma
Estimados
Quisiera tener la sintaxis generar una serie de números entre 0 y 1 con
distribución gamma de 25 puntos y que la suma de todos los puntos debe dar
1.
Por ejemplo:
c (0.000, 0.001, 0.012, 0.043, 0.078, 0.104, 0.117, 0.116, 0.108, 0.094,
0.078, 0.063, 0.049,
0.038, 0.028, 0.021, 0.015, 0.011, 0.008, 0.005, 0.004, 0.003,
0.002, 0.001, 0.001)
No hemos podido
2003 Apr 14
2
A statistical problem.Anybody can help me?
Sorry for the contents not relating to R.
Assume there are N i.i.d zero-mean complex gaussian random
variables(RVs),as w(i),0<=i<N} with known variance,from which one
can generate another N RVs,as
R(0)=sum over i {w(i)*w'(i)}
R(1)=sum over i {w(i+1)*w'(i)}
...
up to
R(N-1)= w(N-1)w'(i)
where w'(i) is the complex conjugate of w(i).
(from viewpoint of signal
2011 Jul 14
1
glm() scale parameters and predicted Values
In glm() you can use the summary() function to recover the shape parameter (the reciprocal of the dispersion parameter). How do you recover the scale parameter? Also, in the given example, how I estimate and save the geometric mean of the predicted values? For a simple model you can use fitted() or predicted() functions. I will appreciate any help.
?
?
?
#Call required R packages
require(plyr)?
2003 Sep 23
1
what does the sum of square of Gaussian RVs with different variance obey?
>From basic statistics principle,we know,given several i.i.d Gaussian RVs with zero or nonzero mean,the sum of square of them is a central or noncentral Chi-distributed RV.However if these Gaussian RVs have different variances,what does the sum of square of them obey?
Thanks in advance.
2013 Dec 18
0
rgamma
Hola José,
Intenta lo siguiente:
x <- rgamma(25, 1, 2)
y <- x/sum(x)
y
sum(y)
par(mfrow = c(1, 2))
hist(x)
hist(y)
Saludos,
Jorge.-
2013/12/18 Dr. José A Betancourt Bethencourt <jbetancourt@iscmc.cmw.sld.cu>
> Estimados
>
> Quisiera tener la sintaxis generar una serie de números entre 0 y 1 con
> distribución gamma de 25 puntos y que la suma de todos los puntos
2012 Mar 16
2
Elegant Code
Hi,
Can anyone help to write a more elegant version of my code? I am sure
this can be put into a loop but I am having trouble creating the
objects b1,b2,b3,...,etc.
b1 <- rigamma(50,1,1)
theta1 <- rgamma(50,0.5,(1/b1))
sim1 <- rpois(50,theta1)
b2 <- rigamma(50,1,1)
theta2 <- rgamma(50,0.5,(1/b2))
sim2 <- rpois(50,theta2)
b3 <- rigamma(50,1,1)
theta3 <-
2007 Nov 01
5
monster method (too hard for my skill level)
I need to write a method for calculating the fee for medical
procedures with respect to area. I have all the tables and data but
its hard to give that here. Can someone take a look at this ''stub''
method and help me out?
def calculate_fee
# strip out the first 3 numbers of the user entered zip code
# use those 3 numbers to identify row in [zipcodes table] (between
upper and
2005 Feb 22
1
include C functions from nmath in my own C functions
Hi:
I am writing a C program which need a gamma random
number generator. I download the source file of R and
compile, make it myself. There is a "rgamma.c"
function in the installing directory of
R("/home/zhliu/Backup/R-2.0.1/src/nmath/rgamma.c"). My
question is how to call this function in my own
program which is in another directory. I can not copy
this "rgamma.c"
2005 Jun 20
1
RCAPI ISDN Support
Hello.
It seems very very strange to me that nobody talks about connecting ISDN
lines to asterisk using a device with RCAPI Support.
There are some devices (most of them isdn routers, like the famous Cisco 800
family) that support this protocol. It basically is an ISDN to IP gateway.
There used to be software that used this technology to send and receive
faxes, act as voicemail and even ISDN
2008 Jul 07
4
Plot Mixtures of Synthetically Generated Gamma Distributions
Hi,
I have the following vector
which is created from 3 distinct distribution (three components) of gamma:
x=c(rgamma(30,shape=.2,scale=14),rgamma(30,shape=12,scale=10),rgamma(30,shape=5,scale=6))
I want to plot the density curve of X, in a way that it shows
a distinct 3 curves that represent each component.
How can I do that?
I tried this but doesn't work:
lines(density(x))
Please
2010 Mar 19
1
Gamma parametrization
Dear R users,
?rgamma gives me :
rgamma(n, shape, rate = 1, scale = 1/rate)
rate: an alternative way to specify the scale.
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)
Should I understand that scale=1/rate ? Is it written somewhere ?
Then