4
A
回答
6
編輯(爲了體現@達誠的輸入)。
像這樣:
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)
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)
2
R具有qqplot
功能。 jlhoward做它「手動」並用quantile
函數計算數據的分位數。但在R你不需要這樣做。
set.seed(1)
data = rnorm(100, mean=5, sd=2)
qqplot(x=qexp(ppoints(100)), y=data, main="Exponential Q-Q Plot",
xlab="Theoretical Quantiles", ylab= "Your Data Quantiles")
qqline(data, distribution=qexp)
click here to see R Plot(我沒有10美譽張貼圖片)
我沒有看到的原因,爲什麼jlhoward只需要100點,但不會像1000中的數據在他的榜樣的長度。或者,也許這只是一個打字錯誤?
相關問題
- 1. R中的基本QQ圖
- 2. 調整R中QQ圖的邊界
- 3. 在R中生成數字
- 4. 如何生成與R中
- 5. r中的熱圖生成
- 6. 生成中的R點圖
- 7. 如何在R中自動生成線圖的圖例
- 8. qq繪製數據子集R
- 9. [R QQ積不顯示
- 10. 如何在Android中生成R文件
- 11. 如何使用裝箱數據生成R中的被子圖?
- 12. 在r中生成隨機圖
- 13. 在R中爲HG19生成基因圖
- 14. 在R中生成動畫彗星圖
- 15. 生成數據集R中
- 16. 生成r中
- 17. 如何生成,使用R
- 18. 包括LAMBDA在QQ圖
- 19. 在R中創建繪圖的數據生成數據
- 20. 在Matlab中生成指數隨機數
- 21. 如何在函數中指定列R
- 22. 生成與在r中
- 23. 在R中生成序列
- 24. 如何在由brms :: marginal_effects()生成的圖中指定y限制?
- 25. 如何在R中生成從數字到顏色的映射?
- 26. 如何在R中更快地生成隨機數字?
- 27. 如何在R中隨機生成缺失數據(MNAR)?
- 28. 如何在R中生成這樣的隨機數字
- 29. 如何在R中生成時間序列數據
- 30. 如何在R中生成一個「語言」對象數組?
生成指數分佈並使用'qqplot'。 –