-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Hi,
the autoReg function throws an error when the model is of the form:
glm(y ~ x1 + x2, weights = w, data=data, family='binomial')
The error being:
Error in map():
ℹ In index: 1.
Caused by error in model.frame.default():
! 'data' must be a data.frame, environment, or list
Run rlang::last_trace() to see where the error occurred.
-
After digging deeper, the issue seems to stem from the function: fit2model, about line 77
dataname = as.character(fit$call)[length(as.character(fit$call))]
What happens is that, if you incorporate sample weights into the model, it appears as the last object in fit$call, and therefore dataname gets a vector of weights instead of the dataset used in fitting the model. -
Another the issue seems to be coming from fit2list, as it fits a lm/glm model in about line 18, 21-22, with only, formula, data and family being parameters, there should probably be a
...so that extra parameters e.g weights are incorporated.