I ploted a Kolmogorov-Smirnov test of weather data, using a Gumbel fit.
ks.gumbel(data$mm, 63.2899, 30.06080, alternative = "two.sided", plot = TRUE)
And I want to get the x value of the curve ploted in y=0.996.
Any ideas? thanks !
I ploted a Kolmogorov-Smirnov test of weather data, using a Gumbel fit.
ks.gumbel(data$mm, 63.2899, 30.06080, alternative = "two.sided", plot = TRUE)
And I want to get the x value of the curve ploted in y=0.996.
Any ideas? thanks !
Looking at the source code for ks.gumbel
, the plot is generated by plot(ecdf(x))
, but no value from the plot is returned from the function. So it will be impossible to get the information you seek directly from ks.gumbel
, but we do know enough to be able to get in ourselves.
Using an answer at https://stackoverflow.com/a/16819127/1017276 and combining this knowledge with uniroot
, we can solve the function returned by ecdf
to return the value of x
at the desired value of y
.
uniroot(f = function(x) ecdf(data$mm)(v = x) - .996,
interval = range(data$mm, na.rm = TRUE))
The root
element of the list returned by uniroot
will give you the value you are looking for.