SlideShare a Scribd company logo
1 of 8
Download to read offline
© 2013 ExcelR Solutions. All Rights Reserved
Advanced Regression
AGENDA	
Mul)nomial	
Regression	
Zero	Inflated	
Poisson	
Regression	
Nega)ve	
Binomial
© 2013 ExcelR Solutions. All Rights Reserved
Multinomial Regression
•  Logis'c	regression	(Binomial	distribu'on)	is	used	when	output	has	‘2’	categories	
•  Mul'nomial	regression	(classifica'on	model)	is	used	when	output	has	>	‘2’	categories	
•  Extension	to	logis'c	regression	
	
•  No	natural	ordering	of	categories	
•  Response	variable	has	>	‘2’	categories	&	hence	we	apply	mul'logit	
•  Understand	the	impact	of	cost	&	'me	on	the	various	modes	of	transport	
Mode	of	
transport	
Car	 Carpool	 Bus	 Rail	 All	modes	
Count	 218	 32	 81	 122	 453	
Probability	 0.48	 0.07	 0.18	 0.27	 1
© 2013 ExcelR Solutions. All Rights Reserved
Multinomial Regression
•  Whether	we	have	‘Y’	(response)	or	‘X’	(predictor),	which	is	categorical	with	‘s’	categories	
ü  Lowest	in	numerical	/	lexicographical	value	is	chosen	as	baseline	/	reference	
ü  Missing	level	in	output	is	baseline	level	
ü  We	can	choose	the	baseline	level	of	our	choice	based	on	‘relevel’	func'on	in	R	
ü  Model	formulates	the	rela'onship	between	transformed	(logit)	Y	&	numerical	X	linearly	
ü  Modeling	quan'ta've	variables	linearly	might	not	always	be	correct
© 2013 ExcelR Solutions. All Rights Reserved
Multinomial Regression - Output
Itera'on	History:		
•  Itera've	procedure	is	used	to	compute	maximum	likelihood	es'mates	
•  #	itera'ons	&	convergence	status	is	provided	
•  -2logL	=	2	*	nega've	log	likelihood	
•  -2logL	has	χ2	distribu'on,	which	is	used	for	hypothesis	tes'ng	of	goodness	of	fit	
#	parameters	=	27
© 2013 ExcelR Solutions. All Rights Reserved
Multinomial Regression - Output
Log(P(choice	=	carpool	|	x)	/	P(choice	=	car	|	x)	=	β20	+	β21	*	cost.car	+	β22	*	cost.carpool	+	…………….		
	
This	equa'on	compares	the	log	of	probabili'es	of	carpool	to	car			
•  ‘car’	has	been	chosen	as	baseline	
•  x	=	vector	represen'ng	the	values	of	all	inputs	
•  The	regression	coefficient	0.636	indicates	that	for	a	‘1’	unit	increases	the	‘cost.car’,	the	log	odds	of	‘carpool’	to	‘car’	
increases	by	0.636	
•  Intercept	value	does	not	mean	anything	in	this	context	
	
•  If	we	have	a	categorical	X	also,	say	Gender	(female	=	0,	male	=	1),	then	regression	coefficient	(say	0.22)	indicates	
that	rela've	to	females,	males	increase	the	log	odds	of	‘carpool’	to	‘car’	by	0.22
© 2013 ExcelR Solutions. All Rights Reserved
Probability
•  Let	p	=	p(x	|	A)	be	the	probability	of	any	event	(say	airi'on)	under	condi'on	A	(say	
gender	=	female)		
	
•  Then		p(x	|	A)	÷	(1	-	p(x	|	A)	is	called	the	odds	associated	with	the	event	
Odds
•  If	there	are	two	condi'ons	A	(gender	=	female)	&	B	(gender	=	male)	then	the	ra'o	
						p(x	|	A)	÷	(1	-	p(x	|	A)	/	p(x	|	B)	÷	(1	-	p(x	|	B)		is	called	as	odds	ra'o	of	A	with	respect	to	B	
Odds Ratio
•  p(x	|	A)	÷	p(x	|	B)	is	called	as	rela've	risk	
Relative Risk
hips://en.wikipedia.org/wiki/Rela've_risk
© 2013 ExcelR Solutions. All Rights Reserved
•  Odds	ra'o	is	computed	from	the	coefficients	in	the	linear	model	equa'on	by	simply	
exponen'a'ng	
•  Exponen'ated	regression	coefficients	are	odds	ra'o	for	a	unit	change	in	a	predictor	
variable	
•  The	odds	ra'o	for	a	unit	increase	in	cost.car	is	1.88	for	choosing	carpool	vs	car	
Odds Ratio
© 2013 ExcelR Solutions. All Rights Reserved
Goodness of fit
Linear	 GLM	
Analysis	of	Variance	 Analysis	of	Deviance	
Residual	Deviance	 Residual	Sum	of	Squares	
OLS	 Maximum	Likelihood	
•  Residual	Deviance	is	-2	log	L	
•  Adding	more	parameters	to	the	model	will	reduce	Residual	Deviance	even	if	it	is	not	
going	to	be	useful	for	predic'on	
•  In	order	to	control	this,	penalty	of	“2	*	number	of	parameters”	is	added	to	to	
Residual	deviance	
•  This	penalized	value	of	-2	log	L	is	called	as	AIC	criterion	
•  AIC	=	-2	log	L	+	2	*	number	of	parameters	
Note:	“Mul'logit	Model	with	Interac(on”

More Related Content

Recently uploaded

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

data science

  • 1. © 2013 ExcelR Solutions. All Rights Reserved Advanced Regression AGENDA Mul)nomial Regression Zero Inflated Poisson Regression Nega)ve Binomial
  • 2. © 2013 ExcelR Solutions. All Rights Reserved Multinomial Regression •  Logis'c regression (Binomial distribu'on) is used when output has ‘2’ categories •  Mul'nomial regression (classifica'on model) is used when output has > ‘2’ categories •  Extension to logis'c regression •  No natural ordering of categories •  Response variable has > ‘2’ categories & hence we apply mul'logit •  Understand the impact of cost & 'me on the various modes of transport Mode of transport Car Carpool Bus Rail All modes Count 218 32 81 122 453 Probability 0.48 0.07 0.18 0.27 1
  • 3. © 2013 ExcelR Solutions. All Rights Reserved Multinomial Regression •  Whether we have ‘Y’ (response) or ‘X’ (predictor), which is categorical with ‘s’ categories ü  Lowest in numerical / lexicographical value is chosen as baseline / reference ü  Missing level in output is baseline level ü  We can choose the baseline level of our choice based on ‘relevel’ func'on in R ü  Model formulates the rela'onship between transformed (logit) Y & numerical X linearly ü  Modeling quan'ta've variables linearly might not always be correct
  • 4. © 2013 ExcelR Solutions. All Rights Reserved Multinomial Regression - Output Itera'on History: •  Itera've procedure is used to compute maximum likelihood es'mates •  # itera'ons & convergence status is provided •  -2logL = 2 * nega've log likelihood •  -2logL has χ2 distribu'on, which is used for hypothesis tes'ng of goodness of fit # parameters = 27
  • 5. © 2013 ExcelR Solutions. All Rights Reserved Multinomial Regression - Output Log(P(choice = carpool | x) / P(choice = car | x) = β20 + β21 * cost.car + β22 * cost.carpool + ……………. This equa'on compares the log of probabili'es of carpool to car •  ‘car’ has been chosen as baseline •  x = vector represen'ng the values of all inputs •  The regression coefficient 0.636 indicates that for a ‘1’ unit increases the ‘cost.car’, the log odds of ‘carpool’ to ‘car’ increases by 0.636 •  Intercept value does not mean anything in this context •  If we have a categorical X also, say Gender (female = 0, male = 1), then regression coefficient (say 0.22) indicates that rela've to females, males increase the log odds of ‘carpool’ to ‘car’ by 0.22
  • 6. © 2013 ExcelR Solutions. All Rights Reserved Probability •  Let p = p(x | A) be the probability of any event (say airi'on) under condi'on A (say gender = female) •  Then p(x | A) ÷ (1 - p(x | A) is called the odds associated with the event Odds •  If there are two condi'ons A (gender = female) & B (gender = male) then the ra'o p(x | A) ÷ (1 - p(x | A) / p(x | B) ÷ (1 - p(x | B) is called as odds ra'o of A with respect to B Odds Ratio •  p(x | A) ÷ p(x | B) is called as rela've risk Relative Risk hips://en.wikipedia.org/wiki/Rela've_risk
  • 7. © 2013 ExcelR Solutions. All Rights Reserved •  Odds ra'o is computed from the coefficients in the linear model equa'on by simply exponen'a'ng •  Exponen'ated regression coefficients are odds ra'o for a unit change in a predictor variable •  The odds ra'o for a unit increase in cost.car is 1.88 for choosing carpool vs car Odds Ratio
  • 8. © 2013 ExcelR Solutions. All Rights Reserved Goodness of fit Linear GLM Analysis of Variance Analysis of Deviance Residual Deviance Residual Sum of Squares OLS Maximum Likelihood •  Residual Deviance is -2 log L •  Adding more parameters to the model will reduce Residual Deviance even if it is not going to be useful for predic'on •  In order to control this, penalty of “2 * number of parameters” is added to to Residual deviance •  This penalized value of -2 log L is called as AIC criterion •  AIC = -2 log L + 2 * number of parameters Note: “Mul'logit Model with Interac(on”