# Multinomial logistic regression on categorical data results in singular matrix

I have a categorical dataset from a biological sampling study consisting of six variables, see http://pastebin.com/ncLzw0Mt for the actual dataset.

> head(mydata)
Z_type Phylogroup Region Year_isolated Outer_hull Trypto_status
1       Z1         A1      A          2006      Slimy  Trypto_light
2       Z1         A1      C          2002      Slimy Trypto_medium
3       Z1         A1      A          2009      Slimy Trypto_severe
4       Z1         A1      A          2003        Dry Trypto_medium
5       Z2         A1      C          2002      Slimy Trypto_medium
6       Z3         A2      A          2009      Slimy Trypto_medium


Coming from question Categorical Predictors and categorical responses I want to use multinomial logistic regression (mlogit package in R), to see whether any of the other variables can be used to explain the Z_type.

If I understand correctly, my variables are all individual specific variables and I assume that I don't want to use a intercept, so here is what I'm doing:

library(mlogit)
H <- mlogit.data(mydata, shape="wide", choice="Z_type")
m = mlogit(Z_type~0|Phylogroup+Region+Year_isolated+0, reflevel="Z1", data=H)


This however results in a singular matrix:

Error in solve.default(H, g[!fixed]) :
system is computationally singular: reciprocal condition number = 7.73263e-17


Does that mean that there is a correlation between some of the variables? I don't really see how that is the case. Are there any other ways, besides mlogit, to answer my question?

• I just fitted the model $ZType = Phylogroup + Region + YearIsolated$ in Stata and it ran just fine, though it gave me a note that 11 observations were completely determined. Are you sure your R code is correct? Commented Jul 4, 2015 at 4:59