Displaying 20 results from an estimated 20000 matches similar to: "Problem with hist(x, prob=T) (PR#947)"
2007 Feb 14
1
Problem with the 'hist' function
Hi, I am using the following R version:
> R version 2.4.1 (2006-12-18)
> Copyright (C) 2006 The R Foundation for Statistical Computing
> ISBN 3-900051-07-0
I believe I found a bug in the 'hist' function, when
'probability=TRUE'. I looked in the archives and I came across
problems with the 'hist' functions (e.g., bug PR# 944, posted in
2001), however, a
2001 May 20
1
hist() ignores 'probability=T' (PR#944)
In the following, 'probability=T' is ignored,
i.e. the vertical axis is labelled in
frequencies.
However hist(islands, freq=F) achieves the desired effect.
> data(islands)
> hist(islands, probability=T) # Vertical axis gives frequencies
> hist(islands, freq=F) # Expected result
--please do not edit the information below--
Version:
platform = i386-pc-mingw32
2001 Jun 26
5
breaks in hist()
I was using the hist() function to create a frequency table of some network
traffic data. The range in values is rather large, from 0 till just under
10e12. Calling hist(x, breaks=c(0,1000,1e6,1e9,1e12),plot=F,freq=T) causes
hist() to return :
$breaks
[1] -1.0000e+05 1.0100e+05 1.1000e+06 1.0001e+09 1.0000e+12
Is this recalculation of the breaks by hist() intended?
Maarten van Gelder.
2004 Jun 02
2
a fault in the "hist" - function (PR#6931)
Full_Name: Stephan Schlueter
Version: 1.9.0
OS:
Submission from: (NULL) (217.184.109.24)
During my studies, I found a fault in the hist()-function:
If you have a vector x with values around zero and also bigger than 10,000,000 ,
there will be a shift of -max(x)/10,000,000 in the hist-datas.
See my example:
x<-runif(10000)
hist(x,breaks=c(seq(-3,3,0.1)),prob=TRUE)
#everything ok, but
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:
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
2005 Jan 07
4
hist function to give each cell equal area
Hi,
I want to use hist with non-equi-spaced breaks, picked such that the
fraction of the data points falling in the cells (defined by 'breaks') is
roughly equal accross all cells.
Is there such a function that will automatically try to determine the
breaks to fullfill this requirement?
Something like..
hist( x, br = magic_function_to_pick_breaks())
For example, if x looked like
2004 Jun 04
1
hist, lines, rug
Hello,
I'm trying to plot a historgram with a density plot superimposed:
hist(x, seq(-1, 1, by = 0.1), prob = T, col = "blue")
lines(density(x, bw = 0.1))
rug(x)
I don't want to add rug(x) but the histogram will not be plotted unless
rug(x) is there. It does not work if the "hist" line alone is present.
Can you help?
Thanks,
Kim
[[alternative HTML version
2005 Oct 18
2
hist of dates
Hi all
I wish to draw an histogram... with dates but the following append, i don't know where is the problem, help(hist.Date) works and i don't see any usefull information on what i'm doing wrong...
> hist.Date(dt_cycles)
Error: couldn't find function "hist.Date"
> hist.date(dt_cycles)
Error: couldn't find function "hist.date"
> cycles
[1] 7 1
2008 May 20
2
hist clarification
Can someone help me with a misunderstanding I'm having with hist? I
expected, from the example below, that the number of bins would always be 10
and the length of the counts array the same. According to the help section
'breaks' can be a integer indicating the number of bins. From the example
below, the number of bins (length of the counts array) varies. Am I wrong in
expecting the
2012 Aug 09
1
help hist some 'x' not counted; maybe 'breaks' do not span range of 'x'
Hello Guys,
I would like help in script R when I try to plot the histogram appears the error:
Erro em hist.default some 'x' not counted; maybe 'breaks' do not span range of 'x'
I using a file with more 1000 datas (vector)
hist(dados[[1]], seq(0, 20, 0.5), prob=TRUE, xlab="chuva (mm/dia)",ylab="frequência", main="", cex.lab=1.6,
2006 Dec 04
2
erroneous warning in hist (PR#9408)
Full_Name: Alex Deckmyn
Version: 2.4.0
OS: linux
Submission from: (NULL) (193.190.63.62)
specifying the "right" option in hist results in a warning when plot=F. The
option is taken into account correctly, but a warning is issued anyway. When
plot=T there is no warning.
> hist(c(1,1.5),breaks=0:4)$counts
[1] 1 1 0 0
> hist(c(1,1.5),breaks=0:4,right=T)$counts
[1] 1 1 0 0
>
2011 Mar 03
3
Probabilities greather than 1 in HIST
Dear all,
I am a newbie in R and could not find help on this problem. I am trying to
plot an histogram with probabilities in the y axis. This is the code I am
using:
#TLC uniform
n=30
mi=1; mx=6
nrep=1000
xbar=rep(0,nrep)
for (i in 1:nrep) {xbar[i]=mean(runif(n,min=mi,max=mx))}
hist(xbar,prob=TRUE,breaks="Sturges",xlim=c(1,6),main=paste("n =",n),
xlab="Média",
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]
2003 Jan 08
4
weird breaks in hist (PR#2431)
Full_Name: Reinhold Koch
Version: 1.6.1
OS: redhat 8.0
Submission from: (NULL) (131.152.84.111)
I came across rather weird behavior of the breaks in hist:
hist(1:3)
gives the expected result, besides an unnecessary gap between 2nd and 3rd
column
hist(1:4)
always merges up the first two columns, also if I resort to
hist.default(1:4,breaks=1:4). hist.default(1:4, include.lowest=F) gives an
2003 Mar 08
2
hist() basic question
Hi,
This is a very basic question, but I would like to undestand hist(). I
thought that the hist( , freq=FALSE) should provide the relative
frequencies (probabilities), and so they should sum 1, however:
set.seed(2)
ah <- hist(rnorm(100), freq=F)
sum(ah$intensities)
[1] 2
set.seed(2)
bh <- hist(rlnorm(100), freq=F)
sum(bh$intensities)
[1] 0.4999996
I'm getting similar figures with
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
2005 Dec 11
1
(PR#8376 inconsistency between plot(hist(...)) and hist(...)
On Sun, 11 Dec 2005 clausen at econ.upenn.edu wrote:
> Full_Name: Andrew Clausen
> Version: 2.1.0
> OS: Debian GNU/Linux
> Submission from: (NULL) (71.242.192.73)
>
>
> Hi,
>
> When I type
>
> hist(x, freq=F)
>
> I get a density function, as I expect. However, if I type
>
> plot(hist(x, freq=F))
>
> then I get the same output as if I had
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
2009 Jun 04
1
hist returning density larger than 1
The following code is giving me problems. I want to export densities
of a distribution to a csv file. At the bottom of the code I use the
hist function to generate the densities. But hist is returning values
greater than 1. I don't understand, why. Any help you can supply is
greatly appreciated.
# Set word path
dir<-"~/Research/MR Distribution Analysis/"
setwd(dir)