如何在R中生成指数QQ图?

sto*_*hai 4 statistics r

如何在R中生成指数QQ图?对于我使用的普通QQ情节

qqnorm(sample)
Run Code Online (Sandbox Code Playgroud)

jlh*_*ard 7

编辑(反映@Dason的输入).

像这样:

set.seed(1)          # for reproducibility 
Z <- rexp(1000)      # random sample from exponential distribution
p <- ppoints(100)    # 100 equally spaced points on (0,1), excluding endpoints
q <- quantile(Z,p=p) # percentiles of the sample distribution
plot(qexp(p) ,q, main="Exponential Q-Q Plot",
     xlab="Theoretical Quantiles",ylab="Sample Quantiles")
qqline(q, distribution=qexp,col="blue", lty=2)
Run Code Online (Sandbox Code Playgroud)


Ram*_*ath 5

这是一个ggplot2解决方案.

Z <- rexp(1000, rate = 2)
library(MASS)
params <- as.list(fitdistr(Z, "exponential")$estimate)

library(ggplot2)
qplot(sample = Z, geom = 'blank') +
  stat_qq(distribution = qexp, dparams = params)
Run Code Online (Sandbox Code Playgroud)