필터 지우기
필터 지우기

Why do I get different results using fitglm and mnrfit for logistic regression

조회 수: 5 (최근 30일)
Dimitri
Dimitri 2016년 5월 12일
답변: Hans van der Horn 2021년 8월 19일
I am running a multinomial logistic regression and I find different results when using mnrfit and fitglm. Here are the data I am using for mnrfit:
X = [0.333333333333333,0.555555555555556,0.111111111111111,0;1,0.444444444444444,0.222222222222222,0;0.222222222222222,0.444444444444444,0,0;0.555555555555556,0.777777777777778,0,0;0,1,0.777777777777778,1;0.444444444444444,0.555555555555556,0.444444444444444,0;0.333333333333333,0.888888888888889,0,0;0.555555555555556,0.555555555555556,0,0;0.222222222222222,0.222222222222222,0.555555555555556,0;0.222222222222222,0.333333333333333,0.222222222222222,0;0.111111111111111,0.333333333333333,0.111111111111111,0;0.777777777777778,0.333333333333333,0,0;0.444444444444444,0.555555555555556,0.888888888888889,0;1,0,0.555555555555556,0;1,0.222222222222222,1,0;0.777777777777778,0.333333333333333,0.111111111111111,0;0.555555555555556,0.555555555555556,0.222222222222222,0;0.888888888888889,0.111111111111111,0.222222222222222,0;0.777777777777778,0.555555555555556,0.888888888888889,0;0.444444444444444,0.777777777777778,0.555555555555556,0;0.888888888888889,1,0,0;0.333333333333333,0.222222222222222,0.333333333333333,0;0.555555555555556,0,0.555555555555556,0;0.888888888888889,0,0.444444444444444,0;0.222222222222222,0.777777777777778,0.111111111111111,0;0.444444444444444,0.777777777777778,0.666666666666667,0;0.555555555555556,0.222222222222222,0.444444444444444,0;0.888888888888889,0.555555555555556,0.666666666666667,0;0.666666666666667,1,0.111111111111111,0;0.555555555555556,0.666666666666667,0,0;0.444444444444444,1,1,0;0.444444444444444,1,0.222222222222222,0;0.888888888888889,0.666666666666667,0.222222222222222,0;0.222222222222222,0.333333333333333,0.222222222222222,0;0.444444444444444,0.666666666666667,0.444444444444444,0;1,0.333333333333333,0.555555555555556,0;0.333333333333333,1,1,0;0.333333333333333,0,0.777777777777778,1;1,0.888888888888889,0.333333333333333,0;0.777777777777778,0.333333333333333,0,0;0.666666666666667,1,0.222222222222222,0;1,0.444444444444444,0,0;0,0.111111111111111,0.555555555555556,0;0,0,0.777777777777778,0;0,0.444444444444444,1,0;0.777777777777778,0.666666666666667,0.666666666666667,0;0.444444444444444,0.888888888888889,0.222222222222222,0;0.666666666666667,0.222222222222222,0,0;0.222222222222222,0.888888888888889,0.111111111111111,0;0.555555555555556,0.111111111111111,0.111111111111111,0;NaN,0.777777777777778,0.777777777777778,NaN;0,0.555555555555556,0.111111111111111,0;0.222222222222222,0.111111111111111,0.777777777777778,0;0.666666666666667,0.222222222222222,0,0;0.444444444444444,0.333333333333333,0,0;0.444444444444444,1,0.333333333333333,0;0.777777777777778,0.111111111111111,0.444444444444444,0;0.888888888888889,0.888888888888889,0.222222222222222,0;0.333333333333333,0.555555555555556,0,0;0.666666666666667,0.111111111111111,0,0;0.888888888888889,0.444444444444444,0.222222222222222,0;0.555555555555556,0.444444444444444,0,0;0.111111111111111,0.777777777777778,0,0;0.222222222222222,0.111111111111111,0.333333333333333,0;0.666666666666667,0.444444444444444,0.888888888888889,0;0.222222222222222,0.111111111111111,0,0;0.444444444444444,0.888888888888889,0,0;0.333333333333333,1,0.333333333333333,0;0.222222222222222,0.111111111111111,0,0;1,0.888888888888889,0.666666666666667,0;1,0.111111111111111,0.444444444444444,0;0,1,0.444444444444444,0;0.333333333333333,0.777777777777778,0,0;0.666666666666667,0.888888888888889,0.222222222222222,0;0.333333333333333,0.444444444444444,0.777777777777778,0;0.444444444444444,0,0.666666666666667,0;0,0.777777777777778,0.555555555555556,0;0.888888888888889,0.666666666666667,0.555555555555556,0;0.222222222222222,1,0.222222222222222,0;0.333333333333333,0.888888888888889,0.222222222222222,0;0.444444444444444,0.888888888888889,0.111111111111111,0;0.222222222222222,0,0.444444444444444,0;0.666666666666667,0.333333333333333,0.333333333333333,0;0.777777777777778,0.333333333333333,0.666666666666667,0;0.777777777777778,1,1,0;0.333333333333333,0.555555555555556,0.111111111111111,0;0.555555555555556,0.555555555555556,0,0;0.444444444444444,0.888888888888889,0.888888888888889,0;0.555555555555556,0.666666666666667,0.666666666666667,0;0.222222222222222,0.777777777777778,0,0;0.666666666666667,0.666666666666667,0.222222222222222,0;0.888888888888889,0.444444444444444,0.888888888888889,0;0.555555555555556,0.111111111111111,0.555555555555556,0;0.777777777777778,0.222222222222222,0.888888888888889,0;0.555555555555556,0.555555555555556,0.222222222222222,0;0.111111111111111,0.555555555555556,1,0;0,0.777777777777778,0.777777777777778,0;0.777777777777778,0.666666666666667,0.777777777777778,0;0.555555555555556,0.555555555555556,0.777777777777778,0;0.333333333333333,0.888888888888889,0,1;1,0.555555555555556,0.777777777777778,0;0.777777777777778,0.222222222222222,0.222222222222222,0;0.111111111111111,0.111111111111111,0.333333333333333,0;NaN,0.555555555555556,0,NaN;0.444444444444444,0.222222222222222,0,0;0,1,0.333333333333333,1;0.555555555555556,1,0,0;NaN,0.444444444444444,0.111111111111111,NaN;0.333333333333333,0.555555555555556,0.111111111111111,0;0.666666666666667,0.777777777777778,0,0;0,0.777777777777778,0.444444444444444,0;0.111111111111111,0.333333333333333,0.111111111111111,0;1,0,0.555555555555556,0;0.555555555555556,0.666666666666667,0,0;0,0.444444444444444,0.555555555555556,0;0.777777777777778,0.555555555555556,0.222222222222222,0;0.222222222222222,0.555555555555556,0.111111111111111,0;1,1,0.666666666666667,0;0.555555555555556,0.888888888888889,0.333333333333333,0;0.333333333333333,0.444444444444444,0,0;0.333333333333333,0.333333333333333,0.444444444444444,0;0.222222222222222,0,0.222222222222222,0;0.666666666666667,0.888888888888889,0,0;0.222222222222222,0,0.222222222222222,0;0.666666666666667,0.555555555555556,1,0;0.555555555555556,0.111111111111111,0.333333333333333,0;0.777777777777778,0,0.444444444444444,0;0.333333333333333,0.555555555555556,0,0;0.333333333333333,0.222222222222222,0.444444444444444,0;1,0,0.666666666666667,1;0.666666666666667,0.111111111111111,0,0;0.777777777777778,0.777777777777778,0.666666666666667,0;1,0.222222222222222,0.666666666666667,0;0.888888888888889,0.222222222222222,0.888888888888889,0;0.444444444444444,0.333333333333333,0.222222222222222,0;0.444444444444444,0.555555555555556,0.111111111111111,0;0.333333333333333,0.777777777777778,0.111111111111111,0;0.888888888888889,0.444444444444444,0.888888888888889,0;0.222222222222222,1,0,0;0,0.666666666666667,0.777777777777778,1;0,1,1,0;0,0.111111111111111,0.666666666666667,0;0.333333333333333,0.777777777777778,0.222222222222222,0;0.444444444444444,0.222222222222222,0.777777777777778,0;1,0,0,0;0.222222222222222,0.222222222222222,0.333333333333333,0;1,0.555555555555556,0.888888888888889,0;0.777777777777778,0.444444444444444,0.444444444444444,0;0,0,0.888888888888889,0;0.111111111111111,0.333333333333333,0.444444444444444,0;0.333333333333333,0.444444444444444,0.555555555555556,0;1,0.111111111111111,0.666666666666667,0;0.333333333333333,1,0,0;0.222222222222222,0.222222222222222,0.111111111111111,0;1,0.222222222222222,0.888888888888889,0;0.222222222222222,0.555555555555556,0.444444444444444,0;0.777777777777778,0.888888888888889,0,0;0.444444444444444,0.444444444444444,0,0;1,0,0.444444444444444,0;0,0.222222222222222,0.666666666666667,0;0.111111111111111,0.555555555555556,0.444444444444444,0;1,0.555555555555556,0.333333333333333,0;0.444444444444444,0.888888888888889,0.111111111111111,0;0.444444444444444,0.666666666666667,0.222222222222222,0;0.666666666666667,0.222222222222222,0.222222222222222,0;0.222222222222222,0.111111111111111,0.666666666666667,0;0.666666666666667,0.888888888888889,0.888888888888889,0;0.555555555555556,0.444444444444444,0,0;NaN,0,0.222222222222222,NaN;1,0,NaN,0;0.444444444444444,0.111111111111111,0.333333333333333,0;0.444444444444444,0.777777777777778,0.111111111111111,0;0.111111111111111,0.555555555555556,1,0;0.222222222222222,0.777777777777778,0.111111111111111,0;0.111111111111111,0,1,0;0.444444444444444,0.333333333333333,0.111111111111111,0;0.222222222222222,0.111111111111111,0.555555555555556,0;0.222222222222222,0.777777777777778,0.111111111111111,0;0.111111111111111,1,0.222222222222222,0;0.666666666666667,0.444444444444444,0.555555555555556,0;0.777777777777778,0,0.666666666666667,0;0.777777777777778,1,0,0;0.222222222222222,0.222222222222222,0.333333333333333,0;0.111111111111111,0.222222222222222,0,0;1,0.444444444444444,0.888888888888889,0;0.222222222222222,0.666666666666667,0.555555555555556,0;0.111111111111111,0.444444444444444,0.333333333333333,0;0.666666666666667,0.444444444444444,0.888888888888889,0;1,0.111111111111111,0.333333333333333,0;0.333333333333333,0.444444444444444,0.222222222222222,0;0.333333333333333,1,0.222222222222222,0;0,0.333333333333333,0,1;0.777777777777778,0.666666666666667,0.555555555555556,0;0.333333333333333,0.666666666666667,0,0;0.222222222222222,0,0.666666666666667,0;0.222222222222222,0.111111111111111,0,0;0.555555555555556,0.777777777777778,0.111111111111111,0;0.666666666666667,0.444444444444444,0.888888888888889,0;0.888888888888889,1,0.111111111111111,0;0.555555555555556,0.555555555555556,0,0;0.444444444444444,0.777777777777778,0.444444444444444,0;0.111111111111111,0.777777777777778,0.888888888888889,0;0.888888888888889,0.333333333333333,0.111111111111111,0;1,0,0.888888888888889,0;0.333333333333333,0.333333333333333,0.333333333333333,0;0.555555555555556,0.666666666666667,0.333333333333333,0;1,0.888888888888889,0.222222222222222,0;0.333333333333333,0.666666666666667,0.222222222222222,0;0.444444444444444,0.666666666666667,0.444444444444444,0;0.666666666666667,0.777777777777778,0.777777777777778,0;0,0.222222222222222,0.111111111111111,1;0.666666666666667,0.888888888888889,0.444444444444444,0;0.333333333333333,0.777777777777778,0,0;0.444444444444444,0,0.111111111111111,0;0.111111111111111,0,0.333333333333333,0;0.333333333333333,0.555555555555556,0,0;0.777777777777778,0.555555555555556,1,0;0.111111111111111,0.444444444444444,0.222222222222222,0;1,0.777777777777778,0,0;0.444444444444444,0.888888888888889,0,0;0.555555555555556,0.666666666666667,0,0;1,0.111111111111111,0.222222222222222,0;0.444444444444444,0.888888888888889,0.333333333333333,0;0.777777777777778,0.222222222222222,0.222222222222222,0;0.111111111111111,0.666666666666667,0,0;0.222222222222222,0.666666666666667,0,0;0.444444444444444,0.333333333333333,0,0;0.666666666666667,0.444444444444444,0.666666666666667,0;0.777777777777778,1,0.111111111111111,0;0.111111111111111,0.777777777777778,0.777777777777778,0;0.111111111111111,0,NaN,0;0.111111111111111,0.777777777777778,0,0;0,0.111111111111111,0.777777777777778,1;0.777777777777778,0.555555555555556,0.777777777777778,0;NaN,0.555555555555556,0.222222222222222,NaN;0.777777777777778,0.444444444444444,0.222222222222222,0;0.222222222222222,1,0,0;0.111111111111111,0.444444444444444,0,0;0.888888888888889,0.555555555555556,0.111111111111111,0;0.555555555555556,0.666666666666667,0,0;0.222222222222222,0.555555555555556,0.666666666666667,0;0.333333333333333,0.333333333333333,0.222222222222222,0;0.888888888888889,0.666666666666667,0.555555555555556,0;0.222222222222222,0.111111111111111,0.111111111111111,0;0.888888888888889,0.444444444444444,0.888888888888889,0;0.333333333333333,0.666666666666667,0.222222222222222,0;0.777777777777778,0.666666666666667,1,0;0.555555555555556,0.888888888888889,0.111111111111111,0;0.666666666666667,0.222222222222222,0.888888888888889,0;0.222222222222222,0.333333333333333,0.111111111111111,0;0.444444444444444,0.222222222222222,0.333333333333333,0;1,0.222222222222222,0.555555555555556,0;0.777777777777778,1,0.666666666666667,0;0.222222222222222,0.555555555555556,0.333333333333333,0;0.111111111111111,0.888888888888889,0.111111111111111,0;0,1,0.222222222222222,0;0.555555555555556,0.444444444444444,0.111111111111111,0;0.444444444444444,0.444444444444444,0.222222222222222,0;0.555555555555556,0.222222222222222,0.111111111111111,0;0.333333333333333,0.555555555555556,1,0;0.111111111111111,0.666666666666667,0.444444444444444,0;0.111111111111111,0.555555555555556,0.111111111111111,0;0.888888888888889,1,0,0;0.777777777777778,0.333333333333333,0.333333333333333,0;0.111111111111111,0,0.888888888888889,0;0.888888888888889,0.333333333333333,1,0;0.111111111111111,0.888888888888889,0.333333333333333,0;1,0.111111111111111,0.111111111111111,0;0,1,0,0;0.222222222222222,0.444444444444444,0,0;0.666666666666667,0.555555555555556,0.444444444444444,0;0.222222222222222,0.444444444444444,0,0;0.111111111111111,0.555555555555556,1,0;0.777777777777778,0.444444444444444,0.444444444444444,0;0.666666666666667,0.555555555555556,0.666666666666667,0;0.444444444444444,0.666666666666667,0,0;0.555555555555556,0.333333333333333,0.111111111111111,0;0,0.333333333333333,0,0;0.111111111111111,1,0,0;0,0.222222222222222,0.666666666666667,0;0.555555555555556,0,0.333333333333333,0;0,0.888888888888889,0.222222222222222,0;0.444444444444444,0.444444444444444,0,0;1,0.555555555555556,0.111111111111111,0;0.888888888888889,0.444444444444444,0.555555555555556,0;0,0.444444444444444,0.777777777777778,1;0.444444444444444,0.555555555555556,0,0;0.888888888888889,0.888888888888889,0.555555555555556,0;0.222222222222222,0.888888888888889,0,0;0.222222222222222,0.666666666666667,0.111111111111111,0;0.666666666666667,0.888888888888889,0.111111111111111,0;0.666666666666667,1,0,0;0.333333333333333,0.111111111111111,0.444444444444444,0;0.444444444444444,0.666666666666667,0.777777777777778,0;1,0.777777777777778,0.333333333333333,0;1,0.444444444444444,0.777777777777778,0;0,0.888888888888889,0.888888888888889,1;0.333333333333333,1,0.111111111111111,0;1,0.222222222222222,0.222222222222222,0;0.777777777777778,0.555555555555556,0.333333333333333,0;0,0.222222222222222,1,1;0.222222222222222,0.666666666666667,0,0;0.444444444444444,0.333333333333333,0.222222222222222,0;0.111111111111111,0.555555555555556,0.777777777777778,0;0.777777777777778,1,0,0;0.333333333333333,0.444444444444444,1,1;0,0.222222222222222,0.333333333333333,0;0.666666666666667,0.777777777777778,0.666666666666667,0;0.666666666666667,0.777777777777778,0.222222222222222,0;0.222222222222222,0.666666666666667,0.333333333333333,0;0.888888888888889,0.777777777777778,0.111111111111111,0;0.222222222222222,0.222222222222222,0.888888888888889,0;0.777777777777778,0,0,0;0.222222222222222,1,0,0;0.222222222222222,0.555555555555556,0.222222222222222,0;0.888888888888889,0.333333333333333,0.222222222222222,0;0,0.444444444444444,0.555555555555556,0;0.111111111111111,0.777777777777778,0.222222222222222,0;0.444444444444444,0.222222222222222,0.555555555555556,0;0.666666666666667,0,0.444444444444444,0;0.444444444444444,0.111111111111111,0.555555555555556,0;0.222222222222222,0.222222222222222,0.444444444444444,0;0.333333333333333,1,0.666666666666667,0;0.666666666666667,0.777777777777778,0.333333333333333,0;0.111111111111111,0.222222222222222,0.333333333333333,0;0.222222222222222,0.888888888888889,0.111111111111111,0;0.555555555555556,0.666666666666667,0,0;0.888888888888889,0.555555555555556,0.222222222222222,0;0,0.666666666666667,0,0;0.444444444444444,1,0.555555555555556,0;0.666666666666667,0.444444444444444,1,0;1,0.888888888888889,0.555555555555556,0;0.666666666666667,0.777777777777778,1,0;0,0.555555555555556,0.111111111111111,0;0.111111111111111,0,0.555555555555556,0;0.444444444444444,0.222222222222222,0,0;0.777777777777778,1,0,0;0.555555555555556,0.333333333333333,0.777777777777778,0;0.111111111111111,0.222222222222222,0,0;0.111111111111111,0.555555555555556,0.222222222222222,0;0.666666666666667,0.666666666666667,0.666666666666667,0;0.777777777777778,0.555555555555556,0,0;0.444444444444444,0.555555555555556,0.555555555555556,0;0.111111111111111,0.111111111111111,0.666666666666667,0;0.888888888888889,0.444444444444444,0.444444444444444,0;0.555555555555556,0.555555555555556,0.222222222222222,0;0.555555555555556,0.444444444444444,0,0;0.555555555555556,0.444444444444444,0.111111111111111,0;0.666666666666667,0.111111111111111,0,0;0.444444444444444,1,0.222222222222222,0;0.777777777777778,0,0.666666666666667,0;0.888888888888889,0.444444444444444,1,0;0,0,0.555555555555556,0;0.333333333333333,0.111111111111111,0,0;1,0.666666666666667,0.111111111111111,0;0.666666666666667,0.777777777777778,0.444444444444444,0;0.444444444444444,0.333333333333333,0.777777777777778,0;0.111111111111111,0.111111111111111,0.111111111111111,0;0.444444444444444,0.333333333333333,0.111111111111111,0;0.111111111111111,0.444444444444444,0.333333333333333,0;0.666666666666667,0.666666666666667,0,0;0.444444444444444,0.666666666666667,0,0;0.111111111111111,0.222222222222222,0.555555555555556,0;0.666666666666667,0.666666666666667,0.888888888888889,0;0.111111111111111,0,NaN,0;0.666666666666667,0.888888888888889,0.555555555555556,0;0.888888888888889,0.555555555555556,0.444444444444444,0;0.222222222222222,0.111111111111111,0,0;0.666666666666667,0,0.777777777777778,0;0.888888888888889,0.333333333333333,1,0;0.666666666666667,0.777777777777778,0,0;0.666666666666667,1,0.111111111111111,0;0.333333333333333,0.444444444444444,0.333333333333333,0;0,0.888888888888889,0.111111111111111,1;1,0.555555555555556,0.333333333333333,0;0.333333333333333,0.333333333333333,0.222222222222222,0;0.333333333333333,0.777777777777778,0.111111111111111,0;0.666666666666667,0,1,0;0.333333333333333,0.666666666666667,0.222222222222222,0;0.111111111111111,0.333333333333333,0.111111111111111,0;0.444444444444444,0.555555555555556,0.111111111111111,0;0.777777777777778,0.444444444444444,0.444444444444444,0;0.777777777777778,0.888888888888889,0.333333333333333,0;0.666666666666667,0.777777777777778,0.333333333333333,0;0.555555555555556,0,0,0;0.888888888888889,0.333333333333333,0,0;0.888888888888889,0.333333333333333,0.555555555555556,0;0.888888888888889,0.666666666666667,0.888888888888889,0;0.777777777777778,0.111111111111111,0.444444444444444,0;0.777777777777778,0.888888888888889,0,0;1,0.777777777777778,0.444444444444444,0;0.666666666666667,0.888888888888889,0.333333333333333,0;0.222222222222222,0.666666666666667,0,0;0.444444444444444,0.777777777777778,0.333333333333333,0;0,0.222222222222222,0.333333333333333,0;0,0,NaN,0;0.555555555555556,0.222222222222222,0.666666666666667,0;0.555555555555556,0.222222222222222,0.444444444444444,0;1,1,0.111111111111111,0;0.333333333333333,0.222222222222222,0.666666666666667,0;1,0,0.777777777777778,0;0.111111111111111,0.444444444444444,0.111111111111111,0;0.888888888888889,0.111111111111111,0.444444444444444,0;0.555555555555556,0.222222222222222,0.222222222222222,0;1,0.222222222222222,0.555555555555556,0;0.111111111111111,0.444444444444444,0,0;0.111111111111111,0.888888888888889,0.222222222222222,0;0.555555555555556,1,0,0;0.555555555555556,0.333333333333333,0.222222222222222,0;0.666666666666667,0.555555555555556,0,0;0.222222222222222,0.555555555555556,0,0;0.777777777777778,0.666666666666667,0.555555555555556,0;0.666666666666667,0.777777777777778,0.333333333333333,0;0.555555555555556,0.888888888888889,0,0;0,0.888888888888889,0.111111111111111,1;0.444444444444444,0.555555555555556,0,0;0,0.555555555555556,1,0;0.555555555555556,0.777777777777778,0.222222222222222,0;0.555555555555556,0,0.111111111111111,0;0.444444444444444,1,0.111111111111111,0;0,0.222222222222222,0.111111111111111,0;0.111111111111111,0.555555555555556,0,0;0.444444444444444,0.222222222222222,0,0;0.444444444444444,0.888888888888889,0,0;0.888888888888889,0,0,0;0.222222222222222,0.555555555555556,0.333333333333333,0;0.444444444444444,0,0.555555555555556,0;1,0.888888888888889,0,0;0.777777777777778,0.333333333333333,0.777777777777778,0;1,0.444444444444444,0.444444444444444,0;0,0.555555555555556,0.666666666666667,1;0.555555555555556,1,0,0;0.888888888888889,0.333333333333333,0.777777777777778,0;0.222222222222222,0.111111111111111,0,0;0.777777777777778,0.555555555555556,0,0;0.666666666666667,0.777777777777778,0,0;0.111111111111111,0.777777777777778,0.111111111111111,0;0.333333333333333,0.333333333333333,0.111111111111111,0;0.444444444444444,0.555555555555556,0.333333333333333,0;1,1,0.666666666666667,0;0.777777777777778,0.444444444444444,0.777777777777778,0;0,0.555555555555556,0.111111111111111,0;0.222222222222222,0.111111111111111,0.777777777777778,0;0.444444444444444,0.555555555555556,0.111111111111111,0;0.444444444444444,0.333333333333333,0.777777777777778,0;0,0.222222222222222,0.111111111111111,1;0.666666666666667,0.444444444444444,0.555555555555556,0;1,0.444444444444444,1,0;0.444444444444444,0.666666666666667,0.666666666666667,0;0.444444444444444,0.777777777777778,0.222222222222222,0;0.888888888888889,0.444444444444444,0.111111111111111,0;0.888888888888889,0.666666666666667,1,0;0.111111111111111,0.333333333333333,0,0;0.222222222222222,1,0,0;0.111111111111111,0.111111111111111,0.555555555555556,0;0.555555555555556,0,0.333333333333333,0;0.111111111111111,0.555555555555556,1,0;0.555555555555556,1,0.333333333333333,0;0.222222222222222,0.444444444444444,0,1;0.666666666666667,0,0.777777777777778,0;0.333333333333333,0.888888888888889,0.111111111111111,0;0.111111111111111,1,0.111111111111111,0;0.555555555555556,0.555555555555556,0,0;0.111111111111111,0.111111111111111,0,0;0.555555555555556,0.222222222222222,0.444444444444444,0;0.222222222222222,0.888888888888889,0.222222222222222,0;0.777777777777778,0.666666666666667,0.444444444444444,0;0,0.444444444444444,1,0;0.777777777777778,0.111111111111111,1,0;0.222222222222222,0.333333333333333,0.333333333333333,0;0.666666666666667,0.111111111111111,0,0;0.555555555555556,1,0.222222222222222,0;0,0,0.222222222222222,0;0.444444444444444,0.222222222222222,0,0;0.111111111111111,1,0,0;0.555555555555556,0.555555555555556,1,0;0.111111111111111,1,0.888888888888889,0;0.888888888888889,1,0,0;0.444444444444444,0.666666666666667,0.111111111111111,0;0.777777777777778,0.888888888888889,0,0;0.444444444444444,0.666666666666667,0.111111111111111,0]
Y = [2;1;2;2;2;2;2;2;2;2;1;1;2;2;2;2;2;1;2;2;2;1;2;2;2;2;2;2;2;2;1;2;1;1;2;2;1;1;2;2;2;2;2;1;2;2;2;2;2;2;1;2;2;2;2;2;1;2;2;2;2;2;2;2;2;2;2;2;1;1;2;2;1;2;2;1;2;2;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;2;2;2;1;2;2;2;2;2;1;2;1;2;2;NaN;1;2;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;1;2;1;2;2;2;2;2;1;1;1;2;2;2;2;2;2;1;2;1;1;1;1;1;2;1;2;2;2;2;2;2;2;2;2;2;2;2;2;1;NaN;2;2;1;2;1;1;2;2;1;1;2;2;2;1;2;2;2;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;2;2;2;1;2;2;1;2;2;2;1;2;1;2;1;2;2;2;2;2;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;2;2;2;1;2;2;2;2;2;2;2;1;2;2;2;2;1;2;2;2;2;1;2;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;1;2;1;2;1;1;2;2;2;2;1;1;2;2;2;1;2;1;2;2;2;2;2;2;1;1;2;2;2;2;1;2;2;2;1;2;2;2;2;2;2;2;2;1;2;2;2;1;2;2;1;2;2;2;2;2;2;1;2;1;2;1;2;1;2;2;2;2;1;2;NaN;2;NaN;2;2;2;2;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;2;1;2;1;2;1;2;2;2;2;2;2;2;2;2;2;1;2;2;2;2;2;1;2;2;2;2;2;2;1;2;1;2;2;2;2;2;2;1;2;2;2;2;2;2;1;2;1;2;2;2;2;2;2;2;1;2;2;2;2;2;2;2;2;2;1;2;2;1;1;1;2;2;2;2;2;2;2;2;2;1;2;2;1;2;2;2;2;NaN;2;1;1;1;2;2;1;1;2;1;2;2;2;1;2;2;2;1;2;1;1;1;2;2;2];
[B, dev, stats] = mnrfit(X,Y);
And this gives me the following coefficients: -1.1652 -0.5434 -0.4309 0.76438 1.0752
Now if I am using the same data with fitglm (notice that I remove 1 from the Y array to meet input criterion of fitglm input but this should not change the results):
mdl = fitglm(X,Y-1,'Distribution','binomial', 'Link','logit');
This gives me the following coefficients: 1.1652 0.5434 0.4309 -0.76438 -1.0752
The data are obviously the same but the signs are in the opposite direction. Why are the sign opposite when the 2 functions should a priori give the same result? Or have I done anything wrong in the way I have define my Y variables?

답변 (1개)

Hans van der Horn
Hans van der Horn 2021년 8월 19일
It depends on what you define as reference catagory (for mnrfit this is the last, i.e., the higstest number in the response vector).
Best
Hans

카테고리

Help CenterFile Exchange에서 Get Started with Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by