1

I am trying to get PDF data points based on my data. It used to work until last night but I am getting awfully small numbers now. What am I doing wrong here?

dgumbel <- function(x,a,b){ # PDF
  exp((a - x)/b - exp((a - x)/b))/b
}

pgumbel <- function(q,a,b){ # CDF
  exp(-exp(-((q - a)/b)))
}
qgumbel <- function(p, a, b){ # quantile function
  a-b*log(-log(p))
}
gfit <- fitdist(year[,1], "gumbel", start=list(a=5, b=5), method="mle")
#year[1] is the dataset I will be using
para = rgumbel(500,gfit$estimate[1],gfit$estimate[2])
d<-dgumbel(para,gfit$estimate[1],gfit$estimate[2])

However, if I used qgumbel instead of dgumbel on the last line, I do get a CDF (which is close enough). CDF is helpful, but I wish to get the PDF data points. Edit: I am doing rgumbel because the dataset is a fairly small one, hence I wish to smoothen the curve by producing 500 points.

Note:

  • PDF - probability density function

  • CDF - cumulative distribution function

user116922
  • 51
  • 5

0 Answers0