When I run the multinom()
function in R, the number of variables in the result is very big while I only have a few predictor variables in the formula. Can anyone explain to me why this is happening and how can I resolve it? (mv_daily
only takes 0 and 1, icu_loc
takes 0,1,2 in the data.)
I tried 3 predictor variables and the number of variables in the result increased to 1230! The program takes each distinct value of a predictor variable as a different variable in the results and gives it a different coefficient.
newdata2 <- read.csv("~/Desktop/input_multinom_reg_March9_csv.csv")
library(nnet)
test <- multinom(state_tomorrow ~ mv_daily + icu_loc, newdata2,maxit=400,MaxNWts=2000)
Results:
Call:
multinom(formula = state_tomorrow ~ mv_day2 + icu_loc, data = newdata2,
maxit = 400, MaxNWts = 2000)
Coefficients:
(Intercept) mv_daily icu_loc
F 3.6303751 -1.1223394 -0.3681095
H 1.2178084 -1.3153864 0.3721295
IND 0.4628305 -2.1366738 -1.2530020
PR 2.2952981 -1.3085620 -0.4032178
RRT 0.1000952 -0.6432881 0.7659957
# weights: 24 (15 variable)
initial value 18682.675986
iter 10 value 12929.391832
iter 20 value 12341.441938
final value 12284.346914
Data look like this:
id state_tomorrow day mv_daily icu_loc
1 F 1 0 1
1 RRT 2 1 1
2 PR 4 1 0
2 PR 5 1 2
When estimating multinomial models, one should expect a separate parameter estimate for each factor level.