I'm having a bit of trouble using texreg to create output TeX files for multiple multinom models.
Let's use a version of this multionmial logit setup for concreteness:
library(foreign)
library(nnet)
library(data.table)
ml <- data.table(read.dta("http://www.ats.ucla.edu/stat/data/hsbdemo.dta"))
mnl<-lapply(c(model1="male",model2="female"),
function(x){multinom(prog ~ ses + write,
data = ml[female==x,])})
I want to create two tables: one for coefficients corresponding to "academic" and one corresponding to "vocation" (the third outcome of prog, "general", is omitted).
Basically, I don't know how separately access the levels from an nnet/multinom object, because I don't know where the coefficients are stored. If we just run texreg(mnl), we'll get a table with 4 columns:
model1 & model2 & NA & NA \\
What's worse, these columns are mislabeled--the actual order is
model1-academic, model1-vocation, model2-academic, model2-vocation
If I simply wanted a table of male and a table of female coefficients, I would simply run texreg(mnl["model1"]) and texreg(mnl["model2"]), but it's not clear how to split the coefficients by levels of prog.
How can I use texreg to get the two tables I want, which (skeletally) look like:
#TABLE 1: ACADEMIC
> cbind(male=coef(mnl[["model1"]])[1,],
+ female=coef(mnl[["model2"]])[1,])
male female
(Intercept) -3.23410968 -3.01401061
sesmiddle 1.15893835 0.17086744
seshigh 2.00007946 0.57690699
write 0.05464579 0.06598217
#TABLE 2: VOCATION
> cbind(male=coef(mnl[["model1"]])[2,],
+ female=coef(mnl[["model2"]])[2,])
male female
(Intercept) 3.69215046 1.57234796
sesmiddle 1.15573930 0.69043245
seshigh 0.67476976 -0.16955825
write -0.09640053 -0.03412729