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

x0 required for a glm with single predictor #41

Open
EMG83 opened this issue Dec 3, 2018 · 2 comments
Open

x0 required for a glm with single predictor #41

EMG83 opened this issue Dec 3, 2018 · 2 comments

Comments

@EMG83
Copy link

EMG83 commented Dec 3, 2018

Trying a very simple use of "invest" exactly as it is outlined in the documentation to get an LD50 and 95% CI, but am getting errors that additional arguments are needed:

Error in invest.glm(MOD_INJ.20, y0 = 0.5) :
'x0.name' is missing, please select a valid predictor variable
In addition: Warning messages:
1: In min(.data[, x0.name]) :
no non-missing arguments to min; returning Inf
2: In max(.data[, x0.name]) :
no non-missing arguments to max; returning -Inf

Built the glm with the following code, and data is attached:
MOD_INJ.20 <- glm(INJ.20~LNTREAT, family=binomial(link=logit))
INJ_14DAT_ALLAVG_LOGIT.txt

@bgreenwell
Copy link
Owner

That's a weird error, but I suspect it is because invest() does not know how to extract the raw data from your fitted model. You have two options: (1) refit the model with the data = <data-name> argument, or (2) supply the data via the data argument in invest():

invest(MOD_INJ.20, y0 = 0.5, data = df)
# estimate    lower    upper 
# 4.453411 4.201361 4.707759

@bgreenwell
Copy link
Owner

I'll leave this issue open so I can hopefully improve the code to provide a more informative error message!

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