SlideShare a Scribd company logo
2
Most read
3
Most read
10
Most read
Swipe
R - Poisson Regression
Poisson Regression involves regression models in
which the response variable is in the form of
counts and not fractional numbers.
For example, the count of number of births or
number of wins in a football match series.
Also the values of the response variables follow a
Poisson distribution.
The general mathematical equation for Poisson
regression is:-
log(y) = a + b1x1 + b2x2 + bnxn
R - Poisson Regression
Following is the description of the parameters
used −
y is the response variable.
a and b are the numeric coefficients.
x is the predictor variable.
The function used to create the Poisson regression
model is the glm() function.
The basic syntax for glm() function in Poisson
regression is:-
glm(formula,data,family)
Following is the description of the parameters
used in above functions −
formula is the symbol presenting the
relationship between the variables.
data is the data set giving the values of these
variables.
family is R object to specify the details of the
model. It's value is 'Poisson' for Logistic
Regression.
Example
We have the in-built data set "warpbreaks" which
describes the effect of wool type (A or B) and
tension (low, medium or high) on the number of
warp breaks per loom.
Let's consider "breaks" as the response variable
which is a count of number of breaks.
The wool "type" and "tension" are taken as
predictor variables.
Input Data
input <- warpbreaks
print(head(input))
When we execute the above code, it produces the
following result:-
breaks wool tension
1 26 A L
2 30 A L
3 54 A L
4 25 A L
5 70 A L
6 52 A L
Create Regression Model
output <-glm(formula = breaks ~ wool+tension, data =
warpbreaks,
family = poisson)
print(summary(output))
When we execute the above code, it produces the
following result:-
Call:
glm(formula = breaks ~ wool + tension, family =
poisson, data = warpbreaks)
Deviance Residuals:
Min 1Q Median 3Q Max
-3.6871 -1.6503 -0.4269 1.1902 4.2616
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 3.69196 0.04541 81.302 < 2e-16 ***
woolB -0.20599 0.05157 -3.994 6.49e-05 ***
tensionM -0.32132 0.06027 -5.332 9.73e-08 ***
tensionH -0.51849 0.06396 -8.107 5.21e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be
1)
Null deviance: 297.37 on 53 degrees of freedom
Residual deviance: 210.39 on 50 degrees of freedom
AIC: 493.06
Number of Fisher Scoring iterations: 4
In the summary we look for the p-value in the last
column to be less than 0.05 to consider an impact
of the predictor variable on the response variable.
As seen the wooltype B having tension type M and
H have impact on the count of breaks.
R - Time Series Analysis
R - Nonlinear Least Square
R - Decision Tree
Stay Tuned with
Topics for next Post

More Related Content

PPTX
Data types of measurement scales
PPT
Multinomial logisticregression basicrelationships
PPT
Logistic regression
PDF
Introduction to Generalized Linear Models
PPTX
Introduction to Maximum Likelihood Estimator
PDF
Multiple Regression and Logistic Regression
PPTX
Generalized linear model
DOCX
Binary Logistic Regression
Data types of measurement scales
Multinomial logisticregression basicrelationships
Logistic regression
Introduction to Generalized Linear Models
Introduction to Maximum Likelihood Estimator
Multiple Regression and Logistic Regression
Generalized linear model
Binary Logistic Regression

What's hot (20)

PPTX
Q-Q Plot | Statistics
PPTX
Poisson regression models for count data
PDF
Categorical data analysis
PDF
Logistic Regression Analysis
PPTX
Sampling Distribution
PPTX
Principal component analysis
PPSX
Lasso and ridge regression
PPT
Ppt for 1.1 introduction to statistical inference
PPT
Regression analysis
PDF
Quantile Quantile Plot qq plot
PPTX
Multinomial Logistic Regression Analysis
PDF
Principal Component Analysis and Clustering
PDF
Checking for normality (Normal distribution)
PPTX
Regression
ODP
Multiple linear regression
PPTX
Logistic regression
PPT
Software packages for statistical analysis - SPSS
PPTX
Inferential statistics
PPTX
Statistical inference
Q-Q Plot | Statistics
Poisson regression models for count data
Categorical data analysis
Logistic Regression Analysis
Sampling Distribution
Principal component analysis
Lasso and ridge regression
Ppt for 1.1 introduction to statistical inference
Regression analysis
Quantile Quantile Plot qq plot
Multinomial Logistic Regression Analysis
Principal Component Analysis and Clustering
Checking for normality (Normal distribution)
Regression
Multiple linear regression
Logistic regression
Software packages for statistical analysis - SPSS
Inferential statistics
Statistical inference
Ad

Similar to R poisson regression (20)

