-
Notifications
You must be signed in to change notification settings - Fork 10
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
Automatic simcf and tile #18
Comments
Hey Chris, I would like to start chipping away at this project -- would you mind posting/sending along one of your example helper functions so I can see what you've done in the past? Thanks, Mike |
I've uploaded two examples (with working code, data, and example pdf output; one for logit, and one for ordered probit) of how I do this here. There isn't much documented here in terms of what these data are, so let me know if you need background. |
Chris, Could you outline a bit more specifically what the counterfactuals should be for each type of covariate? Here I what I have: continuous: mean to mean + 1 SD (got it) cfChange(xscen, paste(s.clean), x = mean(data) + sd(data), scen=scen.num) compositional piles: to be honest, I'm not sure what a compositional pile is, or how hI would compare it's mean to a ratio-preserving counterfactural. Any info is appreciated. Thanks, |
On 2/28/12 8:24 AM, mikefree88 wrote:
yes
Not sure what "pile" means either. Suppose you have a three {% of population < 18 years, % of population>=18 or <65, % of pop >65} In any specific case, this will sum to a constraint, like 1.0 or 100. If three covariates (or two covariates and a reference category) are Chris
|
Quick question about defaults: to clarify, the xpost values should always be the same as the xpre values unless the variable is being simulated. For example, if there is a binary variable being simulated, we should set the xpre to 0 for all scenarios, and the xpost also be set to 0 for all scenarios except when evaluating the binary variable. I suppose that if the xpre is set to 0, we would want the xpost to be set to 0 as well unless we were evaluating the variable. I just wanted to double check. Thanks, Mike |
When I use simcf in my own work, I usually write a long helper function to which I pass my formula and data. The helper function looks through the formula, and then has a series of
if()
statements which check for each possible covariate that could appear in the model, and, if present, adds a new scenario for that covariate to the cf object. This gets complex if there are potentially interaction terms, so inside that if statement are sub-if()
statements which check for possible interactions. It also gets complex when there are categorical or compositional variables, which need to be set in logically consistent ways. In the end, this function basically is sorting all covariates into continuous, binary, categorical, ordered, and compositional piles, and creating appropriate first difference counterfactuals (repectively: mean to mean +1 sd, 0 to 1, mean to each category or baseline to each other category, mean composition to ratio-preserving counterfactual, etc.).We want a function which, given a formula and dataframe, and some tips on what is categorical, ordered, or compositional, does this automagically. When I do this for my own projects, I spend little time messing around with
cfChange()
code, which gets written for me.Once we have an automagic simcf function, writing automagic ropeladder code to go with it should be much easier. Indeed, the likely final call from a user, for a model with binary variables x1 and x3, continuous x2, and ordered x4, would be something like:
All this will be hard, but will be the core of our second release of tile+simcf to CRAN.
The text was updated successfully, but these errors were encountered: