bcgov / bcgov/ssdtools

Use of weighted results in surprising behaviour in the estimate

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

Description

``` r
library(ssdtools)
#> Please replace the following in your scripts:
#> - `ssdtools::boron_data` with `ssddata::ccme_boron`
#> - `ssdtools::ccme_data` with `ssddata::ccme_data`
library(ssddata)

data <- ssddata::ccme_boron

data$Weight <- 1
data$Weight[rank(data$Conc) > 6] <- 1/10

fitall <- ssd_fit_dists(data, dists="lnorm")
ssd_hc(fitall)
#> # A tibble: 1 × 10
#> dist percent est se lcl ucl wt method nboot pboot
#>
#> 1 average 5 1.68 NA NA NA 1 parametric 0 NA

fit1 <- ssd_fit_dists(subset(data, Weight == 1), dists="lnorm")
ssd_hc(fit1)
#> # A tibble: 1 × 10
#> dist percent est se lcl ucl wt method nboot pboot
#>
#> 1 average 5 1.04 NA NA NA 1 parametric 0 NA

fit1w <- ssd_fit_dists(subset(data, Weight == 1), dists="lnorm", weight = "Weight")
ssd_hc(fit1w)
#> # A tibble: 1 × 10
#> dist percent est se lcl ucl wt method nboot pboot
#>
#> 1 average 5 1.04 NA NA NA 1 parametric 0 NA

fitallw10 <- ssd_fit_dists(data, dists="lnorm", weight = "Weight")
ssd_hc(fitallw10)
#> # A tibble: 1 × 10
#> dist percent est se lcl ucl wt method nboot pboot
#>
#> 1 average 5 0.547 NA NA NA 1 parametric 0 NA
```

Created on 2024-01-22 with [reprex v2.1.0](https://reprex.tidyverse.org)

Contributor guide

Open the contributing guide

Research direction

Reproduce the example using ssddata::ccme_boron, ssd_fit_dists(), and ssd_hc(), comparing weighted and unweighted results. Read the fitting and estimate entry points to determine whether the differing estimates are expected; done means the weighted behavior is clarified or corrected and covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
analytics, 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.