You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
marginal means when we have categorical variables
evaluating margins at predefine population distributions or survey distributions
marginal means for balanced sample if actual estimation sample is unbalance
Similar to DiscreteMargins and wald_anova with emphasis on categorical explanatory variables
SAS has LSMEANS (IIRC), in Stata large parts are in contrats, but also in margins and predict
I never worked with examples for this, but it looks pretty important based on SAS and Stata documentation.
@kshedden If you, or same for anyone else, have examples and use cases for this, it would be helpful to get more specific enhancement plans to get started with this.
If nobody needs it, then it will go under "things that we will need - eventually" because Stata and SAS spend many pages of documentation on it.
This is a notebook I recently used for a workshop I taught, cell 21 is the
way I get a certain type of plot that I frequently need. It would be nice
to have a convenience method to do most of the work here.
We need to outsource from margin and predict helper functions that allow us to create the various exog_at, exog values where we want to evaluate.
This is part that is most specific to this issue.
ones we have a desired exog, then predict or similar can take over. In your example, you used linear prediction, for which we could currently get the confidence intervals via t_test
e.g. something like
tt = result9.t_test(dexog)
ci = tt.conf_int(alpha='0.05')
but the link and the general nonlinear version are not yet available. (nonlinear links for GLM will be in #2151)
Instead, Stata (and some econometrics books) emphasize the average effect.
It's not relevant for the linear prediction, but for the predicted probabilities, we would have the average effect different from the effect at the average.
in example: predict "age curve" for every lwt in the population, and then calculate the average "age curve"
(that would be the analogous to the "overall=True" in Margins, IIUC.)
The average effect over categories would assume some fractions/distribution of race and of the binary explanatory variables.
Activity
josef-pkt commentedon Jan 8, 2015
@kshedden If you, or same for anyone else, have examples and use cases for this, it would be helpful to get more specific enhancement plans to get started with this.
If nobody needs it, then it will go under "things that we will need - eventually" because Stata and SAS spend many pages of documentation on it.
kshedden commentedon Jan 9, 2015
This is a notebook I recently used for a workshop I taught, cell 21 is the
way I get a certain type of plot that I frequently need. It would be nice
to have a convenience method to do most of the work here.
http://nbviewer.ipython.org/urls/umich.box.com/shared/static/20nyq9kap75rhet9eujh.ipynb
On Thu, Jan 8, 2015 at 3:45 PM, Josef Perktold [email protected]
wrote:
josef-pkt commentedon Jan 9, 2015
Thanks for the example:
2 parts
exog_at, exog values where we want to evaluate.This is part that is most specific to this issue.
t_teste.g. something like
but the link and the general nonlinear version are not yet available. (nonlinear links for GLM will be in #2151)
josef-pkt commentedon Jan 9, 2015
followup, average effect versus effect at a average (or specific exog):
in cell 21, you fix other exog variables, e.g.
which then implies an affect at the average.
Instead, Stata (and some econometrics books) emphasize the average effect.
It's not relevant for the linear prediction, but for the predicted probabilities, we would have the average effect different from the effect at the average.
in example: predict "age curve" for every
lwtin the population, and then calculate the average "age curve"(that would be the analogous to the
"overall=True"in Margins, IIUC.)The average effect over categories would assume some fractions/distribution of race and of the binary explanatory variables.
josef-pkt commentedon Sep 24, 2015
I just found lsmeans in R by chance
https://cran.r-project.org/web/packages/lsmeans/index.html
(I didn't read it yet, first example in vignette is to construct average + categorical exog for predict)
cross link #2294 another average effect issue