pdf_trim: Pdf of a trimmed distribution

View source: R/dpqrMethods.R

pdf_trimR Documentation

Pdf of a trimmed distribution

Description

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.

Usage

pdf_trim(d, x, trim = c(-Inf, Inf), doTrunc = FALSE)

Arguments

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.

Value

a numeric vector containing the pdf values.

Examples

# 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)

benRenard/disTRIMbution documentation built on July 1, 2023, 4:24 a.m.