pdf_trim | R Documentation |
Evaluate the pdf of a trimmed distribution. Note that in the case of a rectified distribution, the pdf at a bound is computed from the parent distribution d, and is hence not equal to the probability of being equal to the bound.
pdf_trim(d, x, trim = c(-Inf, Inf), doTrunc = FALSE)
d |
distributions3 object |
x |
Numeric vector, values at which the pdf is evaluated |
trim |
Numeric vector of size 2, trimming bounds. |
doTrunc |
Logical, do truncation? default FALSE, i.e. rectification is used. |
a numeric vector containing the pdf values.
# Define Normal distribution
norm <- Normal(mu=0.75,sigma=0.5)
# Define a grid of values x
x=seq(-1,2,,100)
# Compare pdf of basic / rectified / truncated Gaussian distributions
y0=pdf_trim(norm,x)
yr=pdf_trim(norm,x,trim=c(0,1))
yt=pdf_trim(norm,x,trim=c(0,1),doTrunc=TRUE)
plot(x,y0,type='l',ylim=c(0,max(yt)))
points(x,yr,col='red')
points(x,yt,col='blue',pch=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.