raff-k / RainSlide

Rainfall-induced landslide analysis tools
GNU General Public License v3.0
3 stars 0 forks source link

Descriptions of the functions #3

Open ernesto561 opened 1 year ago

ernesto561 commented 1 year ago

Thanks for this package. It's a nice implementation of the code of Melillo et al (2018) and it's particularly useful if different values of parameters like the exceedance probability need to be tested, instead of the ones that are hardcoded.

I think there are some issues related to the documentation:

I have also a question. From what I understand, the only difference with the CTRL-T code is that I need to manually associate the landslides to the rainfall records, because coordinates are not an input of the functions. Is this correct?

raff-k commented 1 year ago
ernesto561 commented 1 year ago

Thanks for the update in the documentation! I don't know if you will do it later, but the documentation for the values returned by RainSlide::thresh are still the same that the ones from RainSlide::event.

Probably this will be solved when the documentation is updated, but I don't know if I have to take the alpha and gamma values or the boot$alpha$mean and boot$gamma$mean values. In any case, shouldn't be the boot$alpha$mean and alpha values the same? This is for the case that use.bootMedian = FALSE. In my test these values are different, but maybe I am missing something.

raff-k commented 1 year ago

Thanks again, I updated the documentation.

Bootstrapping is mainly to get the uncertainty bands around the alpha value. boot$alpha$mean and alpha are probably never exact identical, but approximately so if one uses a large number of bootstrap replicates (R). However, be generally careful if boot$alpha$mean and alpha differ greatly from each other (e.g., due to strange outlier), then also check use.bootMedian.

Please note the comment below regarding boot$alpha$mean

raff-k commented 1 year ago

But I see the confusion here. Actually, alpha is subtracted by sigma.coef * m.PDF.sigma (shift of intercept) and boot$alpha$mean is not (this is the pure result from the bootstrapping). I added now a shift for the bootstrapped median (boot$alpha$q50_sigma) and mean (boot$alpha$mean_sigma). Thus, boot$alpha$mean_sigma should fit with alpha.

Btw, in .$data one can find the fit, andlower and upper uncertainty bands. Using plot(object of RainSlide::thresh ) creates a ggplot-result.

ernesto561 commented 1 year ago

Thanks for your answer. I was confused. It seems that alpha and gamma are calculated without bootstrapping. If bootstrapping=TRUE, the corresponding alpha and gamma values are in "boot". Let me know if this is correct:

Output from thresh

Value

A list of 10 elements containing threshold metrics and settings

data: A data frame with the independent variable (Re, intensity or cumulated rainfall), duration of the rainfall events (De), frequentist probability for each point if the method used is LS or QR (fprob), fit value of the threshold for the selected non-exceedance probability level without bootstrapping (fit), lower and upper uncertainty bands if bootstrapping=TRUE (upper and lower) and difference between the real and fitted values (delta, Re-fit). If method = "LS" or "QR", Re and D will be shown log transformed.

alpha: alpha value without bootstrapping

gamma: gamma value without bootstrapping

t: t value if NLS method is used (see Rossi et al. 2017).

model: fitted model for the data without bootstraping

dens: if use.normal=TRUE, fitting of the residual to a normal distribution, otherwise NULL.

sigma: estimated standard error

fun: threshold function used

setting: settings used by the function

boot: if bootstrapping=TRUE, statistics for the alpha and gamma values will be shown here

I don't know if I am wrong, but I think boot$alpha$mean_sigma should not necessary fit with alpha, because the first one is the product of bootstraping and the other not. It's ok as long as it's stated in the documentation.

I have another question about the implementation, but I think I should open another issue. Thanks again.

raff-k commented 1 year ago

boot$alpha$mean_sigma and alpha should be in the same order of magnitude, not exact identical. But, good summary :-) I should put it into the documentary ;-)