Displaying 20 results from an estimated 1000 matches similar to: "many zeroes in rgamma ... what's going on?"
2010 Apr 16
2
how to change the position of xlab in truehist?
Hi,
I'm wondering how can I change the position of xlab in truehist. For example, the following code creats a histogram with 4 bins for my discrete data. I want each bin to be labelled as 0, 1, 2, or 3 in the middle, so that it's clear each bin corresponds to each of the discrete case.
I was thinking of first delete xlab and then add marks myself, but it doesn't look like it's
2007 Mar 20
1
truehist bug?
Hi,
Is this a bug in truehist()?
> library(MASS)
> x <- rep(1, 10)
> truehist(x)
Error in pretty(data, nbins) : invalid 'n' value
Thanks,
Gad
> R.version
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status
major 2
minor 4.1
year 2006
month 12
day 18
svn
2007 Mar 20
1
truehist bug?
Hi,
Is this a bug in truehist()?
> library(MASS)
> x <- rep(1, 10)
> truehist(x)
Error in pretty(data, nbins) : invalid 'n' value
Thanks,
Gad
> R.version
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status
major 2
minor 4.1
year 2006
month 12
day 18
svn
2003 May 03
1
can't plot ylab in graph
Dear People,
I am sure I am missing something obvious as usual, but in the following
graph I can't plot ylab.
Ignoring unimportant details, I am plotting one instance of truehist() and
one instance of curve() on the same graph. Truehist() won't let me pass
the ylab argument. It gives me the error
Error in plot.default(xlim, c(0, ymax), type = "n", xlab = xlab, ylab =
2003 Apr 18
3
superimposing graphs
Dear People,
I have a data set of data x from a probability distribution, and I have a
function, mydensity, of the pdf of that distribution.
I'm asking for help in superimposing the histogram of x and the plot of
mydensity.
In the function below, I call truehist and curve, but these are plotted in
different figures.
I'd like them to be plotted on the same figure, and to use common
2014 Feb 27
1
Join Samba4 member server to Windows AD
Hello everybody,
I need to setup a Domain/subdomain environment with Windows AD. All the
DCs run Windows Server 2012 R2. All domains (root and subdomains) The
forest and domain functional level are set to Windows 2008 R2.
I want to use Samba 4 server as fileservers in these domains, but up to
now I have trouble adding Samba 4 member servers to Windows AD.
My test environment is made of 2
2008 Feb 15
1
Questions about EM algorithm
Dear all:
Assume I have 3 distributions, x1, x2, and x3.
x1 ~ normal(mu1, sd1)
x2 ~ normal(mu2, sd2)
x3 ~ normal(mu3, sd3)
y1 = x1 + x2
y2 = x1 + x3
Now that the data I can observed is only y1 and y2. It is
easy to estimate (mu1+m2), (mu1+mu3), (sd1^2+sd2^2) and
(sd1^2+sd3^2) by EM algorithm since
y1 ~ normal(mu1+mu2, sqrt(sd1^2+sd2^2)) and
y2 ~ normal(mu1+mu3, sqrt(sd1^2+sd3^2))
However, I want
2006 Sep 29
2
X-axis labels in histograms drawn by the "truehist" function
Hi,
I have a simple problem that I would appreciate getting some tips. I am
using the "truehist" function within an "apply" call to plot multiple
histograms. I can't figure out how to get truehist to use the column names
of the matrix as the labels for the x-axis of the histograms.
Here is a simple example:
X <- matrix(runif(4000),ncol=4)
colnames(X)
2010 May 12
3
what the problem could be if i am suddenly unable to add abline to the scatter plot?
I am doing very regular stuff like the following:
attach(wtana)
fm<- lm(Body.Wt.on.SD1~Heart.Wt, data=wtana)
#fm<- lm(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
lrf<- loess(Body.Wt.on.SD1~Heart.Wt, wtana)
#lrf<- loess(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
plot(Body.Wt.on.SD1,Heart.Wt)
#plot(wtana$Body.Wt.on.SD1,wtana$Heart.Wt)
#lines(spline(Heart.Wt,fitted(lrf)), col=2)
abline(fm, col=4)
2002 Jan 18
1
New R on Mac user fails to run MASS
My R installation (Mac OS9.2.2) is working, but when I try to run the
examples from Venables & Ripley (p. 6):
R : Copyright 2001, The R Development Core Team
Version 1.4.0 (2001-12-19)
...
> library(MASS)
> x<-rnorm(1000)
> y<-rnorm(1000)
> truehist(c(x,y+3),nbins=25) % Plots nicely
> dd<-con2tr(kde2d(x,y)) % Doesn't complain
> contourplot(z ~ x + y,
2004 Nov 26
2
hist and truehist
Hello!
Up to now I have been using hist() to display the distributions.
Howevere, I noteiced strange numbers on y (vertical) axis, if I used
probability = T or freq = F option. I thought it is a bug and launched
the R-bug system and found some posts on that matter. Brian Ripley
responded to one, that one should look at truehist() for that. Ok I can
use truehist() if I want to see the ratios
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]
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]]
2009 Apr 28
3
truehist and density plots
Hi,
I wanted to plot the histogram of a vector and then, plot the density function of subsets of the vector on the histogram. So I use truehist in MASS package and lines(density) as follows:
length(b) = 1000
truehist(b)
lines(density(b[1:100]))
however the density plot of the first 100 points exceeds the max of y axis (see attached). how is it possible to make a graphics so that the density plot
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
2004 Sep 09
1
man page of hist points to truehist, which can't be viewed without loading a library?
rdevel from yesterday, also in 1.9.1 (Debian, -3).
The man page of 'hist' (from the graphics package, obtained by
"?hist") suggests 'truehist' under "see also", but 'truehist' isn't
loaded by default (a sensible "of course"), so that "?truehist" fails.
One can do help.search(), of course, which points what to do, but
leads to my
2013 Feb 01
2
How does this function print, why is n1 which equals 1 printed as 2?
Windows 7, R 2.12.1
Colleagues,
I am trying to understand the n.for.2means function. The code below is a copy of the function (renamed to n.for.2means.js). I have inserted a single line of code towards the bottom of the function which uses the cat function to print the value of n1. You will note the value (preceded by stars) is printed as 1.
The function (1) prints a lot of output without any
2011 Jan 10
2
Calculating Portfolio Standard deviation
Dear R helpers
I have following data
stocks <- c("ABC", "DEF", "GHI", "JKL")
prices_df <- data.frame(ABC = c(17,24,15,22,16,22,17,22,15,19),
DEF = c(22,28,20,20,28,26,29,18,24,21),
GHI = c(32,27,32,36,37,37,34,23,25,32),
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
2013 Jan 14
1
Wrong bin count number with hist() ?
Hi there,
# Consider the following example:
A = 19
B = 20
A< B
A==B
hist(c(1:15,B,50),breaks=c(0,15,A,50),plot=F)$count
hist(c(1:15,A,50),breaks=c(0,15,B,50),plot=F)$count
# I was expecting the same results with the following values of A and B:
A = 19.6019203953960
B = 19.6019204365543
A< B
A==B
hist(c(1:15,B,50),breaks=c(0,15,A,50),plot=F)$count# wrong