Displaying 20 results from an estimated 1800 matches similar to: "rgamma question"
2004 Feb 12
1
How do you create a "MCMC" object?
I have been running a Gibbs Sampler to estimate levels of efficiency in the
Louisiana Shrimp Industry. I created a matrix (samp) where I stored the
results of each iteration for 86 variables. I run 10,000 iterations. So, the
matrix samp is 10,000 x 86. I want to use the gelman-rubin test to check for
convergence. To do that, I need at least two chains. If I run second chain
with different starting
2004 Mar 04
1
Gelman-Rubin Convergence test
Dear friends,
I run the Gelman-Rubin Convergence test for a MCMC object I have and I
got the following result Multivariate psrf 1.07+0i, What does this mean? I
guess (if I am not mistaken) that I should get a psrf close to 1.00 but what
is 1.07+0i? Is that convergence or something else?
Jorge
[[alternative HTML version deleted]]
A log on Bayesian statistics, stochastic cost frontier, montecarl o markov chains, bayesian P-values
2004 Feb 17
0
A log on Bayesian statistics, stochastic cost frontier, montecarl o markov chains, bayesian P-values
Dear friends,
Over the past weeks, I have been asking a lot of questions about how to
use R in Bayesian analysis. I am brand new to R, but I am very pleased with
it. I started with winbugs but I found winbugs to be a limited software, not
bad but has several limitations. By contrast, R allows the analyst to tackle
any problem with a huge set of tools for any kind of analysis. I love R. In
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
2000 Apr 14
1
rgamma with negative shape and scale parameters works?
Dear R people,
This is a possibly silly question, but the rgamma function takes the shape
and scale arguments and simulates gamma rvs corresponding to those values,
right? But the shape and scale parameters have to be positive, right?
However, rgamma quite happily returns to me values for negative values of
shape and scale, and in some cases returns negative values eg.
> rgamma(1, 1, -1)
[1]
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
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,
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
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
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=',
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
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 <-
2011 Dec 07
1
data frame and cumulative sum
Hello,
I have a data frame that looks like this (containing interarrival times):
> str(df)
'data.frame': 18233 obs. of 1 variable:
$ Interarrival: int 135 806 117 4 14 1 9 104 169 0 ...
> head(df)
Interarrival
1 135
2 806
3 117
4 4
5 14
6 1
>
This corresponds to the time differences (in ms) of a poisson arrival
2008 Oct 23
1
distribution fitting
Dear R-help readers,
I am writing to you in order to ask you a few questions about distribution
fitting in R.
I am trying to find out whether the set of event interarrival times that I
am currently analyzing is distributed with a Gamma or General Pareto
distribution. The event arrival granularity is in minutes and interarrival
times are in seconds, so the values I have are 0, 60, 120, 180, and
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
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
2005 Jul 27
7
gamma distribution
Hi R Users
This is a code I wrote and just want to confirm if the first 1000 values are raw
gamma (z) and the next 1000 values are transformed gamma (k) or not. As I get
2000 rows once I import into excel, the p - values beyond 1000 dont look that
good, they are very high.
--
sink("a1.txt");
for (i in 1:1000)
{
x<-rgamma(10, 2.5, scale = 10)
y<-rgamma(10, 2.5, scale = 10)
2009 Sep 17
2
QQ plotting of various distributions...
Hello!
I am trying with this question again:
I would like to test few distributional assumptions for some behavioral
response data. There are few theories about true distribution of those
data, like: normal, lognormal, gamma, ex-Gaussian
(exponential-Gaussian), Wald (inverse Gaussian) etc. The best way would
be via qq-plot, to show to students differences. First two are trivial:
qqnorm(dat$X)
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)?
2007 May 01
2
Simulation using parts of density function
Hi
My simulation with the followin R code works perfectly:
sim <- replicate(999, sum(exp(rgamma(rpois(1,2000), scale = 0.5, shape = 12))))
But now I do not want to have values in object "sim" exceeding 5'000'000, that means that I am just using the beginning of densitiy function gamma x < 15.4. Is there a possibility to modify my code in an easy way?
Thanks for any help!