# Truncation of a lorgnormal distriution in a poisson process

Hi,
I try to produce a simulation of insurance claims and finding the quantiles using a compound Poisson process with the code below. However, I would like to truncate the lognormal distribution used for generating the claim values at a certain value on the left side (e.g. at 10, so no values below 10 are included). I tried to use rlnormTrunc(), but this seems not to work in all cases (especially with small Lamdas, where it is possible that the frequency is 0). Thanks in advance for any inputs

``````# set the seed so we can reproduce the simulation
set.seed(1234)

expected_freq <- 10

# generate a single frequency from the poisson distribution
freq <- rpois(n = 1, lambda = expected_freq)

# generate `freq` severities.  Each severity represents the ultimate value of 1 claim
# we will use the lognormal distribution here
sev <- rlnorm(n = freq, meanlog = 9, sdlog = 1.75)

# number of observations
n <- 1000
# generate many frequencies from the poisson distribution
freqs <- rpois(n = n, lambda = expected_freq)

# generate `freq` severities.  Each severity represents the ultimate value of 1 claim
obs <- purrr::map(freqs, function(freq) rlnorm(n = freq, meanlog = 9, sdlog = 1.75))

# tidy up the data
i <- 0
obs <- purrr::map(obs, function(sev) {
i <<- i + 1
data_frame(
ob = i,
sev = sev
)
})

obs <- dplyr::bind_rows(obs)
quantile(obs\$sev, c(0.975, 0.99, 0.999))``````

if you wanted to keep only severities over 5000 I think you'd do this.

``````obs <- purrr::map(obs, function(sev) {
i <<- i + 1
tibble(
ob = i,
sev = sev[sev>5000]
)
})``````

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.