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:
Multiple regression with dummy variable

Subject: Multiple regression with dummy variable

From: Tom Lane

Date: 6 Nov, 2013 17:25:59

Message: 1 of 1

(Sorry for earlier incomplete reply.)

>> Im running a multiple linear regression that looks like (I have
>> banks-year observations):
>>
>> y = b1*x1+b2*x2+b3*x3+b4*x4+ error
>>
>> where x4 is a dependent dummy variable that takes value of 1 (if the bank
>> is audited by a big4 auditor firm) and 0 (if a bank isnt audited by a
>> big4 auditor firm).
>>
>> The question is: how I must define the dummy variable to run the
>> regression (estimate the coefficients)? I think that I should use
>> dummyvar, but I dont unterstand how it works.
>
> This depends on what you are starting with. Perhaps you can define x1
> directly to have these 0/1 values. Suppose you have a variable named
> auditor defined as a cell array of strings representing the auditor names.
> Then you might try

>> auditor = {'PWC' 'Audits R Us' 'KPMG'}';
>> big4 = {'Deloitte' 'PWC' 'Ernst & Young' 'KPMG'}';
>> x1 = ismember(auditor,big4)
x1 =
     1
     0
     1

The strcmp or similar function might also be useful in some cases.

-- 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