PDF
R logistic regression
PDF
9_Poisson_printable.pdf
PDF
linear_tests_cheat_sheet linear_tests_cheat_sheet
PDF
Dem 7263 fall 2015 Spatial GLM's
PPTX
R Bootcamp Day 3 Part 1 - Statistics in R
PDF
Regression (II)
PDF
Chapter 18,19
PPTX
Logistical Regression.pptx
PDF
~Heather Turner_Introduction to generalized Linear Models.pdf
PPT
Logistic Regression in Case-Control Study
PDF
MLE Example
PPTX
GLM_2020_21.pptx
PDF
Regression (I)
PPTX
Generalized Linear Models for Between-Subjects Designs
PDF
eR-Biostat_LinearRegressioninR_2017_V1.pdf
PDF
3_MLE_printable.pdf
PPTX
Linear Regression.pptx
PDF
H2O World - GLM - Tomas Nykodym
R logistic regression
9_Poisson_printable.pdf
linear_tests_cheat_sheet linear_tests_cheat_sheet
Dem 7263 fall 2015 Spatial GLM's
R Bootcamp Day 3 Part 1 - Statistics in R
Regression (II)
Chapter 18,19
Logistical Regression.pptx
~Heather Turner_Introduction to generalized Linear Models.pdf
Logistic Regression in Case-Control Study
MLE Example
GLM_2020_21.pptx
Regression (I)
Generalized Linear Models for Between-Subjects Designs
eR-Biostat_LinearRegressioninR_2017_V1.pdf
3_MLE_printable.pdf
Linear Regression.pptx
H2O World - GLM - Tomas Nykodym
Ad

More from Learnbay Datascience (20)

PDF
Top data science projects
PDF
Python my SQL - create table
PDF
Python my SQL - create database
PDF
Python my sql database connection
PDF
Python - mySOL
PDF
AI - Issues and Terminology
PDF
AI - Fuzzy Logic Systems
PDF
AI - working of an ns
PDF
Artificial Intelligence- Neural Networks
PDF
AI - Robotics
PDF
Applications of expert system
PDF
Components of expert systems
PDF
Artificial intelligence - expert systems
PDF
AI - natural language processing
PDF
Ai popular search algorithms
PDF
AI - Agents & Environments
PDF
Artificial intelligence - research areas
PDF
Artificial intelligence composed
PDF
Artificial intelligence intelligent systems
PDF
Applications of ai
Top data science projects
Python my SQL - create table
Python my SQL - create database
Python my sql database connection
Python - mySOL
AI - Issues and Terminology
AI - Fuzzy Logic Systems
AI - working of an ns
Artificial Intelligence- Neural Networks
AI - Robotics
Applications of expert system
Components of expert systems
Artificial intelligence - expert systems
AI - natural language processing
Ai popular search algorithms
AI - Agents & Environments
Artificial intelligence - research areas
Artificial intelligence composed
Artificial intelligence intelligent systems
Applications of ai

Recently uploaded (20)

PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Complications of Minimal Access Surgery at WLH
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Institutional Correction lecture only . . .
PPTX
Presentation on HIE in infants and its manifestations
Final Presentation General Medicine 03-08-2024.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Microbial diseases, their pathogenesis and prophylaxis
GDM (1) (1).pptx small presentation for students
Complications of Minimal Access Surgery at WLH
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
O5-L3 Freight Transport Ops (International) V1.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Cell Types and Its function , kingdom of life
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Module 4: Burden of Disease Tutorial Slides S2 2025
STATICS OF THE RIGID BODIES Hibbelers.pdf
01-Introduction-to-Information-Management.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Institutional Correction lecture only . . .
Presentation on HIE in infants and its manifestations

R poisson regression

  • 1. Swipe R - Poisson Regression
  • 2. Poisson Regression involves regression models in which the response variable is in the form of counts and not fractional numbers. For example, the count of number of births or number of wins in a football match series. Also the values of the response variables follow a Poisson distribution. The general mathematical equation for Poisson regression is:- log(y) = a + b1x1 + b2x2 + bnxn R - Poisson Regression
  • 3. Following is the description of the parameters used − y is the response variable. a and b are the numeric coefficients. x is the predictor variable. The function used to create the Poisson regression model is the glm() function. The basic syntax for glm() function in Poisson regression is:- glm(formula,data,family)
  • 4. Following is the description of the parameters used in above functions − formula is the symbol presenting the relationship between the variables. data is the data set giving the values of these variables. family is R object to specify the details of the model. It's value is 'Poisson' for Logistic Regression.
  • 5. Example We have the in-built data set "warpbreaks" which describes the effect of wool type (A or B) and tension (low, medium or high) on the number of warp breaks per loom. Let's consider "breaks" as the response variable which is a count of number of breaks. The wool "type" and "tension" are taken as predictor variables. Input Data input <- warpbreaks print(head(input))
  • 6. When we execute the above code, it produces the following result:- breaks wool tension 1 26 A L 2 30 A L 3 54 A L 4 25 A L 5 70 A L 6 52 A L
  • 7. Create Regression Model output <-glm(formula = breaks ~ wool+tension, data = warpbreaks, family = poisson) print(summary(output)) When we execute the above code, it produces the following result:- Call: glm(formula = breaks ~ wool + tension, family = poisson, data = warpbreaks) Deviance Residuals: Min 1Q Median 3Q Max -3.6871 -1.6503 -0.4269 1.1902 4.2616
  • 8. Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 3.69196 0.04541 81.302 < 2e-16 *** woolB -0.20599 0.05157 -3.994 6.49e-05 *** tensionM -0.32132 0.06027 -5.332 9.73e-08 *** tensionH -0.51849 0.06396 -8.107 5.21e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for poisson family taken to be 1) Null deviance: 297.37 on 53 degrees of freedom Residual deviance: 210.39 on 50 degrees of freedom AIC: 493.06 Number of Fisher Scoring iterations: 4
  • 9. In the summary we look for the p-value in the last column to be less than 0.05 to consider an impact of the predictor variable on the response variable. As seen the wooltype B having tension type M and H have impact on the count of breaks.
  • 10. R - Time Series Analysis R - Nonlinear Least Square R - Decision Tree Stay Tuned with Topics for next Post