######## > str(MC) 'data.frame': 21130 obs. of 10 variables: $ male : int 1 1 1 1 1 1 1 1 1 1 ... $ pop : int 2 2 2 2 2 2 2 2 2 2 ... $ lma : num 4.9 4.9 4.9 4.9 4.9 4.9 4.9 4.9 4.9 4.9 ... $ poids : num 3.03 3.03 3.03 3.03 3.03 3.03 3.03 3.03 3.03 3.03 ... $ ventre: int 4 4 4 4 4 4 4 4 4 4 ... $ dos : int 3 3 3 3 3 3 3 3 3 3 ... $ date : int 1 1 1 1 1 1 1 1 1 1 ... $ mom : int 1 1 1 1 1 2 2 2 2 2 ... $ c : chr "no" "no" "no" "no" ... $ N : Factor w/ 5 levels "explo","stress",..: 3 1 4 5 2 3 1 4 5 2 ...
######## "your inputs have redundant/overlapping information." yes, thas the case, as you can see : > cor.test(MC$lma,MC$poids) Pearson's product-moment correlation data: MC$lma and MC$poids t = 168.5517, df = 21128, p-value < 2.2e-16 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.7514854 0.7629881 sample estimates: cor 0.7572954 ######## "If your system is exactly singular, it means that at least one of the columns of your 'model matrix'á is some linear combination of the others, which essentially means your inputs have redundant/overlapping information." I think that my variables have some redundant information but it seems me that type-II analysis-of-variance permit to bypass this issue. Are your input variables supposed to be factors (categorical) or numeric? In the model I show, there is only continues numeric independent variables (lma and poids). The dependent variable is an categorical and unordered. ######## BUT, when that's will work, I'd like add some independent categorical and ordered variable (it's possible to considerer them as unordered) Does it imply some issues ?? ######## This can also happen if one of the response categories only occurs with a single combination of your inputs. Runá some tables on the variables in your model; that might help clarify things. But, lma and poids are continues variables > table(MC$lma,MC$poids) 1.97 2.17 2.35 2.37 2.41 2.46 2.47 2.48 2.54 2.59 2.71 2.8 2.83 2.85 4 560 0 0 0 0 0 0 0 0 0 0 0 0 0 4.4 0 0 0 0 0 0 0 475 0 0 0 0 0 0 4.5 0 520 0 0 0 0 0 0 0 0 0 0 0 0 4.6 0 0 570 0 560 0 520 0 0 0 0 0 0 475 4.7 0 0 0 0 0 565 0 0 0 0 570 0 0 0 4.8 0 0 0 0 0 0 1090 0 0 570 0 560 0 0 4.9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 560 0 0 0 0 0 0 0 0 0 0 5.1 0 0 0 0 0 0 0 0 0 0 0 0 570 0 5.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.5 0 0 0 0 0 0 0 0 515 0 0 0 0 0 2.88 2.91 3 3.02 3.03 3.09 3.11 3.15 3.16 3.18 3.2 3.24 3.35 3.4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4.7 0 0 0 0 0 475 515 0 0 0 0 0 0 0 4.8 570 0 0 0 0 0 0 0 0 0 0 0 0 0 4.9 0 560 515 0 1550 0 0 0 0 0 570 560 0 0 5 0 0 0 520 0 0 0 0 0 0 570 0 560 0 5.1 0 0 0 0 0 0 0 520 0 0 0 0 0 520 5.2 0 0 0 0 0 0 0 0 570 570 0 0 0 0 5.4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5.5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3.43 3.67 3.71 3.95 4 4.06 4 0 0 0 0 0 0 4.4 0 0 0 0 0 0 4.5 0 0 0 0 0 0 4.6 0 0 0 0 0 0 4.7 0 0 0 0 0 0 4.8 0 0 0 0 0 0 4.9 0 0 0 0 0 0 5 0 0 0 0 0 0 5.1 0 0 0 0 0 0 5.2 570 560 0 520 0 0 5.4 0 0 565 0 0 520 5.5 0 0 0 0 570 0 > table(MC$poids,MC$N) explo stress SS_cache thermo immo 1.97 112 112 112 112 112 2.17 104 104 104 104 104 2.35 114 114 114 114 114 2.37 112 112 112 112 112 2.41 112 112 112 112 112 2.46 113 113 113 113 113 2.47 322 322 322 322 322 2.48 95 95 95 95 95 2.54 103 103 103 103 103 2.59 114 114 114 114 114 2.71 114 114 114 114 114 2.8 112 112 112 112 112 2.83 114 114 114 114 114 2.85 95 95 95 95 95 2.88 114 114 114 114 114 2.91 112 112 112 112 112 3 103 103 103 103 103 3.02 104 104 104 104 104 3.03 310 310 310 310 310 3.09 95 95 95 95 95 3.11 103 103 103 103 103 3.15 104 104 104 104 104 3.16 114 114 114 114 114 3.18 114 114 114 114 114 3.2 228 228 228 228 228 3.24 112 112 112 112 112 3.35 112 112 112 112 112 3.4 104 104 104 104 104 3.43 114 114 114 114 114 3.67 112 112 112 112 112 3.71 113 113 113 113 113 3.95 104 104 104 104 104 4 114 114 114 114 114 4.06 104 104 104 104 104 > table(MC$lma,MC$N) explo stress SS_cache thermo immo 4 112 112 112 112 112 4.4 95 95 95 95 95 4.5 104 104 104 104 104 4.6 425 425 425 425 425 4.7 425 425 425 425 425 4.8 558 558 558 558 558 4.9 751 751 751 751 751 5 442 442 442 442 442 5.1 322 322 322 322 322 5.2 558 558 558 558 558 5.4 217 217 217 217 217 5.5 217 217 217 217 217 Date: Fri, 5 Feb 2010 05:36:12 -0800 Subject: Re: [R] mlogit From: djmu...@gmail.com To: hug...@hotmail.fr Hi: On Fri, Feb 5, 2010 at 5:23 AM, hugo Mathe <hug...@hotmail.fr> wrote: Hi, I'm using the function "mlogit" from the package "mlogit" in order to make a multinomial model, with random and nested effect*. But, currently, even a basic model as > mlogit(c ~ lma + poids , MC, shape = "long", alt.var = "N") Erreur dans drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) : ásous-programme Lapack dgesv : le systÞme est exactement singulier which is the same thing than Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) : "Lapack routine dgesv: system is exactly singular" If your system is exactly singular, it means that at least one of the columns of your 'model matrix'á is some linear combination of the others, which essentially means your inputs have redundant/overlapping information. Are your input variables supposed to be factors (categorical) or numeric? Type str(MC) to view the class of each of the variables in your data frame to see whether your expectations match reality. This can also happen if one of the response categories only occurs with a single combination of your inputs. Runá some tables on the variables in your model; that might help clarify things. HTH, Dennis I didn't find any explanations on the web ... my data look like this > head(MC) ámale pop lma poids ventre dos date mom á c á á áN 1 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á1 á á á áno áSS_cache 2 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á1 á á á áno á á á áexplo 3 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á1 á á á áno á á thermo 4 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á1 á á á áno á á á áimmo 5 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á1 á á á áno á á á ástress 6 á á1 á 2 á á4.9 á3.03 á á á4 á á 3 á á á1 á á2 á á á yes á SS_cache somes data of the Examples (in ?mlogit) look like mine > head(TravelMode) áindividual ámode choice wait vcost travel gcost income size avincome á á time 1 á á á á á1 á air á á no á 69 á á59 á á100 á á70 á á3.5 á á1 á á á 35 2.816667 2 á á á á á1 train á á no á 34 á á31 á á372 á á71 á á3.5 á á1 á á á á0 6.766667 3 á á á á á1 á bus á á no á 35 á á25 á á417 á á70 á á3.5 á á1 á á á á0 7.533333 4 á á á á á1 á car á áyes á á0 á á10 á á180 á á30 á á3.5 á á1 á á á á0 3.000000 5 á á á á á2 á air á á no á 64 á á58 á á 68 á á68 á á3.0 á á2 á á á 30 2.200000 6 á á á á á2 train á á no á 44 á á31 á á354 á á84 á á3.0 á á2 á á á á0 6.633333 á timeair 1 2.816667 2 0.000000 3 0.000000 4 0.000000 5 2.200000 6 0.000000 and > mlogit(choice ~ time + timeair , TravelMode, shape = "long", alt.var = "mode") Call: mlogit(formula = choice ~ time + timeair, data = TravelMode, á á shape = "long", alt.var = "mode", method = "nr", print.level = 0) Coefficients: alttrain á áaltbus á áaltcar á á átime á timeair á-3.6776 á -4.2339 á -4.5232 á -0.5963 á -2.7048 work prefectly so, I don't understant any thing, ... Is anybody understand why this function didn't work on my data ? MANY THANKS hugo mathÚ hubertEmail : hug...@hotmail.fr PS: * if anybody know how to consider interaction between 2 nested factors, I'm interested ... (it is "a:b in (A:B)" if a is nested in A and b nested in B ?) _________________________________________________________________ Hotmail: Powerful Free email with security by Microsoft. á á á á[[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hotmail: Trusted email with powerful SPAM protection. Sign up now. _________________________________________________________________ Hotmail: Trusted email with Microsofts powerful SPAM protection. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.