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

Check correctness GAM output #52

Open
damianooldoni opened this issue Dec 23, 2019 · 1 comment
Open

Check correctness GAM output #52

damianooldoni opened this issue Dec 23, 2019 · 1 comment
Assignees
Labels

Comments

@damianooldoni
Copy link
Collaborator

damianooldoni commented Dec 23, 2019

I am writing unit-tests for the in-development function apply_gam, based on function defined in modelling pipeline, which on its turn has been developed from a function of @ToonVanDaele.

@ToonVanDaele: could you please check basic GAM of this dummy data, please?

# dummy data
df_gam <- data.frame(
  taxonKey = rep(2224970, 19),
  canonicalName = rep("Palaemon macrodactylus", 19),
  year = seq(2001, 2019),
  n_observations = c(1, 5, 8, 12, 18, 23, 30, 40, 60, 40, 20, 10, 1, 
                     3, 10, 20, 35, 50, 80),
  stringsAsFactors = FALSE
)

# define evaluation year(s)
evaluation_year <- 2018

# apply function without any baseline correction
basic_gam <- apply_gam(df = df_gam,
                       y_var = "n_observations",
                       eval_years = evaluation_year)

I get these values for the minimal guaranteed growth, i.e. model$family$linkinv(lower):

> basic_gam$output$growth
 [1] 1.7777714 1.6977409 1.6088981 1.4940603 1.3330764 1.1393911 0.9689625 0.8451249
 [9] 0.7635014 0.7126579 0.6854127 0.6902043 0.7421756 0.8565297 1.0434188 1.2814552
[17] 1.5424851 1.8369261 2.1775717

which I find strange if we see the output graph:
image

I would expect a negative first derivative when not emerging (green dots) and a negative lower CI value of it as well. @ToonVanDaele : what do you think about? Do you find it strange as well?
If yes, could you please check results using your code?
If no, could you explain me why is it not strange?

@damianooldoni
Copy link
Collaborator Author

@ToonVanDaele, now that i pushed everything to master, you can test this by using standard devtools::install_github("trias-project/trias"). Thanks.

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

No branches or pull requests

2 participants