[R] Fw: Fitting GUMBEL Distribution - CDF function and P P Plot
Maithili Shiva
maithili_shiva at yahoo.com
Mon Mar 16 06:30:17 CET 2009
Dera R Helpers,
I am re-posting my query.
Please guide me.
Maithili
--- On Fri, 3/13/09, Maithili Shiva <maithili_shiva at yahoo.com> wrote:
I am trying to fit the Gumbel distribution to a data. I am
using lmom package. I am getting problem in Cumulative
Distribution Function of Gumbel distribution as I am getting
it as a series of 0's and 1's thereby affecting the
P P Plot. My R code is as follows.
library(quantreg)
library(RODBC)
library(MASS)
library(actuar)
library(lmom)
x <-
c(986.78,1067.76,1046.47,1034.71,1004.53,1007.89,964.94,1060.24,1188.07,1085.63,988.33,972.71,1177.71,972.48,1203.20,1047.27,1062.95,1113.65,995.97,1093.98)
#Estimating the parameters for GUMBEL distribution
N <- length(x)
lmom <- samlmu(x); lmom
parameters_of_GUMBEL <- pelgum(lmom); parameters_of_GUMBEL
# Parameters are xi = 1019.4003 alpha = 59.5327
# _____________________ P - P Plot ________________________
e <- c(1:N)
f <- c((e-.5)/N)
Fx <- cdfgum(x, para = parameters_of_GUMBEL)
g <- sort(Fx)
png(filename = "GUMBEL_P-P.png")
a <- par('bg'= "#FFFFCC")
plot (f,g,bg=a,fg= "#804000",main ="P-P
Plot", ylab=" Cumulative Distribution
Function", xlab="i", font.main=2,
cex.main=1,col="#999966",bty =
"o",col.main="black",col.axis="black",col.lab
="black")
abline(rq(g ~ f, tau = .5),col="red")
dev.off()
# Fx RETURNS 0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 1 1 0 1
and Thus plot is not proper
Please guide me as where I am going wrong.
With regards
Maithili
More information about the R-help
mailing list