Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update0.3 #28

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open

Update0.3 #28

wants to merge 61 commits into from

Conversation

shawndove
Copy link
Collaborator

Calculate and plot confidence intervals for all indicators

shawndove and others added 30 commits September 5, 2024 15:28
@wlangera
Copy link
Collaborator

Hi Shawn

We are still developing the bootstrapping framework.
My earlier functions did not bootstrap on the complete dataset (the cube) but only on the aggregated one.
Did you bootstrap on the complete dataset or on aggregated datasets?
We are now creating function that bootstrap on the complete dataset in this repo. Once we have tested the functions, we will move them to the dubicube package here.

I have tested one example:

denmark_cube <- process_cube(
  system.file("extdata", "denmark_mammals_cube_eqdgc.csv", package="b3gbi"))
denmark_observed_richness_ts <- obs_richness_ts(
  example_cube_1, first_year = 1980, level = "country", region = "Denmark") 
plot(denmark_observed_richness_ts)

I notice that the indicator value is each time lower than the lower confidence limit.
This seems strange.

I still see you plot the uncertainty around the loess smoother. This uncertainty is not correct and can be dropped se = FALSE.

Should we discuss this in december?

@shawndove
Copy link
Collaborator Author

Hi Shawn

We are still developing the bootstrapping framework. My earlier functions did not bootstrap on the complete dataset (the cube) but only on the aggregated one. Did you bootstrap on the complete dataset or on aggregated datasets?

What is bootstrapped depends on the indicator. Observed richness bootstraps all occurrences. But in some other cases it would be inefficient to do so.

We are now creating function that bootstrap on the complete dataset in this repo. Once we have tested the functions, we will move them to the dubicube package here.

I have tested one example:

denmark_cube <- process_cube(
  system.file("extdata", "denmark_mammals_cube_eqdgc.csv", package="b3gbi"))
denmark_observed_richness_ts <- obs_richness_ts(
  example_cube_1, first_year = 1980, level = "country", region = "Denmark") 
plot(denmark_observed_richness_ts)

I notice that the indicator value is each time lower than the lower confidence limit. This seems strange.

Yes, there are two indicators where the confidence intervals do not work quite right, and observed richness is one of them. Richness is tricky because when you sample with replacement the richness is reduced. So there is bias in the confidence intervals. Some methods in the boot package create CIs that are too low, others overcorrect the bias and make it too high. I am still trying to work out what to do about it.

I still see you plot the uncertainty around the loess smoother. This uncertainty is not correct and can be dropped se = FALSE.

I am not clear on why this is incorrect? It is meant to be the uncertainty around the trend.

Should we discuss this in december?

Yes, good idea.

@wlangera
Copy link
Collaborator

Ok, let's discuss it then

It is meant to be the uncertainty around the trend.

Yes, the intention is good, but it does not take into account the uncertainty on the indicators.
It only uses the indicator values.

Copy link
Collaborator

@wlangera wlangera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work.
As discussed online, 2 changes are requested:

  1. visualising uncertainty for plot_ts(), see PR 0.3plot timeseries #30. We can discuss this further in this PR
  2. remove bootstrapping for indicators where it does not work (e.g. species richness)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants