Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Logistic regression

Subject: Logistic regression

From: Anneley

Date: 4 Aug, 2010 09:20:05

Message: 1 of 2

I am looking for a function to undertake a logistic regression where the dependent variable is binary 0 or 1, and the independent variables are continuous, with one categorical dataset. The problem I'm coming across is that if I use 'mnrfit' it states that Y should contain positive integer category numbers. Do I just change my dependent variable to be 1 or 2 instead, or am I using the wrong function?

Subject: Logistic regression

From: Tom Lane

Date: 4 Aug, 2010 13:00:15

Message: 2 of 2

>I am looking for a function to undertake a logistic regression where the
>dependent variable is binary 0 or 1, and the independent variables are
>continuous, with one categorical dataset. The problem I'm coming across is
>that if I use 'mnrfit' it states that Y should contain positive integer
>category numbers. Do I just change my dependent variable to be 1 or 2
>instead, or am I using the wrong function?

You can change the category numbers. You may find it simpler, though, to use
glmfit.

Either way, you'll want to create dummy variables for the categorical
variable, if it is to be used as a predictor. (I can't tell from your note
if that is the case.)

-- Tom

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us