-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Predict auxiliary parameters: estimate_parameters() / "what" argument? #287
Conversation
But isn't it overkill to add a function for that? Isn't it better to add a dpar-like argument to estimate_predictions? |
Where do we currently have prediction of a group-level random slope (if anywhere)? |
estimate_grouplevel()? https://github.com/easystats/modelbased/blob/main/R/estimate_grouplevel.R |
I have no strong opinion here, I thought it was what you had in mind (based on your issue title). We can just do nothing, because |
I'm leaning for option 2, but not sure about the best name. We have |
How about we merge this function and grouplevel into one? I kind of like that estimate_prediction() and estimate_expectation() are specifically for outcome values vs underlying model parameters |
|
estimate_grouplevel() stays the same, it is for extraction directly the random effects. Here it's mostly about estimating predicted parameter values (including over random levels) at a datagrid (so not directly the "effects" per se).
Not a big fan of |
It stands for Distributional PARrameter (: |
Yes, we could add it to
I think it's better to have an argument here in modelbased, and then pass So I would vote for:
|
For contrasts, we can use the This is quite a tedious work to implement, I guess. But this is an important feature, else the returned output can become very long. Thus, I would switch to marginaleffects as default when we have implemented the functionality for the |
This is why I think it would be better to put the parameter estimation in a separate function. Invoking dpar inherently means we are asking for confidence intervals on the distributional parameter. It's a different estimand from relation/expectation/prediction (which are all about the outcome variable). |
Although I do agree that it's an important conceptual difference, I think from a user-perspective it works to get these using the other functions. Like I guess what I'm saying is that keeping with the currently existing API and introducing a new argument instead of a new function would retain its intuitiveness (but yes, we should then document that if |
We don't have a Option a) allows us to estimate distributional parameters for |
Mmh would it conceptually make sense to add the option directly to Because this argument already changes both the transformation + the nature of CIs etc. so it would make sense to use that to predict other distributional parameters? |
But then we need to include all possible options for |
Yeah that's an issue. We could dispatch any value that is not in our main list to One option would be to run for instance This would currently mostly apply to |
Ok, added to insight: easystats/insight#988 |
Now that easystats/insight#988, it should work for estimate_prediction etc., we just need to add & dispatch |
Yes, we need to decide a) if we want an additional argument (and if so, which name), or, like Brenton suggested and implemented in this PR, b) have an extra function. |
since it's now handled by |
One counter argument would be that I have no strong preference here, but if the all the existing function only differ in their default values for arguments, why not just have one integrated function? On the other hand, to make it work with marginaleffects / emmeans, we need to pass hm... |
estimate_relation(), estimate_expectation() are indeed "aliases" of specific parameters of Basically, predicting other dpars is not orthogonal to the goal of Hence conceptually I think varying what dpar is predicted fits more as an argument to existing functions rather than a separate function |
That sounds reasonable. |
But... the |
.estimate_predicted(
model,
data = data,
ci = ci,
keep_iterations = keep_iterations,
predict = predict,
...
)
.estimate_predicted(
model,
data = "grid",
ci = ci,
keep_iterations = keep_iterations,
predict = predict,
...
) |
We have to set the default for |
The column name should be a mix of the parameter's name and the point estimate we're using - "nu_median", "sigma_mean", "phi_MAP", etc... |
Can we set the centrality somewhere in marginaleffects? Or do we have any information on whether Median, Mean etc. are returned? |
Just realized that adding a new function would have been less effort. :-) When tests pass, I would merge this PR and then open a new one for the remaining details. |
btw, @DominiqueMakowski, should we remove the aliases
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #287 +/- ##
==========================================
+ Coverage 37.22% 42.15% +4.93%
==========================================
Files 27 27
Lines 1209 1383 +174
==========================================
+ Hits 450 583 +133
- Misses 759 800 +41 ☔ View full report in Codecov by Sentry. |
Not sure about |
So I would pass the result from |
"Sigma" Not sure about adding the point estimate, not a fan of it aesthetically and we don't do it elsewhere (i.E., we still write "Mean" fro marginal means when the point estimate is median) |
The |
Yes, I think so. |
@DominiqueMakowski I think for version 1.0.0, most/all of these should be fixed, if possible. I see most issues with plotting, would be nice if we can fix plotting, as this seems to be an essential feature to me: And we should definitely fix the printing for contrasts using marginaleffects, else we cannot filter using modelbased/R/estimate_contrasts.R Lines 188 to 236 in 26a4620
|
Fixes #286