thank you, both solutions are really helpful!
--
View this message in context:
http://www.nabble.com/plotting-density-for-truncated-distribution-tp20684995p20703469.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org
Another option
mydata <- rnorm(10)
mydata <- mydata[mydata>0]
plot(density(c(mydata, -mydata), from=0))
If you want the area under the curve to be one, you'll need to double the
density estimate
dx <- density(c(mydata, -mydata), from=0)
dx$y <- dx$y * 2
plot(dx)
Chris
Jeroen Ooms wrote:
Default kernel density estimation is poorly suited for this sort of
situation.
A better alternative is logspline -- see the eponymous package -- you
can
specify lower limits for the distribution as an option.
url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED
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 ge
4 matches
Mail list logo