# NOT RUN {
# Generate some fictional data.
set.seed(1234)
testdata <- rBeta.4P(100000, .25, .75, 5, 3)
hist(testdata, xlim = c(0, 1), freq = FALSE)
# Suppose you know three of the four necessary parameters to fit a four-
# parameter Beta distribution (i. e., u = 0.75, alpha = 5, beta = 3) to this
# data. To find the value for the necessary l parameter, estimate the mean
# and variance of the distribution:
M <- mean(testdata)
S2 <- var(testdata)
# To find the l parameter necessary to produce a four-parameter Beta
# distribution with the target mean, variance, and u, alpha, and beta
# parameters using the LMSBAU() function:
(l <- LABMSU(alpha = 5, beta = 3, mean = M, variance = S2, u = 0.75))
curve(dBeta.4P(x, l, .75, 5, 3), add = TRUE, lwd = 2)
# }
Run the code above in your browser using DataCamp Workspace