簡體   English   中英

如何為 r 中的指數分布生成估計參數(標准差和均值)?

[英]How to generate the estimate parameters (Standard deviation and mean) for an exponential distribution in r?

例如:

#Using QQ-plots to decide which of the Normal, Gumbel and Exponential distribution best fits Qc
qqplot(x=qexp(ppoints(length(data$Qc))), y=data$Qc, main="Exponential Q-Q Plot",
       xlab="Theoretical Quantiles", ylab= "Data Quantiles")
qqplot(x=qnorm(ppoints(length(data$Qc))), y=data$Qc, main="Normal Q-Q Plot",
       xlab="Theoretical Quantiles", ylab= "Data Quantiles")
qqplot(x=qgumbel(ppoints(length(data$Qc))), y=data$Qc, main="Gumbel Q-Q Plot",
       xlab="Theoretical Quantiles", ylab= "Data Quantiles"

在假設我認為正態/指數分布是適合我的變量的好模型之后,如何生成正態分布或指數分布的估計參數(即標准偏差和平均值)?

指數的

MASS::fitdistr(Qc, dexp, start = list(rate = 0.1))
## 0.0338
## however, the maximum likelihood estimate of the exponential rate parameter
##  is just 1/mean(x):
(r <- 1/mean(Qc))
## 0.0338
pexp(30, rate = r, lower.tail = FALSE)  ## 0.362

普通的

樣本均值和樣本標准差可以很好地估計 Normal 的均值和 SD 參數(盡管如果我們真的想使用fitdistr可以使用):

MASS::fitdistr(Qc, dnorm, start = list(mean = 25, sd = 7))
pnorm(30, mean = mean(Qc), sd = sd(Qc), lower.tail = FALSE)  ## 0.473

貢貝爾

library(fitdistrplus)
library(VGAM)
fitdist(Qc, "gumbel", start = list(location = 25, scale = 1)) 
pgumbel(30, location = 27.03, scale = 7.56, lower.tail = FALSE) ## 0.491

經驗

我們可以計算觀察到的值 > 30 的概率:

mean(Qc>30)  ## 0.469

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM