set.seed(1)
x <- rlindley(n = 1000, theta = 1.5, mixture = TRUE)
R <- range(x)
S <- seq(from = R[1], to = R[2], by = 0.1)
plot(S, dlindley(S, theta = 1.5), xlab = 'x', ylab = 'pdf')
hist(x, prob = TRUE, main = '', add = TRUE)
p <- seq(from = 0.1, to = 0.9, by = 0.1)
q <- quantile(x, prob = p)
plindley(q, theta = 1.5, lower.tail = TRUE)
plindley(q, theta = 1.5, lower.tail = FALSE)
qlindley(p, theta = 1.5, lower.tail = TRUE)
qlindley(p, theta = 1.5, lower.tail = FALSE)
library(fitdistrplus)
fit <- fitdist(x, 'lindley', start = list(theta = 1.5), lower = c(0))
plot(fit)
Run the code above in your browser using DataLab