I'm wondering if it might be possible to draw a theoretical density histogram for a given continuous distribution in R?
By a theoretical histogram, I mean a histogram that is not based on the available random variable generators in R (e.g., hist(rnorm(1e4))
). Rather, a histogram that exactly matches the probability density function (pdf) of the continuous distribution in question for a user-defined support (i.e., range for the random variable) with adjustable breaks.
As an example in R, we know that the pdf of a standard normal distribution for the support -5
to 5
is theoretically shaped like obtained by the R code below.
In R, can we turn this exact theoretical pdf to a corresponding theoritical density histogram? Any suggestion as to how this could be done in R?
c = curve(dnorm(x), -5, 5, n = 1e4)