similar to: hist densities

Displaying 20 results from an estimated 20000 matches similar to: "hist densities"

2008 Apr 25
0
hist densities
This is a reply to Luke Spadavecchia''s question about hist densities. If you want to construct a histogram where the bar heights are the percentage of observations in the intervals you can use this code: x<-rnorm(n=5000,mean=1.5,sd=0.25) h<-hist(x) h$density<-h$counts/sum(h$counts) plot(h,freq=F,ylab="Percentage") Sarah Hardy Sarah.hardy@maine.edu
2009 Jul 26
2
problems hist() and density
Hello, I have a problem with the hist() function and showing densities. The densities sum to 50 and not to 1! I use R version 2.9.1 (2009-06-26) and I load the seqinR library. My data is the following vector: [1] 0.1400000 0.2000000 0.2200000 0.2828283 0.1600000 0.1600000 0.3600000 [8] 0.1600000 0.2200000 0.2600000 0.2000000 0.3000000 0.2200000 0.2342342 [15] 0.1800000 0.2200000 0.1600000
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.
2006 Apr 05
1
hist function: freq=FALSE for standardised histograms
Dear All, I am a undergraduate using R for the first time. It seems like an excellent program and one that I look forward to using a lot over the next few years, but I have hit a very basic problem that I can't solve. I want to produce a standardised histogram, i.e. one where the area under the graph is equal to 1. I look at the manual for the histogram function and find this: freq:
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
2010 Nov 11
3
overlap histogram and density
Hi, Does anybody encounter the same problem when we overlap histogram and density     that the density line seem to shift to the right a little bit?           If you do have the same problem, what should we do to correct that?           Thank you.           par(mar=c(4,4,2,1.2),oma=c(0,0,0,0))     hist(datobs,prob=TRUE, main ="Volume of a catchment from four    
2011 Jan 13
3
Question about histogram
Dear list, I'm new to R, please bear with my silly questions. I'm trying to get an understanding of why the results I get from a call to hist() are not as I thought I would get. When I use the parameter freq=FALSE, I think the plot will contain bars that none of them is larger than 1, because they're probabilities. But for my code, the bars exceeded 1. The actual data seems
2009 Aug 19
1
Fw: Hist & kernel density estimates
For the hist estimate >par(mex=1.3) >dens<-density(q) >options(scipen=4) > ylim<-range(dens$y) > h<-hist(q,breaks="scott",freq=FALSE,probability=TRUE, +? right=FALSE,xlim=c(9000,16000),ylim=ylim,main="Histogram of q(scott)") > lines(dens) >box() ? For the kernel estimate>options(scipen=4) > d <- density(q, bw =
2004 Jun 17
3
disappointed with x-axes in hist and density plots
I've got a few issues with the x-axes in the histogram and density plots. First, often the default x-axis doesn't even extend to the length of my data. R often draws histogram bars (or density lines) farther than the drawn x-axis extends. For example, I might have a histogram bar at -15,000. But I wouldn't know that, because the most negative number on the x-axis is -10,000. The
2001 Oct 18
0
Numerical precision of hist densities or cumsum?
Today I wanted to experiment with different distributions an to see the hazard rates they imply. So I eventually ended up with this, which uses the hist object's handy $density and the cumsum function in R: x <- c(rweibull(21000,0.5,0.7)) #create "breaks" vector to go into histogram #need last break bigger than max(x) y <- seq(0,max(x)+2) histx <-
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
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
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
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:
2009 Aug 19
1
Hist & kernel density estimates
Dear All, Attached are the codes of a histogram & a kernel density estimate and the output they produced. In fact the variable q is a vector of 1000 simulated values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in the sample observations), and thus I was left with 1000 values of q and I don't know the
2007 Oct 30
1
Polygon shading line colors
Hi there, I'm having trouble working out how to change the colors of polygon shading lines. If I plot a polygon with polygon(poly,density=30,borders=gray(0.5)) I get gray borders but black shading lines; I have tried adding col=gray(0.5), bg=gray(0.5) and fg=gray(0.5), but no luck. How can I change the colors of the shading? The help file doesn't seem to detail this, so any
2008 Dec 26
1
histogramm$density
hello, i am using the hist function with classified values. The class breaks are >1, so histogram$density is != 1. How to plot the histogram with freq=FALSE and the real class density values. I used: > h2 = hist(value, breaks = breaks_vector) > h2$density = round(h2$counts/sum(h2$counts), 2) > h2$intensities = h2$density > plot(h2, freq=F) but this isn't the best way, i
2004 Aug 21
1
relative frequencies for hist()
I have problems getting a histogram with relative frequencies on the y-axis. Here is an example data set: > a <- c(4.626, 4.627, 4.627, 4.628, 4.629, 4.629, 4.630, 4.631, 4.632, 4.632) > d = hist(a,freq=F) > d$density [1] 299.9999 100.0000 200.0000 100.0000 100.0000 200.0000 The obtained densities are given by counts/(total n * bin width), with bin width being
2005 Nov 02
2
breaks in hist()
Dear listers, A quick question about breaks in hist(). The histogram is highly screwed to the right, say, the range of the vector is [0, 2], but 95% of the value is squeezed in the interval (0.01, 0.2). My question is : how to set the breaks then make the histogram look even? Thanks in advance, Leaf
2006 Aug 10
2
hist() and bar spacing
Hello, Could someone explain to me why I get so different histograms, in terms of bar spacing, depending on the number of counts entered ? (see example below) > test <- c(0,1,1,1,1,0,0,0,0,0,2,3,2,2,2,3,3,4,5,6,7,5,4,3,4,2,2) > hist(test) I obtain this kind of histogram (what I actually want), i.e. large bars with no space between them x xx xxx xxxx xxxxx xxxxxx