This is not hard work. Suppose we have some observable data x(yours TMESAL$learningTime), and as a reproducible example, I simply generate 1000 standard standard random samples:
set.seed(0)
x <- rnorm(1000)
:
d <- density.default(x, n = 512, cut = 3)
str(d)
d$x d$y:
xx <- d$x
dx <- xx[2L] - xx[1L]
yy <- d$y
plot(xx, yy, type = "l")
. , :
C <- sum(yy) * dx
, 1 ( ). " ".
, , x0 = 1 , .. [x0, Inf],
p.unscaled <- sum(yy[xx >= x0]) * dx
# [1] 0.1691366
, C:
p.scaled <- p.unscaled / C
x , :
pnorm(x0, lower.tail = FALSE)
# [1] 0.1586553
.