Displaying 20 results from an estimated 30000 matches similar to: "find the mode of a dataset"
2010 Mar 13
2
Is this a bug (or a feature) in hist(x)$density ??
Hi all,
A friend send me a question on why does this:
x<-rpois(100,1)
sum( hist(x)$density )
Gives out "2"
I tried this:
sum( hist(x, freq =T)$density )
It didn't help.
Then he came back with the following insight:
# with breaks
b<-c(0,0.9,1:8)
sum(hist(x,breaks=b)$density) # Much more then 2
# but if we add weights according to the interval length
2004 Feb 24
4
Computing the mode
Hi all,
I think this question could be quite trivial, but I can?t find out the
solution... How can you compute the statistic "mode" of a sample, in
case it exists (as mode() returns the mode of an object)? I tried
help.search("mode") but I couldn't find a clue...
Any help would be much appreciated. Regards,
Aurora
2007 Aug 15
4
Possible to "import" histograms in R?
Hi,
I have a large amount of data that I would like to create a histogram of and
plot and do things with in R. It is pretty much impossible to read the data
into R, so I have written a program to bin the data and now have a list of
counts in each bin. Is it possible to somehow import this into R and use
hist(), so I can, for instance, plot the probability density? I have looked
at the help page
2011 Jan 16
3
rootogram for normal distributions
Using R-2.12.1 and latticeExtra-0.6-14, I would like to understand
why a rootogram displaying samples from the Poisson distribution looks like I
expected it, whereas a rootogram using the normal distribution does not:
library(latticeExtra)
rootogram(~rpois(1000, lambda = 50), dfun = function(x) dpois(x, lambda = 50))
rootogram(~rnorm(1000), dfun = function(x) dnorm(x,mean(x),sd(x)))
I
2010 Oct 17
2
dpois().......bizarre warning messages
Dear Masters,
I have a question to submit
consider the following script
m<-4.95
obs<-rpois(36,m) # i generate 36 realization from a poisson(m)
hist(obs,freq=F)
curve(dpois(x,m),add=T,col="red") #i wish to overlay on the histogram the
theorical poisson density function
errors are returned saing the x vector doesn't contain integers....
really bizarre i can't give
2006 Jul 27
3
bug with rpois (PR#9106)
The R poisson random generator rpois appears to have a bug for
theta 10 or larger. The sample mean of the pseudo variates is too
small: sample mean approx theta - 0.5.
I use Version 1.1.1 (August 15, 2000) Of R on a Dell OptiPlex computer
with the
Windows XP Professional operating system.
Has this bug been fixed in later versions?
(I found another reported rpois bug, but it appears to be
2011 Jul 15
3
Drawing a histogram from a massive dataset
Dear All,
I have a massive dataset from which I would like to draw a histogram.
Any ideas on how to accomplish this?
Thanks in advance,
Paul
2007 Feb 07
3
Sample Poisson Distribution
Hi,
I'm completely new to R, I am all at sea with the interface and the
confusing help files, so would appreciate some help to do a simple task.
Need to present the mean and variance of 100 different samples of poisson
distributions (N=1000, with fixed lambda) in a file in two columnns, and
then produce histograms.
So far I have figured out:
> N <- 1000
> x <- rpois(N, 3.1) ,
2008 Jul 29
2
Help interpreting density().
I issue the following:
> d <- density(rnorm(1000))
> d
and get:
Call:
density.default(x = rnorm(1000))
Data: rnorm(1000) (1000 obs.); Bandwidth 'bw' = 0.2235
x y
Min. :-3.5157 Min. :2.416e-05
1st Qu.:-1.6892 1st Qu.:1.129e-02
Median : 0.1373 Median :7.267e-02
Mean : 0.1373 Mean :1.367e-01
3rd Qu.: 1.9639
2001 Mar 05
1
histogram of frequencies (PR#861)
Full_Name: Dr. Bernd Winkler
Version: 1.2.2
OS: Linux
Submission from: (NULL) (194.59.179.176)
Hi all,
having updated to version 1.2.2 last week I experienced some strange behaviour
of
the hist function.
I want to plot a histogram of frequencies resp. counts, for example poisson
random numbers, on a predefined and fixed x scale
> hist(rpois(500, 2), breaks=0:10)
But instead of the
2009 Mar 02
4
density > 1?
Dear R-Gurus,
I wonder why 'density' values as shown in hist or plot(density(x)) are
sometimes over 1. How can that be?
Example
>hist(rnorm(1000,sd=.5),freq=FALSE)
The resulting plot shows density values below 1 on the y-axis. However,
>hist(rnorm(1000,sd=.1),freq=FALSE)
shows density values over 1.
How to interpret density values over 1?
Greetings,
Johannes
2008 Jun 23
5
Need ideas on how to show spikes in my data and how to code it in R
Hi
I have recently been analyzing birthweight data from a clinic. The
data has obvious defects in that there is digit preference on certain
weights making them overrepresented. This shows as spikes in the
histogram on certain well rounded weights like 2, 2.5, 3, etc. I
would like to show this to government officials but can't figure out
how I should present the finding in an easy to
2013 Jan 22
3
density of hist(freq = FALSE) inversely affected by data magnitude
Hi,
I have a couple of observations, a question or two, and perhaps a
suggestion related to the plotting of density on the y-axis within the
hist() function when freq=FALSE. I was using the function and trying
to develop an intuitive understanding of what the density is telling
me. After reading through this fairly helpful post:
2005 Dec 13
8
superimpose density line over hist
Hi all,
I'm trying to superimpose a rchisq density line over a histogram with
something like:
hist(alnlength)
lines(density(rchisq(length(alnlength), 4)),col="red")
But the rchisq line won't appear anywhere,
Anyone knows what I am missing here?
Thanks in advance,
Albert.
2003 Mar 26
3
hist overlay...
thanks to all for the 2d scatter plot.
i have one more.
how do i plot 'hist(y1, col="red") and hist(y2,col="blue") in the same window?
thanks again.
2006 Aug 10
3
Multiple density curves
Hi,
I am new to R...a recent convert from SAS.
I have a dataset that looks like this:
SEQ A1 A2
A 532.5 554.5
B 25.5 35.5
C 265.2 522.2
D 245.55 521.56
E 546.52 141.52
F 243.25 32.56
G 452.55 635.56
H 15.14 16.54
I 543.4 646.56
J 54.4 654.5
K 646.5 64.54
L 645.4 614.46
M 646.54 634.46
I want to make a histogram
2007 Oct 10
3
simulated data using empirical distribution
Hello all:
I'm sure this is a trivial request, but I'm still a beginner at this,
and haven't been able to find it. I need to create simulated data based
on some empirical distributions of a single variable. I've found R
functions to help me simulate data based on analytical distributions, or
to make simulations based on correlation matrices, but nothing so simple
as what I need.
2004 Aug 19
3
probability histogram question
Hello, all;
I get an unexpected result when trying to plot a probability histogram
with R1.9.1 on windows xp:
#with the following code:
> x <- runif(100,0,1)
> hist(x)
> hist(x, freq=F)
> h <- hist(x, freq=F)
> summary(h)
# Length Class Mode
#breaks 11 -none- numeric
#counts 10 -none- numeric
#intensities 10 -none- numeric
#density 10
2010 Mar 30
1
hist.default()$density
Dear developers,
the current implementation of hist.default() calculates 'density' (and
'intensities') as
dens <- counts/(n*h)
where h has been calculated before as
h <- diff(fuzzybreaks)
which results in 'fuzzy' values for the density, see e.g.
> tmp <- hist(1:10,breaks=c(-2.5,2.5,7.5,12.5),plot=FALSE)
> print(tmp$density,digits=15)
[1]
2000 Nov 17
2
hist() and density
There were some questions about hist() a couple of days ago which
triggered this post. My question/suggestion is about the y-axis in hist.
There are reasons to prefer making the y-axis density=relative
frequency/bin width. One reason is that the height of the plot does not
depend on the bin width; another is that if your histogram is in density
then you can easily superimpose a smooth theoretical