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

note for myself: deviance values #3

Closed
pachadotdev opened this issue Jul 19, 2024 · 1 comment
Closed

note for myself: deviance values #3

pachadotdev opened this issue Jul 19, 2024 · 1 comment

Comments

@pachadotdev
Copy link
Owner

pachadotdev commented Jul 19, 2024

https://github.com/pachadotdev/capybara/blob/reducebackandforth/ uses the same underlying functions as https://github.com/pachadotdev/capybara/blob/main

the differences are

  1. instead of doing R -> C++ -> R -> C++ -> R ... -> R it does R -> C++ -> R
  2. I had to implement my own function for the deviance and link

the tests in https://github.com/pachadotdev/capybara/blob/reducebackandforth/tests/testthat/test-fepoisson.R#L2 https://github.com/pachadotdev/capybara/blob/reducebackandforth/tests/testthat/test-fepoisson.R#L7 https://github.com/pachadotdev/capybara/blob/reducebackandforth/tests/testthat/test-fepoisson.R#L12 give the same results as main

the problem is here

https://github.com/pachadotdev/capybara/blob/reducebackandforth/src/05_glm_fit.cpp#L248

output:

iter: 0
dev: 1.15908e+08
iter: 1
dev: 1.12655e+20

adding a print statement in https://github.com/pachadotdev/capybara/blob/main/R/internals.R#L66 returns this for the same model

[1] "iter: 1"
[1] "dev: 119812197.425158"
[1] "iter: 2"
[1] "dev: 61981346.125582"
[1] "iter: 12"
[1] "dev: 4265228.57183159"

I need to check the deviance https://github.com/pachadotdev/capybara/blob/reducebackandforth/src/05_glm_fit.cpp#L77

curious thing: felm(), which is just a wrapper for feglm() with a Gaussian link, works ok so the problem must be the transformed values

@pachadotdev
Copy link
Owner Author

fixed in 7fe44d0

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

No branches or pull requests

1 participant