chrisadolph / tile-simcf

R packages for visualizing statistical models, with tools for counterfactual simulation
faculty.washington.edu/cadolph/software
13 stars 10 forks source link

cfMake and cfChange should be able to handle multi-equation models #6

Open chrisadolph opened 12 years ago

chrisadolph commented 12 years ago

The simplest way, I think, would be to allow for vectors of dataframes and/or vectors of formulas in cf objects. For example, if we wanted a zero-inflated model simulator, we would only need one dataframe, but we need two formulas, one from each stage. But for a hierarchical simulator, we would want two data frames and two formulas. Although we don't have support for these models yet, we'll need this capacity for future extensions.

aserlich commented 12 years ago

Hi Chris -- I met with Carolina this afternoon and we had a productive session. I think I have done this for the hurdle models but not yet for multilevel models. Could you have a look at my approach and make sure I am doing this in a sensible way. Basically, the cfMake needs to distinguish between three types of options. The code is here: https://github.com/aserlich/tile-simcf/blob/master/simcf/R/cfset.R

This code shows how it minimally works...

data <- UScrime
data$Prob[1] <- 0 #add a logit bounded variable
model <- (y ~ log(M) + So + log(Ed) + log(Po1) + log(Po2)
              + log(LF) + log(M.F) + log(Pop) + log(NW) +log(U1)
              + log(U2) + log(GDP) + log(Ineq) + logitBound(Prob) +
              log(Time))

model1 <- (y ~ log(M) + So)
model2 <- (y ~ logitBound(Prob) + So)

znb <- list(model1, model2)
cfMake(formula = model, data = data)
cfMake(formula = znb , data = data)
aserlich commented 12 years ago

CfMake has a “hull” option. However, it is currently not in the helpful and doesn’t appear to be working properly. Could you tells us what if anything you want done with that.

aserlich commented 12 years ago

Hi Chris,

I have now implemented hierarchical models in cfMake. Before I change cfSet, I want to make sure I am on the right track. Are you getting these messages?

testfile is: https://github.com/aserlich/tile-simcf/blob/master/testcfMake.r code file is: https://github.com/aserlich/tile-simcf/blob/master/simcf/R/cfset.R