Closed agmath closed 4 weeks ago
Thanks for the report and reproducible example!
I'll do a deep dive soon, but at first glance, I'm 94% sure this is an innocuous indexing error. In all likelihood, slopes are evaluated at the actually observed x
values, and the only thing wrong is values in the x
column of the output, not the estimate
.
I'll confirm as soon as possible with a fix.
FWIW, the problem is probably in methods_tidymodels.R
and get_predict.model_fit()
.
I agree with this -- the estimated slopes seem to be evaluated at the actually observed x
values. I'm happy to look through the get_predict.model_fit()
method in the methods_tidymodels.R
script. If I find anything before you do, I'll submit a pull request.
Thanks for pointing me in the right direction!
Sounds fantastic (no pressure)! I really appreciate you taking the time to craft a reproducible example and look at the code.
Thanks again for the report. Should be fixed in Github main
now.
Thank you! I really appreciate it.
On Sat, Oct 5, 2024 at 8:26 AM Vincent Arel-Bundock < @.***> wrote:
Thanks again for the report. Should be fixed in Github main now.
— Reply to this email directly, view it on GitHub https://github.com/vincentarelbundock/marginaleffects/issues/1209#issuecomment-2395040589, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZ3ZP2FPBLAI6BN5AYQHIDZZ7LF3AVCNFSM6AAAAABNOJ6XEGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGA2DANJYHE . You are receiving this because you authored the thread.Message ID: @.***>
-- Adam Gilbert, PhD Associate Professor of Mathematics Southern New Hampshire University
I am enjoying this package. Thank you for developing and maintaining it!
When using the
slopes()
function with a model created using the{tidymodels}
framework, it seems that the variable column of the resulting data frame contains only the first observed value of that variable -- the column is constant. I would expect that column to contain the observed values of the variable as in the data frame passed asnewdata
. This is in fact the behavior when using base-R'slm()
directly.Below is a reproducible example. I hope it is appropriate. The column in question is the
x
column of themfx
data frame. I'm currently "fixing" this by mutating the original column of themy_data
data frame back ontomfx
.Thank you for any help or guidance you can provide!
Created on 2024-08-31 with reprex v2.1.0