I am trying to get the inverse of cdf and use it for the QQ plot as follows.
cdf<-function(x,b){
1 - (1+(b*x*(b*x+2)/(b^2+2)))*exp(-b*x)
}
qf<-function(p,b){
uniroot(function(x) cdf(x,b) - p, lower=0, upper=1000)[1]
}
DATA1<-c(14, 13, 19, 22, 11,17)
dakash <- function(x,b) (b^3/(b^2+2))*(1+x^2)*exp(-b*x)
pakash <- function(q,b) (1 - (1+(b*q*((b*q)+2)/(b^{2}+2)))*exp(-b*q))
qakash <- function(p,b) qf(p,b)
fitgumbel <- fitdist(DATA1, "akash", start=list(b=5))
qqcomp(list(fitgumbel),legendtext=c("akash"))
But I get the following error.
Error in uniroot(function(x) cdf(x, b) - p, lower = 0, upper = 1, extendInt = "yes") : f() values at end points not of opposite sign
Please anyone can help me? Thank you in advance.
I need to plot Q-Q plot Empirical quantiles vs Theoretical quantiles.
You need to ensure that the parameter
bis strictly positive. An easy way of doing that is the substitutionb = exp(beta):