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

Call to geepack::geeglm causes code to hang and requires termination of R #21

Open
svteichman opened this issue Mar 27, 2024 · 2 comments

Comments

@svteichman
Copy link

Hello!

We are using your package as a dependency for our package enviromtx and have run into a few instances in which calling geeglm() results in code hanging. It appears to be occurring in the call to geese.fit(), specifically in the line that calls a C++ library ans <- .Call("gee_rap", y, x, offset, soffset, weights, linkwaves, zsca, zcor, corp, clusz, geestr, corr, param, control, PACKAGE = "geepack"). Running geeglm() with the trace argument shows that in these examples, the beta values get very large, gamma and alpha both become nan, and then there appears to be some kind of infinite loop. I’m wondering if there is a way to have one of these functions return an error when this happens instead of needing to terminate the R session.

An example of data in which this happens is the following:

hang_df <- read.csv("hang_df.csv")
geepack::geeglm(formula = yy ~ predictor + temp, offset = log(hang_df$xx),
                family = stats::poisson(link = "log"),
                id = rep(1:10, each = 3), data = hang_df, corstr = "exchangeable",
                std.err = "jack",
                control = geepack::geese.control(trace = TRUE))

hang_df.csv
geeglm_trace

@ekstroem
Copy link
Collaborator

Could we get you to try it out with the geeasy package? It should hopefully perform slightly better

@svteichman
Copy link
Author

Thanks for your quick response, I gave geeasy a try, and it gives me error messages for these examples when it runs into a matrix it can't invert in update_beta, which is helpful.

We are using jackknife standard errors and from a quick review of the geeasy reference manual it seems that that isn't implemented in this package. Is that the case? Even if so, I imagine that we could use geeasy to see if the algorithm will converge, and then if so we can use geepack to get estimates and jackknife standard errors.

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

2 participants