bcgov / bcgov/ssdtools

Why does the inverse pareto distribution have a high likelihood for the Boron data compared to the default distributions?

Open
#397 0 comments 0 reactions 0 assignees View on GitHub
Difficulty: 3 Advanced Effort: 2 Medium Priority: 1 Critical Technical Committee :busts_in_silhouette: Type: Bug
Dominant language
R
Stars
39
Forks
21
Avg merge
9h 38m
Merged PRs (30d)
2

Description

``` r
library(ssdtools)

data <- ssddata::ccme_boron
k <- 2
n <- nrow(data)

fit <- ssd_fit_dists(data, dists = c("invpareto", "weibull"))
autoplot(fit)
```

![](https://i.imgur.com/HaLmUgl.png)

``` r

glance(fit)
#> # A tibble: 2 × 8
#> dist npars nobs log_lik aic aicc delta weight
#>
#> 1 invpareto 2 28 -116. 235. 236. 0 0.781
#> 2 weibull 2 28 -117. 238. 238. 2.54 0.219
logLik(fit)
#> invpareto weibull
#> -115.5439 -116.8126

AIC <- 2 * (k - logLik(fit))
AIC
#> invpareto weibull
#> 235.0879 237.6253

AICc <- AIC + (2 * k^2 + 2 * k) / (n - k - 1)
AICc
#> invpareto weibull
#> 235.5679 238.1053

coef <- coef(fit)
scale <- coef$est[coef$dist == "invpareto" & coef$term == "scale"]
shape <- coef$est[coef$dist == "invpareto" & coef$term == "shape"]

# as currently calculated by ssdtools
sum(log(shape) - shape*log(scale) + (shape+1)*log(data$Conc) - 2*log(data$Conc))
#> [1] -115.5439
```

Created on 2024-12-12 with [reprex v2.1.1](https://reprex.tidyverse.org)

Contributor guide

Open the contributing guide

Research direction

Reproduce the Boron example with ssd_fit_dists(data, dists = c("invpareto", "weibull")) and inspect the resulting glance(), logLik(), and coef() values. Trace how the invpareto likelihood and AIC/AICc are calculated, then compare those calculations with weibull. Done means explaining whether the higher invpareto likelihood is correct or identifying the calculation that needs correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.