easystats / modelbased

:chart_with_upwards_trend: Estimate effects, contrasts and means based on statistical models
https://easystats.github.io/modelbased/
GNU General Public License v3.0
234 stars 19 forks source link

Estimate_expectation, Error: Predictions and standard errors are not of the same length. Please specify the `data` argument. #264

Open ManuelSpinola opened 1 month ago

ManuelSpinola commented 1 month ago

When I try estimate_expectation I got the following error:

m1_predict <- estimate_expectation(m1, data = rec_hex_6_03_df, type = "response")

Error: Predictions and standard errors are not of the same length. Please specify the data argument.

bwiernik commented 1 month ago

Can you provide a reproducible example ?

ManuelSpinola commented 1 month ago

Unfortunately, I can't reproduce the error with other dataset, like for example, mtcars.

ManuelSpinola commented 1 month ago

My newdata has NA, is that a problem?

bwiernik commented 1 month ago

Possibly, but it's very hard to diagnose an issue like this without having a reproducible example

ManuelSpinola commented 1 month ago

Thank you very much. I tried with data without NA and it works. Just to add information, I tried with the data with NA with predictions (marginaleeffects) and predict.glm (stats) and it works.