The following is my code, and I would like to get the dpear and ppear plots to appear on the histogram, just as I have done with the density curve, but I am running into some issues trying to do that. If someone could point me in the right direction, that would be great!
library(readr)
library(fitdistrplus)
library(moments)
library(PearsonDS)
library(ggplot2)
newdata <- read_csv("Downloads/newctdata - Sheet1.csv")
data <- rpearson(1000, moments = c(mean = 0.5205263, variance = 0.3940497, skewness = 1.747905, kurtosis = 5.706342))
ppar <- pearsonFitML(data)
print(unlist(ppar))
print(unlist(pearsonFitM(moments = empMoments(data))))
pIpars <- list(a = 0.44883385, b = 2.22621271, location = 0.04565093, scale = 3.20779382)
t <- seq(0, 2.5, by = 0.1)
dpearsonI(t, params = pIpars)
dpear <- plot(t, dpearsonI(t, params = pIpars), type = "l")
ppearsonI(t, params = pIpars)
dpear <- plot(t, ppearsonI(t, params = pIpars), type = "l")
hist(newdata$Mean, prob = TRUE, xlab = "Mean Duration of Asymptomatic Infection in Women", ylab = "Frequency", col = "steelblue", breaks = 12, cex.main = 1.3, cex.axis = 1.5, cex.lab = 1.5)
lines(density(newdata$Mean), col = "tomato", lwd = 4)