我想创建一个QQ图,但我不想将其与标准正态分布进行比较。我目前有这个:
log_amount = runif(100)
fit = fitdistr(log_amount, "normal")
qmy_distribution = function(p) {
return(qnorm(p, fit$estimate[1], fit$estimate[2]))
}
expected = qmy_distribution(ppoints(length(log_amount)))
qqplot(log_amount, expected, main = title)
qqline(log_amount, col = 'blue', distribution = qmy_distribution)
我想拥有car
包中qqPlot
提供的置信区间,但我不知道该怎么做。有没有办法提供我的自定义五分位数函数?
事实证明,您还需要提供一个密度函数:
log_amount = runif(100)
qmy_distribution = function(p) {
return(qnorm(p, fit$estimate[1], fit$estimate[2]))
}
dmy_distribution = function(p) {
return(dnorm(p, fit$estimate[1], fit$estimate[2]))
}
expected = qmy_distribution(ppoints(length(log_amount)))
qqPlot(log_amount, main = title, distribution = 'my_distribution',
xlab = 'Predicted Quantiles', ylab = 'Actual Quantiles')