konfound-project / konfound

R package for carrying out sensitivity analysis
https://konfound-it.org/konfound/
Other
15 stars 9 forks source link

Error in if (est_eff < 0) { : argument is of length zero #20

Closed tylcole closed 9 months ago

tylcole commented 5 years ago

Hmm, not sure how to interpret this error. Your package looks great, but I can't figure out how to get around this one:

glmStroke = glm(postOpStroke ~ Treatment, data = indexMsens)

Model made without a problem

summary(glmStroke)

Shows: Call: glm(formula = postOpStroke ~ Treatment, data = indexMsens)

Deviance Residuals: Min 1Q Median 3Q Max -0.02601 -0.02601 -0.01860 -0.01860 0.98140

(Intercept) 0.0186043 0.0009451 19.684 < 2e-16 *** TreatmentCEA 0.0074086 0.0013365 5.543 2.98e-08 ***

As expected, variable Treatment is highly significant.

Then I try

konfound(glmStroke, Treatment)

And I get:

Note that for a non-linear model, impact threshold should not be interpreted. Note that this output is calculated based on the correlation-based approach used in mkonfound() Error in if (est_eff < 0) { : argument is of length zero

These are the variables:

str(indexMsens$postOpStroke) num [1:48814] 0 0 0 0 0 1 0 0 0 0 ... str(indexMsens$Treatment) Factor w/ 2 levels "CAS","CEA": 1 2 1 1 2 2 1 2 2 1 ...

I've tried changing the variable type, glm model parameters, and nothing seems to work. An advice would be appreciated!

tylcole commented 5 years ago

And it seems to work when I put the data in manually: pkonfound(est_eff = 0.0074168, std_err = 0.8081445, n_obs = 48814, n_covariates = 1)