search for: densiti

Displaying 20 results from an estimated 2583 matches for "densiti".

Did you mean: density
2013 Mar 20
3
highlight overlapping region of two densities
Hi all. I would like to highlight overlapping regions of two densities and I could not find a way to do it. Here is the sample code: myd <- c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5, 2, 3,3, 2.3, 3, 3, 2, 3) myd1 <- myd-2 plot(range(density(myd)$x, density(myd1)$x), range(density(myd)$y, density(myd1)$y), type = "n") lines(density(myd...
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 Nov 25
3
plotting density for truncated distribution
I am using density() to plot a density curves. However, one of my variables is truncated at zero, but has most of its density around zero. I would like to know how to plot this with the density function. The problem is that if I do this the regular way density(), values near zero automatically get a very low value because there are no observed values below zero. Furthermore there is some density
2012 Mar 21
3
Unable to specify order of a factor
Hi all: I'm attempting to create a faceted plot with ggplot2 and I'm having issues with a factor's order that is used to define the facet_grid(). The factor (named total.density) has three levels - 8, 16, and 32 - and I would like them presented in that order. Running order(levels(total.density)) yields the incorrect order of the facet grid - 2 3 1, corresponding with 16, 32, and 8.
2003 Apr 08
3
density ranges for uniform law
Hello, I would have some details and explanations about the results I get. In fact, I start with a uniform sample between -1 and 1, and then plot its density. My problem is that the density ranges are much more longer than I expected : samp <- runif(10000,-1,1) plot(density(samp)) Instead of varying between -1 and 1, the density varies between approximaly -1.5 and 1.5 Could someone explain
2002 Aug 30
5
density() returns a density function that does not add up to 1
Dear R users, I ran into this curious problem: > d <- rnorm(100) > d.density <- density(d) > sum( d.density$x * d.density$y) [1] 2.517502 Admittedly the method of computing the mass under the density curve at line 3 is crude. But 2.5 is pretty far from 1, the value it should be. I tried a few other dataset and got similar result. Am I missing something obvious? Or is the return
2007 Aug 05
1
Selectively shading areas under two density curves
Dear Listers, I am drawing a plot of two density curves, for male and female incomes. I would like to shade/hatch/color (whatever) the areas under the curves which are distinctive for each gender. This is the code I have tried so far: m <- density(topmal.d$y, bw = "sj") f <- density(topfem.d$y, bw = "sj") par(mfrow = c(1,1)) plot(x = c(0,400), y = c(0,0.02), type =
2006 Aug 30
2
density() with from, to or cut and comparrison of density()
Hi the function density() does normally integrate to one - I've checked it and it works and I also read the previous threads. But I realised that it does not integrate to one if I use from, to or cut. My scenario: I simulated densities of a plants originating from an sseed source at distance zero. Therefore the density of the plants will be highest close to zero. Is there anything I can do to have this pattern? If I use 'from' or 'cut', the resulting densities do not integrate to one which I need as I want to co...
2011 Sep 08
3
Density function: Area under density plot is not equal to 1. Why?
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands: data <- runif(58) a <- density(data, from=0, to=1) plot(a, type="l",lwd=3) But then, when I try to approximate the area under the plotted curve with the command: area <- sum(a$y)*(a$x[1]-a$y[2])
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:
2003 Sep 24
3
density() integrates to 1?
Visual inspection of the plot of a density() function vs a normal with the same mean and variance suggests the area under the density curve is bigger than under the normal curve. The two curves are very close over most of the domain. Assuming the normal curve does integrate to 1, this implies the area under density() is > 1. Is there any assurance that the density kernel smoother produces
2008 Feb 05
2
two densities with same stepsize
Hi there, I have two series of data. plotting the density function of both gives me an idea about the difference of the data. But I would like to quantify the difference I see. a <- rnorm(100) b <- rnorm(100) da <- density(a) db <- density(b) The problem is that da$x and db$x are different and so I have difficulties to compare them... Is there any way to force the density
2011 Oct 12
4
plot probability density function (pdf)
I have 2 series of variables, I want to plot the probability density function of these 2 variabels (i.e. two curves in one graph), I just want to compare these two variable distribution. what should I do? can I use ggplot2 package? -- View this message in context: http://r.789695.n4.nabble.com/plot-probability-density-function-pdf-tp3897055p3897055.html Sent from the R help mailing list archive
2000 Nov 17
2
hist() and density
...make density histograms) It doesn't seem easy to make density on the y-axis with the current hist(). The freq argument only lets you choose counts (TRUE) or relative frequency (FALSE). I would like to suggest that freq (or some renamed version of the argument) take on the values counts freqs densities So that you can easily do a density histogram. The strange thing to me is that if you do h<-hist(...) you get h$intensities, which is the densities. So hist calculates the densities, but doesn't let you plot them? May I suggest you call it $densities? I don't know why you call it int...
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
2009 Nov 05
5
Density estimate with bounds
Dear R users, I would like to show the estimated density of a (0, 1) uniformly distributed random variable. The density curve, however, goes beyond 0 and 1 because of the kernel smoothing. Example: x = runif(10000) plot(density(x)) Is there a way to estimate the density curve strictly within (0, 1) and still use some sort of smoothing? Any help would be greatly appreciated. Best regards,
2010 Jun 14
1
script development for Unconditional Density and Probability estimation
Hello, I'd like to automate this script a bit more and cycle several parameters(both the species and the metric). For example where AnnualDepth occurs, I need to process about 12 metrics so instead of writing this entire script 12 times once for each metric I'd like to be able to automatically get another metric. Any suggestion will be greatly appreciated. Currently running Windows
2009 Sep 29
3
Probability of data values form DENSITY function
Hello,   Could someone help me please and to tell how to get the probability from empirical DENSITY (not parametric) for each data value (R function). For example, for normal distribution there is such a function like:   “dnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)”   I need the same function only for the empirical DENSITY function (which does not correspond to any typical
2010 Jul 20
2
Constrain density to 0 at 0?
...xlim=c(0,10), main="Test TLFD", xlab="Distance", col=6 ) lines(density(zTestData$Distance, weights=zTestData$FlatWeight), col=2) lines(density(zTestData$Distance, weights=zTestData$BrdWeight ), col=3) which works fine except the distances are all positive, but the densities don't drop to 0 until around -2 or -3. Is there a way for me to "force" the density plot to 0 at 0? Thanks Robert Farley Metro 1 Gateway Plaza Mail Stop 99-23-7 Los Angeles, CA 90012-2952 Voice: (213)922-2532 Fax: (213)922-2868 www.Metro.net [[alternative HTML version...
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