Binary Logistic Regression - beginner

조회 수: 326 (최근 30일)
Amina Ag
Amina Ag 2021년 5월 27일
댓글: the cyclist 2021년 5월 29일
Hello,
Begginer question regarding logstic regressions in matlab. I am trying to run a binary logistic regression in Matlab but cannot seem to find the code to be able to do so. I am finding it for multinomial but not for binary. Could someone please lead me in the right direction?
I have a table of more than 60 variables and 200 000 rows that I want to run.
Thank you for your time and help!

채택된 답변

the cyclist
the cyclist 2021년 5월 27일
If you have the Statistics and Machine Learning Toolbox, you can use the fitglm function to fit a binomial logistic regression. See the first example on that page.
  댓글 수: 8
Amina Ag
Amina Ag 2021년 5월 29일
That worked perfectly and I found the guilty variable but I am not quite sure why it is not working? The varibale is the log of assets. If I want to include this variable how can i transform it so that the model can read it?
I also have 5 categorical variables that I want to include. Is it possible to include these without making them dummyvar? I know STATA reads it as an categorical automatically and it is not necessary to make a dummy, would it be possible to do the same in matlab?
the cyclist
the cyclist 2021년 5월 29일
If the variable is the log of assets, I'll wager that what has happened is that one of your asset values is unexpectedly negative. The log of a negative number is complex.
Take a look at the Name-Value Pair Arguments section of the fitglm documentation. There is a CategoricalVars input that allows you to specify which of your explanatory variables is categorical. Alternatively, you could convert the variable to categorical before entering it into the model.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Autocorrelated and Heteroscedastic Disturbances에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by